Nagios:...formance(3)
π Nagios::Plugin::Performance(3) π
okay so bestie, this is the Nagios::Plugin::Performance page from the User Contributed Perl Documentation β yes, the one all about handling Nagios::Plugin performance data. Pull up a chair, we're doing perfdata. π
β¨ NAME β¨
Nagios::Plugin::Performance β a whole class for handling Nagios::Plugin performance data. That's the vibe. π
πΈ SYNOPSIS πΈ
Here's the whole thing in code, no cap:
use Nagios::Plugin::Performance use_die => 1;
# Constructor (also accepts a 'threshold' obj instead of warning/critical)
$p = Nagios::Plugin::Performance->new(
label => 'size',
value => $value,
uom => "kB",
warning => $warning,
critical => $critical,
min => $min,
max => $max,
);
# Parser
@perf = Nagios::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;
π¦ DESCRIPTION π¦
Nagios::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).
Nagios::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 MODULE π
If you're using this module for the purposes of parsing perf data, you will probably want to set use_die => 1 at use time. This forces &Nagios::Plugin::Functions::nagios_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 π₯
Nagios::Plugin::Performance->new(%attributes)β instantiates a newNagios::Plugin::Performanceobject with the given attributes. β¨Nagios::Plugin::Performance->parse_perfstring($string)β returns an array ofNagios::Plugin::Performanceobjects based on the string entered. If there is an error parsing the string β which may consist of several sets of data β it will return an array with all the successfully parsed sets.
If values are input with commas instead of periods, due to different locale settings, then it will still be parsed, but the commas will be converted to periods. π
π OBJECT METHODS (ACCESSORS) π
label,value,uom,warning,critical,min,maxβ these all return scalars.minandmaxare not well supported yet. πthresholdβ returns aNagios::Plugin::Thresholdobject holding thewarningandcriticalranges for this performance data (if any). πrrdlabelβ returns a string based on'label'that is suitable for use as dataset name of an RRD i.e. mungeslabelto be 1-19 characters long with only characters[a-zA-Z0-9_].
This calls $self->clean_label and then truncates to 19 characters.
There is no guarantee that multiple N:P:Performance objects will have unique rrdlabels. π
clean_labelβ returns a "clean" label for use as a dataset name in RRD, ie, it converts characters that are not[a-zA-Z0-9_]to_.
It also converts "/" to "root" and "/{name}" to "{name}". π§
perfoutputβ outputs the data inNagios::Pluginperfdata format i.e.label=value[uom];[warn];[crit];[min];[max]. β
π SEE ALSO π
Nagios::Plugin, Nagios::Plugin::Threshold, http://nagiosplug.sourceforge.net.
π AUTHOR π
This code is maintained by the Nagios Plugin Development Team: see http://nagiosplug.sourceforge.net.
π COPYRIGHT AND LICENSE π
Copyright (C) 2006-2007 Nagios Plugin Development Team
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, bestie. It's from perl v5.42.0, dated 2024-03-04, and the page header is Nagios:...formance(3) β slay. π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: perl-Nagios-Plugin 0.36-bp160.1.8 Β· Artistic-1.0 or GPL-2.0+
- opensuse-leap 16.0: perl-Nagios-Plugin 0.36-bp160.1.8 Β· Artistic-1.0 or GPL-2.0+
- opensuse-leap 16.0: perl-Nagios-Plugin 0.36-bp160.1.8 Β· Artistic-1.0 or GPL-2.0+
- opensuse-leap 16.0: perl-Nagios-Plugin 0.36-bp160.1.8 Β· Artistic-1.0 or GPL-2.0+
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms