Environment References

Top  Previous  Next

Environment references point to special environment variables defined during the evaluation of an expression. For example, environment references may be used in event filter expression: there are context environment variable pointing to the context when the event occurred, and level variable containing its severity (details are here).

note_further-wt

Environment variables are provided by the system. There is no way to define new environment variables or change their values.

References to environment variables are formatted like this:

env/xxx: env is a predefined string (don't change it). You put it there to indicate the schema you're using (i.e, environment variables) and thus invoke the environment variable resolver. xxx is the name of the variable. An environment variable isn't the same as a context variable, so it never has a path. It refers to the currently running operation -- you just write its name.

note_example-wt

Example:

env/level

This environment variable contains the severity level of the current event being processed. This example may not seem very useful at this point: to make it really useful, you have to put it in an AggreGate Expression, which we'll discuss in the next chapter.

Standard Environment Variables

Some environment variables are defined in any environment:

Variable Name

Description

count

Number of calculations performed in the current environment. Equals to zero during the first calculation, and increments by one on each calculation.

note_example-wt

For example, if your expression referring {env/count} is used to calculate the data value for a chart, you may want to write something like {env/count} > 0 ? {value} - {previous/value} : null to suppress calculation of the first data value (because {previous/value} is not defined yet.

previous

Result of the previous calculation in the current environment.

time

Used in chart dataset expressions (see Event-based Data and Variable-based Data properties of the Chart component). Returns timestamp of the currently processed data point (time when event occurred of variable change time).

note_example-wt

time and previousTime environment variables may be used to create time charts of values these are increased on each measurement. For example, if {incomingBytes} reference returns number of bytes that were received by the device since its startup, you can create a traffic chart by using the following expression:

{previousTime} != null ? ({incomingBytes} - {previous/incomingBytes}) / ({env/time} - {env/previousTime}) : null

previousTime

Also used in chart dataset expressions. Returns timestamp of the previous data point or NULL for the first data point.