## Description

This section defines conditions to change states of objects and links:

If necessary, the graphic condition constructor can be switched to text mode using button on the right of the section's header.

The set of conditions is represented as a waterfall of sequential clauses.

## The sequence of conditions execution

The cycle works till the first condition is satisfied. In other case object state is changed to `NO DATA ON OBJECT`

with No suitable condition reason.

Object state is changed to default state (

`No data on object`

) that is configured in`server {}`

section of a server configuration file.

If it is required to prevent object state changing to the NO DATA ON OBJECT due to empty result of a **successful check** it is recommended to use unconditional clause last in the list, e.g. ALARM ON OBJECT:

The method described above works only for

successful checkthat returns empty result to the server. In case the check cannot be accomplished, object state is changed to`No data on object`

.

## The conditions composition

Each condition consists of:

- data source - metric name from agent data table;
- comparison operator - one of the available in the dropdown list, e.g., > or matches;
- sample value to compare with.

It is possible to use regular expressions with string comparision operators like

`matches`

.

Any condition can be composed of several subconditions joined by AND logic operator:

In this case subcondition 1 and subcondition 2 are joined by the curly bracket {.

There are also following additional actions in conditions available: fraction and duration.

fraction allows to compare division of 2 data sources with the sample value.

duration defines time period how long the condition must be satisfied continuously to change the object state.

The order of conditions can be changed with drag&drop.

## Formula editor

To create more complex conditions based on mathematical operations, it is recommended to use the formula editor. For the formula introduction it is necessary:

- Swith to manual input.
Enter the metric name in the condition field or select it in the filtered list of varients. The name of each metric must be written in the figure braces as follow:

**{{metric_name}}**.- Using mathematical symbols, constants and braces to enter the formula. For example, the difference between the maximal round-trip time and of minimal round-trip time:
**{{roundTripMaximum}} - {{roundTripMinimal}}**

Over the entered mathematical operation the result of calculations will automatically be displayed.

Below is the list of all available operators and functions:

Operator | Description |
---|---|

(...) | Grouping |

f(), x.y | Function call, property access |

! | Factorial |

^ | Exponentiation |

+, -, not, sqrt, etc. | Unary prefix operators (see below for the full list) |

*, /, % | Multiplication, division, remainder |

+, -, || | Addition, subtraction, concatenation |

==, !=, >=, <=, >, < | Equals, not equals, etc. |

and | Logical AND |

or | Logical OR |

x ? y : z | Ternary conditional (if x then y else z) |

Operator | Description |
---|---|

-x | Negation |

+x | Unary plus. This converts it's operand to a number, but has no other effect. |

x! | Factorial (x * (x-1) * (x-2) * … * 2 * 1). gamma(x + 1) for non-integers. |

abs x | Absolute value (magnatude) of x |

acos x | Arc cosine of x (in radians) |

acosh x | Hyperbolic arc cosine of x (in radians) |

asin x | Arc sine of x (in radians) |

asinh x | Hyperbolic arc sine of x (in radians) |

atan x | Arc tangent of x (in radians) |

atanh x | Hyperbolic arc tangent of x (in radians) |

ceil x | Ceiling of x — the smallest integer that’s >= x |

cos x | Cosine of x (x is in radians) |

cosh x | Hyperbolic cosine of x (x is in radians) |

exp x | e^x (exponential/antilogarithm function with base e) |

floor x | Floor of x — the largest integer that’s <= x |

length x | String length of x |

ln x | Natural logarithm of x |

log x | Natural logarithm of x (synonym for ln, not base-10) |

log10 x | Base-10 logarithm of x |

not x | Logical NOT operator |

round x | X, rounded to the nearest integer, using "gradeschool rounding" |

sin x | Sine of x (x is in radians) |

sinh x | Hyperbolic sine of x (x is in radians) |

sqrt x | Square root of x. Result is NaN (Not a Number) if x is negative. |

tan x | Tangent of x (x is in radians) |

tanh x | Hyperbolic tangent of x (x is in radians) |

trunc x | Integral part of a X, looks like floor(x) unless for negative number |

Function | Description |
---|---|

random(n) | Get a random number in the range [0, n). If n is zero, or not provided, it defaults to 1. |

min(a,b,…) | Get the smallest (minimum) number in the list |

max(a,b,…) | Get the largest (maximum) number in the list |

hypot(a,b) | Hypotenuse, i.e. the square root of the sum of squares of its arguments. |

pyt(a, b) | Alias for hypot |

pow(x, y) | Equivalent to x^y. For consistency with JavaScript's Math object. |

atan2(y, x) | Arc tangent of x/y. i.e. the angle between (0, 0) and (x, y) in radians. |

if(c, a, b) | Function form of c ? a : b |

## Using metrics from different objects

The states combination of several objects allows to determine the alarm reason. It is implemented using related probes - using metrics from different objects when setting up state conditions.

To do this, you must have access to these objects and, when setting the change conditions in the formula, specify the object ID and the name of the metric to be used after the colon. For example, summation of "stdout.x" of the object in question and "stdout.x" of another object:

**{{stdout.x}} + {{5b97713ed3ae514148346675:stdout.x}}**

## Additional control buttons

button allows to add comments, that will be displayed in State history of the object and sent in notifications.

and buttons allow to set new conditions to all objects of the same class and to make them default for all new objects of this class.

New default conditions do not override previously modified conditions of manually changed objects as they set to be "unique" or "custom".