Page tree

SAYMON документация

Skip to end of metadata
Go to start of metadata

The basis of each example of using the DROP rule is the mutually exclusive include and exclude fields.

Example 1. Drop the specified metrics.

Purpose: not to display static metrics in the data table until the data on them are changed.

How to:

  1. In the monitoring section, configure the program and script execution probe.

    In the process of monitoring, 3 metrics are displayed in the data table: exitCode, stdout, stderr. Let the exitCode metric most of the time is "0" (the script execution completed). Track changes of other metrics will be more convenient if you hide the exitCode metric. But as soon as its value becomes different from 0, then the metric should be displayed in the data table with the current value.


  2. Drop the metric from the data table.
  3. In the data forming rules, configure the condition and the action:
    if  exitCode is not equal to 0, then overwrite the metric with the current value in the table.

    [
      {
        "actions": [
          {
            "type": "drop",
            "include": [
              "exitCode"
            ]
          }
        ]
      },
      {
        "condition": {
          "exitCode": {
            "_neq": "0"
          }
        },
        "actions": [
          {
            "type": "extend",
            "include": [
              "exitCode"
            ]
          }
        ]
      }
    ]

Example 2. Drop all metrics except those specified.

Purpose: to rename metric and update its value.

How to:

  1. In the Monitoring section, configure the MQTT sensor.

    Monitoring of the air temperature in the room is set up using the MQTT-sensor. The data table displays metrics: topic and stdout.message. message is the temperature value. Suppose that in the data table only this metric is displayed with the current values and the temperature name.

  2. Update all metrics.

  3. Create the temperature metric.

  4. Set into temperature the value from  stdout.message.

  5. Drop all metrics except  temperature.

[
  {
    "actions": [
      {
        "type": "extend"
      }
    ]
  },
  {
    "actions": [
      {
        "type": "extend",
        "include": [
          "temperature"
        ]
      }
    ]
  },
  {
    "actions": [
      {
        "type": "set",
        "field": "temperature",
        "value": "{{current.stdout.message}}"
      }
    ]
  },
  {
    "actions": [
      {
        "type": "drop",
        "exclude": [
          "temperature"
        ]
      }
    ]
  }
]

This is especially useful for visualizing values on a widget:

                                     BEFORE:                                                                                AFTER:

      

  • No labels