O'Reilly logo

Nagios, 2nd Edition by Wolfgang Barth

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

25.3 Determining Thresholds

The format of the thresholds, which was discussed in 24.1.5 Specifying thresholds, page 557, is not easy to parse, which is why the functions from the module Nagios::Plugin are a welcome help:

$np->set_thresholds(
   warning  ⇒ $warn_threshold,
   critical ⇒ $crit_threshold,
);

$result = $np->check_threshold($size);

$np->nagios_exit($result, "check size: $size kByte");

The method set_thresholds has the task of setting the thresholds for the Nagios::Plugin instance $np.$warn_threshold and $crit_threshold contain the details that the user passed on to the options --warning and --critical on the command line.

check_threshold compares the thresholds with the total size of the directory in $size and stores the return code in the variable ...

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