![]() |
![]()
| ![]() |
![]()
NAMEMonitoring::Plugin::Performance - class for handling Monitoring::Plugin performance data. SYNOPSISuse Monitoring::Plugin::Performance use_die => 1; # Constructor (also accepts a 'threshold' obj instead of warning/critical) $p = Monitoring::Plugin::Performance->new( label => 'size', value => $value, uom => "kB", warning => $warning, critical => $critical, min => $min, max => $max, ); # Parser @perf = Monitoring::Plugin::Performance->parse_perfstring( "/=382MB;15264;15269;; /var=218MB;9443;9448" ) or warn("Failed to parse perfstring"); # Accessors for $p (@perf) { printf "label: %s\n", $p->label; printf "value: %s\n", $p->value; printf "uom: %s\n", $p->uom; printf "warning: %s\n", $p->warning; printf "critical: %s\n", $p->critical; printf "min: %s\n", $p->min; printf "max: %s\n", $p->max; # Special accessor returning a threshold obj containing warning/critical $threshold = $p->threshold; } # Perfdata output format i.e. label=value[uom];[warn];[crit];[min];[max] print $p->perfoutput; DESCRIPTIONMonitoring::Plugin class for handling performance data. This is a public interface because it could be used by performance graphing routines, such as nagiostat (http://nagiostat.sourceforge.net), perfparse (http://perfparse.sourceforge.net), nagiosgraph (http://nagiosgraph.sourceforge.net) or NagiosGrapher (http://www.nagiosexchange.org/NagiosGrapher.84.0.html). Monitoring::Plugin::Performance offers both a parsing interface (via parse_perfstring), for turning nagios performance output strings into their components, and a composition interface (via new), for turning components into perfdata strings. USE'ING THE MODULEIf you are using this module for the purposes of parsing perf data, you will probably want to set use_die => 1 at use time. This forces &Monitoring::Plugin::Functions::plugin_exit to call die() - rather than exit() - when an error occurs. This is then trappable by an eval. If you don't set use_die, then an error in these modules will cause your script to exit CLASS METHODS
OBJECT METHODS (ACCESSORS)
SEE ALSOMonitoring::Plugin, Monitoring::Plugin::Threshold, https://www.monitoring-plugins.org/doc/guidelines.html AUTHORThis code is maintained by the Monitoring Plugin Development Team: see https://monitoring-plugins.org COPYRIGHT AND LICENSECopyright (C) 2014 by Monitoring Plugin Team Copyright (C) 2006-2014 by Nagios Plugin Development Team This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|