The <snmp-device-variables> Section

InterMapper can retrieve MIB variables from a device and then test them against thresholds. The <snmp-device-variables>section defines the OIDs of MIB variables that are to be retrieved. These values are called probe variables and can then be compared to thresholds to create alarms, warnings, etc.

Each line of the <snmp-device-variables> section defines a particular variable to be retrieved. The definition is composed of four comma-separated attributes:

[VariableName], [OID], [Type], [Chart Legend (optional)]

The definitions of these attributes are:

Here is a sample <snmp-device-variables> section.

<snmp-device-variables>
   --Variable-name  OID --- TYPE ---- CHART LEGEND ------
   ipForwDatagrams, 1.3.6.1.2.1.4.6.0, PER-SECOND, "Forwarded datagrams"
   ipInHdrErrors,   1.3.6.1.2.1.4.4.0, PER-MINUTE, "IP received header err"
   tcpCurrEstab,    1.3.6.1.2.1.6.9.0, DEFAULT, "Number of TCP conn's"
   sysDescr,        1.3.6.1.2.1.1.1.0, DEFAULT
   -- Non-polled values:-- Calculation variables are computed each poll time
   SineValue, (10*sin(0.01*time())), CALCULATION, "10 * sin(0.01 * time())"
</snmp-device-variables>

Note:The OIDs above have a trailing ".0" to specify their full OID.

Calculation Variables

A Calculation type variable receives the result of an arithmetic expression. After all variables have been polled, InterMapper calculates the expression, and sets the value of its variable to the result. In the example above:

SineValue, (10*sin(0.01*time())), CALCULATION, "10 * sin(0.01 * time())"

The variable "SineValue" will be set to the value of the expression (10 * sin(0.01 * time()). This gives a sine wave that makes an attractive chartable value. Use "$SineValue" to refer to the variable elsewhere in the probe.

Built-in Variables

InterMapper provides a number of built-in variables, They are detailed in the Built-in Variable Reference topic. Three macros are described below.

Macros

InterMapper supports several macros that show information about a variable:

${variablename} or $variablename

In the <snmp-device-display> section of a probe file, an occurrence of a variable name (with or without the curly braces ({...}) is replaced with its value, rounded to the nearest integer. For example, if a calculation variable has the value of 3.14159265, using it in the <display-output> section results in the value of "3"; if the variable had the value 4.75 it is be displayed as "5". This value is chartable, that is, clicking it makes a new strip chart, or dragging it adds it to an existing chart. The ipForwDatagrams variable defined above could be referred to in either of these forms:

${ipForwDatagrams} or $ipForwDatagrams

${chartable: xxx : yyy}

In the <snmp-device-display> section of a probe file, the ${chartable: ...} macro creates an underlined value that can be clicked to add it to a strip chart. The macro also controls the field width and number of decimal places. There are two parameters:

Examples:

${chartable: #.## : 3 }:         3.14 -->        3.14
${chartable: #.####### : 3 }:   3.1415927 -->   3.1415927
${chartable: "%3d" : 3 }:        3 -->         __3 (with 2 leading spaces)
${chartable: "%9.7f" : 3}:       3.1415927 ->    3.1415927
${chartable: "%11.7f" : 3}:      3.1415927 ->  __3.1415927 (also with 2 leading spaces)
${chartable: #.####### : 3*100}: 314.1592650 --> 314.1592650
${chartable: "%9.7f" : 3*100}:   314.1592650 -> 314.1592650
${chartable: "%11.7f" : 3*100}:  314.1592650 ->  314.1592650 (no leading spaces)

${variablename:legend}

In the <snmp-device-display> section of a probe file, the ${variablename:legend} macro is replaced with the legend field defined for that variable in the <snmp-device-variables> section. For example:

${ipForwDatagrams:legend}

results in the string "Forwarded datagrams".

${eval: expr}

In the <command-display> section of command-line probes, the <snmp-devicedisplay> section of SNMP probes, or the <script-output> section of TCP probes, use the ${eval} macro to perform calculations or to assign values to variables.

These macros are detailed inthe Built-in Variable Reference topic.

Enumerated Values

Many MIBs use an integer to represent one of several states. For example, ifOperStatus (1.3.6.1.2.1.2.2.1.8.x) is defined in MIB-II as:

INTEGER { up(1), down(2), testing(3) }

This means that the value 1 represents the "up" condition; 2 represents "down"; and 3 represents "testing".

If you define a variable to retrieve this value as INTEGER or DEFAULT, the probe will display the value as a number. If you define it as a STRING, the probe will use the MIB to find the string representation, and will set the variable to the value "up", "down", or "testing".

If the OID or MIB name isn't defined (because the corresponding MIB hasn't been imported or because of a typo), the probe will display the integer value.