SET examples

The basis of each example of the rule SET is value formats.

It is recommended to extend the data table with all of the metrics with the first action. Otherwise the metrics which are not specified in the rules, will not be updated in the data table:

[
  {
    "actions": [
      {
        "type": "extend"
      }
    ]
  }
...
]

Example 1: Numeric values and text data are set as value

Purpose: to expand the possibilities for setting up state change conditions and to increase the visualisation level.

How to:

Step 1: Configure the Ping probe in the section Monitoring

The metric packetLossPercentile (packet loss percentile) will be scrutinized here. In the example the valid value of packetLossPercentile is 10.

Step 2: Extend the data table with all of the metrics

[
  {
    "actions": [
      {
        "type": "extend"
      }
    ]
  },
...
]

Step 3: Configure the conditions and the actions in the section Data forming rules (Everything is OK)

If packetLossPercentile = [0; 10], then

  • the metric packetLossPercentile with the value OK will be written to the data table.

  • the metric over_packetLossPercentile with the value 0 - number of errors - will be created.

[
...
  {
    "conditions": [
      {
        "_field": {
          "name": "new.packetLossPercentile",
          "value": {
            "_lte": "10"
          }
        }
      }
    ],
    "actions": [
      {
        "type": "set",
        "field": "packetLossPercentile",
        "value": "OK"
      },
      {
        "type": "set",
        "field": "over_packetLossPercentile",
        "value": "0"
      }
    ]
  },
...
]

Step 4: Specify the state change condition for Working

If packetLossPercentile = OK, then the object changes its state to the WORKING one.

condition ok

Step 5: Configure the conditions and the actions in the section Data forming rules (emergency situation)

If packetLossPercentile > 10, and this value has come more than once (the case with one time is described later), then the metric packetLossPercentile with the value ALERT is written to the data table.

  [
...
 {
    "conditions": [
      {
        "_field": {
          "name": "new.packetLossPercentile",
          "value": {
            "_gt": "10"
          }
        }
      },
      {
        "_field": {
          "name": "new.over_packetLossPercentile",
          "value": {
            "_eq": "1"
          }
        }
      }
    ],
    "actions": [
      {
        "type": "drop",
        "include": "over_packetLossPercentile"
      },
      {
        "type": "set",
        "field": "packetLossPercentile",
        "value": "ALERT"
      }
    ]
  }
]

Step 6: Specify the state change condition for Alarm

if packetLossPercentile = alert, then the object changes its state to the ALARM one. And it requires immediate intervention from the technical support.

condition ok alert

Step 7: Configure the conditions and the actions in the section Data forming rules (error)

If packetLossPercentile > 10 and this value came once, then

  • the metric packetLossPercentile with the value alert is written to the data table,

  • the fact of overloading of permissible losses is fixed in the metric over_packetLossPercentile.

  [
...
 {
    "conditions": [
      {
        "_field": {
          "name": "new.packetLossPercentile",
          "value": {"_gt": "10"}
        }
      },
      {
        "_field": {
          "name": "current.over_packetLossPercentile",
          "value": {"_eq": "0"}
        }
      }
    ],
    "actions": [
  {
  "type": "set",
  "field": "over_packetLossPercentile",
  "value": "1"
 },
      {
        "type": "set",
        "field": "packetLossPercentile",
        "value": "WARNING"
      }
    ]
  }]

Step 8: Specify the state change condition for Overloaded

If packetLossPercentile = warning, then the object changes its state to the OVERLOADED one. And it is not the highest priority to solve by the technical support.

condition ok alert warn

This method allows to increase the visualization level of widgets.

widget ok

Example 2: Formulas using metrics from a data table with the pointers new and current are set as value

Purpose: to get the displaying of step values.

How to:

Step 1: Configure the probe Process by name in the section Monitoring.

The metric bytesResident (total process resident memory) in a single process will be scrutinized here. It is the difference between the new value and the current one: {{new.bytesResident}} - {{current.bytesResident}}.

Step 2: Extend the data table with all of the metrics

[
  {
    "actions": [
      {
        "type": "extend"
      }
    ]
  },
...
]

Step 3: Create a new metric last_diff (difference) and set the formula in the value in the section Data forming rules

[
  {
    "actions": [
      {
        "type": "set",
        "field": "last_diff",
        "value": "{{new.bytesResident}}-{{current.bytesResident}}"
      }
    ]
  }
]