Skip to content

State Change Condition

State Change Condition model

Field Type Description
condition Object Condition that will trigger a state change.
state Integer ID of the state that the entity will change to when the condition is met.
description String State Condition's description.

Condition

Field Type Description
_and Array<Object> An array of conditions that all have to be met to trigger the state change.
_duration Integer The condition will trigger if the condition is met for this amount of time (in milliseconds).
_period Object The condition will trigger if the condition is met during this period.
_period.tz String Timezone of the period.
_period.startDay String The day of the week the period starts. "0" through "6" is for the weekdays (from Sunday through Saturday respectively); "-1" to start period every day.
_period.startTime Integer The time of the start of the period.
_period.stopDay String The day of the week the period end. "0" through "6" is for the weekdays (from Sunday through Saturday respectively); "-1" to end period every day.
_period.stopTime Integer The time of end of the period.

The condition also includes a metric represented by its name from the Data table of the current entity or an external object. In the example below, a state change will be triggered depending on the packetLossPercentile metric during the specified time period:

{
    "condition": {
        "packetLossPercentile": {
            "_eq": "0"
        }
    },
    "_period": {
        "tz": "Europe/Moscow",
        "startDay": "0",
        "startTime": 2876,
        "stopDay": "1",
        "stopTime": 60477
    }
    "state": 3,
    "description": "Ping ok"
},
{
    "condition": {
        "packetLossPercentile": {
            "_lt": "100"
        }
    },
    "_period": {
        "tz": "Europe/Moscow",
        "startDay": "0",
        "startTime": 2876,
        "stopDay": "1",
        "stopTime": 60477
    }
    "state": 4,
    "description": "Ping packets loss (partial)"
},
{
    "condition": {
        "packetLossPercentile": {
            "_eq": "100"
        }
    },
    "_period": {
        "tz": "Europe/Moscow",
        "startDay": "0",
        "startTime": 2876,
        "stopDay": "1",
        "stopTime": 60477
    }
    "state": 5,
    "description": "Ping packets loss (100% - host offline?)"
}