.. _expr-builtin-symbols: ********************************************* SANET built-in expression symbols ********************************************* .. toctree :maxdepth: 2 :numbered: The SNMP Expression language is used by SANET to perform nodes' monitoring. ====================== SNMP Expression values ====================== The SNMP subexpression evaluation (es: *1.3.6.1.2.1.1.1.0@* ) is **lazy**. This means that the value is retrieved from the network only when an effective manipulation of the value is required (comparisons, arithmetical operations and so on). ====================== Execution context ====================== When SANET performs an expression evaluation, the expression is executed with a set of variabiles called **execution context**. Datagroups' parameters are converted into variables and stored in the *execution context*. Depending to the object related to the expression (node/iface/storage and datasource or condition the **execution context** exports several built-in variables. NOTE: 'lazy' values are calculated at the right momement they are used inside an expression. This means an error could be raised (if these value can not be calculated) only if you use these symbols. .. _expr-builtin-symbols-common: ~~~~~~~~~~~~~~~~~~~~~~~~~ Common Built-in variables ~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------+------------------------------------------------------------------------------+ | Variable | Description | +==================+==============================================================================+ | $name | Sanet name of the current monitored element | +------------------+------------------------------------------------------------------------------+ | $timeout | Default timeout used when monitoring the node. | +------------------+------------------------------------------------------------------------------+ ~~~~~~~~~~~~~~~~ Elements symbols ~~~~~~~~~~~~~~~~ .. _expr-builtin-symbols-node: ------------------------- Built-in node's variables ------------------------- +--------------------+------------------------------------------------------------------------------------------------------------------+ | Variable | Description | +====================+==================================================================================================================+ | $nodename | Node name | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $ipversion | IP version used (4 o 6). (depends from node's IPv4/IPv6 flag) | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $community | SNMP community | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $snmpversion | SNMP version | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $snmpport | SNMP UDP port | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $dnsname | Configured DNS name | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $dns6name | Configured DNS name | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $ip4mgt | Configured IPv4 address | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $ip6mgt | Configured IPv6 address | +--------------------+------------------------------------------------------------------------------------------------------------------+ | $node | The effective name or ip4mgt/ip5mgt address used while monitoring the node. (depends from node's IPv4/IPv6 flag) | +--------------------+------------------------------------------------------------------------------------------------------------------+ The value of $node is calculated in this way: :: if $ipversion = 4 then $node = $ip4mgt or $dnsname or $nodename else $node = $ip6mgt or $dns6name or $nodename Special symbols: +--------------------+------------------------------------------------------------------------------------------------------------------+ | Variable | Description | +====================+==================================================================================================================+ | $node_effective_ip | The IP Sanet is configured to use for the node or the first resolved IP for the node name | +--------------------+------------------------------------------------------------------------------------------------------------------+ .. attention: $node_effective_ip is calculated only when the evaluation of the expression starts and then it's fixed. When a hostname resolves with several IPs, some Sanet code could use different IPs in two different moments of the expression. .. _expr-builtin-symbols-cluster: ------------------------------------- Built-in cluster management variables ------------------------------------- When a node belongs to a cluster and it's configured as 'dependent', the following symbols are available +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | Variable | Description | Lazy | +=======================+======================================================================================================================+============+ | $cluster_distinguisher| Configured distinguisher of the monitored element | | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | $cluster_xform' | Configured xform of the monitored element | | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | $cluster_instance | The instance calculated with cluster_xform and cluster_distinguisher | * | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | $cluster_node | The master holding informations about the node | * | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | $cluster_community | Master's snmp community | * | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | $cluster_snmpversion | Master's snmp version | * | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ | $cluster_snmpport | Master's snmp port | * | +-----------------------+----------------------------------------------------------------------------------------------------------------------+------------+ .. _expr-builtin-symbols-interface: ------------------------------ Built-in interface's variables ------------------------------ These variabiles are present only when the basecheck involves a SANET interface. +------------------+-----------------------------------------+ | Variable | Description | +==================+=========================================+ | $iface | Interface's name | +------------------+-----------------------------------------+ | $distinguisher | Interface distinguisher | +------------------+-----------------------------------------+ | $instance | alias for $distinguisher | +------------------+-----------------------------------------+ | $ifindex | Interface's IfIndex inside the node MIB | +------------------+-----------------------------------------+ | $backbone | Interface's backbone flag | +------------------+-----------------------------------------+ | $ifspeed | Interface's speed value | +------------------+-----------------------------------------+ .. _expr-builtin-symbols-linked: ------------------------------ Built-in linked elements ------------------------------ When an interface is part of a link, the *execution context* exports the symbols of the linked node/interface with the *linked_* name prefix : +-------------------------+--------------------------------------------------------------------------------------------------------+ | Variable | Description | +=========================+========================================================================================================+ | $linked_nodename | $nodename of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_ipversion | $ipversion of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_community | $community of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_snmpversion | $snmpversion of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_dnsname | $dnsname of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_dns6name | $dns6name of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_ip4mgt | $ip4mgt of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_ip6mgt | $ip6mgt of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_node | $node of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_snmpport | $snmpport of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_timeout | $timeout of the linked node | +-------------------------+--------------------------------------------------------------------------------------------------------+ +-------------------------+--------------------------------------------------------------------------------------------------------+ | Variable | Description | +=========================+========================================================================================================+ | $linked_iface | $iface of the linked iface | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_distinguisher | $distinguisher of the linked iface | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_instance | $instance of the linked iface (alias for $linked_distinguisher) | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_ifindex | $ifindex of the linked iface | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_backbone | $backbone of the linked iface | +-------------------------+--------------------------------------------------------------------------------------------------------+ | $linked_ifspeed | $ifspeed of the linked iface | +-------------------------+--------------------------------------------------------------------------------------------------------+ .. _expr-builtin-symbols-storage: ---------------------------- Built-in storage's variables ---------------------------- +------------------+----------------------------------------------------------------------------------------+------------+ | Variable | Description | Lazy | +==================+========================================================================================+============+ | $storage | Sanet storage name | | +------------------+----------------------------------------------------------------------------------------+------------+ | $distinguisher | Storage distinguisher | | +------------------+----------------------------------------------------------------------------------------+------------+ | $stindex | The value calculated from storage's distinguisher/xform | * | +------------------+----------------------------------------------------------------------------------------+------------+ .. _expr-builtin-symbols-service: ---------------------------- Built-in service's variables ---------------------------- +------------------+----------------------------------------------------------------------------------------+------------+ | Variable | Description | Lazy | +==================+========================================================================================+============+ | $service | Sanet service name | | +------------------+----------------------------------------------------------------------------------------+------------+ | $distinguisher | Service | | +------------------+----------------------------------------------------------------------------------------+------------+ | $swrunindex | The value calculated from storage's distinguisher/xform | * | +------------------+----------------------------------------------------------------------------------------+------------+ .. _expr-builtin-symbols-device: --------------------------- Built-in device's variables --------------------------- +------------------+----------------------------------------------------------------------------------------+------------+ | Variable | Description | Lazy | +==================+========================================================================================+============+ | $device | Sanet device name | | +------------------+----------------------------------------------------------------------------------------+------------+ | $distinguisher | Device distinguisher | | +------------------+----------------------------------------------------------------------------------------+------------+ | $devindex | The value calculated from storage's distinguisher/xform | * | +------------------+----------------------------------------------------------------------------------------+------------+ .. _expr-builtin-symbols-datagroup: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Built-in datagroup's variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------+----------------------------------------------------------------------------------------+ | Variable | Description | +==================+========================================================================================+ | $shorttries | Configured shorttries | +------------------+----------------------------------------------------------------------------------------+ .. _expr-builtin-symbols-datasource: -------------------------------- Built-in datasource's variables -------------------------------- Simple variables: +------------------+----------------------------------------------------------------------------------------+ | Variable | Description | +==================+========================================================================================+ | $delta | Last valid execution time of the datasource (seconds from 1970, UTC) | +------------------+----------------------------------------------------------------------------------------+ .. _expr-builtin-symbols-condition: -------------------------------- Built-in condition's variables -------------------------------- +------------------+----------------------------------------------------------------------------------------+ | Variable | Description | +==================+========================================================================================+ | $delta | Last valid execution time of the datasource (seconds from 1970, UTC) | +------------------+----------------------------------------------------------------------------------------+ .. _expr-builtin-symbols-special: -------------------------------- Built-in special symbols -------------------------------- Current/Old values values: +-------------------------------------+----------------------------------------------------------------------------------------+ | Variable | Description | +=====================================+========================================================================================+ | {*name* @} | The current value of the *name* datasource | +-------------------------------------+----------------------------------------------------------------------------------------+ | {*name* #} | The current value of the *name* datasource | +-------------------------------------+----------------------------------------------------------------------------------------+ Execution times: +-------------------------------------+----------------------------------------------------------------------------------------------+ | Variable | Description | +=====================================+==============================================================================================+ | {*name*.checktotaltime @} | The total execution time for the given *name* datasource/condition. | +-------------------------------------+----------------------------------------------------------------------------------------------+ | {*name*.checktotaltime #} | The total execution time for the given *name* datasource/condition at the previous check. | +-------------------------------------+----------------------------------------------------------------------------------------------+