O'Reilly logo

Nagios Core Administration Cookbook - Second Edition by Tom Ryder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing threshold checks in a plugin

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required