For a individual interpretation of data in check_multi the builtin state evaluation is a good means. It internally works with perl eval and therefore is extremely flexible.
Look at the following SNMP example as a simple introduction:
# sensor.cmd # # (c) Matthias Flacke # 30.12.2007 # # Flexible interpretation of smmp results command [ sensor ] = /usr/bin/snmpget -v 1 -c $COMMUNITY$ -Oqv $HOSTNAME$ XYZ-MIB::Sensor.0 state [ UNKNOWN ] = $sensor$ !~ /[4627859]/ state [ OK ] = ( $sensor$ == 4 || $sensor$ == 6 ) state [ WARNING ] = ( $sensor$ == 2 || $sensor$ == 7 || $sensor$ == 8 ) state [ CRITICAl ] = ( $sensor$ == 5 || $sensor$ == 9 )
What is happening here?
The first part, the sensor command is just a plain snmpget, as you probably often use in self written plugins.
But instead of a big if-else-clause check_multi uses state expressions to assign SNMP values to the different result values OK, WARNING and CRITICAL.
UNKNOWN has a special role here. It is used, when the SNMP value is not member of a specific group of numbers.
So this example really does not more than standard plugin also can do. But it shows how fast and reliable you can do develop such a SNMP plugin with check_multi. And if you want to change a value afterwards, you does not need to bother a developer. Any administrator can do this as well.
check_multi can do all the standard tasks like a normal plugin:
Comments