You'll note that many of the plugins included in the Nagios Plugins set allow you to specify thresholds for different aspects of the tests that they perform, allowing custom configuration of which levels are ok, which need a warning, and which are critical. For example, the check_ping
plugin requires us to specify thresholds with -w
and -c
options that define limits for round-trip-time and packet loss:
$ /usr/local/nagios/libexec/check_ping -H 192.0.2.21 -w 100,20% -c 200,40% PING OK - Packet loss = 0%, RTA=0.20 ms|rta=0.200000ms;100.000000;100.000000;0.000000 pl=0%;10;20;0
In this case, the plugin's options are set only to raise a WARNING
state if the round-trip-time for the check exceeds 100 milliseconds or if more than 20% of the packets are lost. It will raise a CRITICAL
state if the check takes more than 200 milliseconds or 40% of the packets are lost.
When you're checking numeric values in a plugin, this is a useful way to allow the user to...