1Monitoring::Plugin::PerUfsoerrmaCnocnet(r3i)buted Perl DMoocnuimteonrtiantgi:o:nPlugin::Performance(3)
2
3
4

NAME

6       Monitoring::Plugin::Performance - class for handling Monitoring::Plugin
7       performance data.
8

SYNOPSIS

10         use Monitoring::Plugin::Performance use_die => 1;
11
12         # Constructor (also accepts a 'threshold' obj instead of warning/critical)
13         $p = Monitoring::Plugin::Performance->new(
14             label     => 'size',
15             value     => $value,
16             uom       => "kB",
17             warning   => $warning,
18             critical  => $critical,
19             min       => $min,
20             max       => $max,
21         );
22
23         # Parser
24         @perf = Monitoring::Plugin::Performance->parse_perfstring(
25             "/=382MB;15264;15269;; /var=218MB;9443;9448"
26         )
27         or warn("Failed to parse perfstring");
28
29         # Accessors
30         for $p (@perf) {
31           printf "label:    %s\n",   $p->label;
32           printf "value:    %s\n",   $p->value;
33           printf "uom:      %s\n",   $p->uom;
34           printf "warning:  %s\n",   $p->warning;
35           printf "critical: %s\n",   $p->critical;
36           printf "min:      %s\n",   $p->min;
37           printf "max:      %s\n",   $p->max;
38           # Special accessor returning a threshold obj containing warning/critical
39           $threshold = $p->threshold;
40         }
41
42         # Perfdata output format i.e. label=value[uom];[warn];[crit];[min];[max]
43         print $p->perfoutput;
44

DESCRIPTION

46       Monitoring::Plugin class for handling performance data. This is a
47       public interface because it could be used by performance graphing
48       routines, such as nagiostat (http://nagiostat.sourceforge.net),
49       perfparse (http://perfparse.sourceforge.net), nagiosgraph
50       (http://nagiosgraph.sourceforge.net) or NagiosGrapher
51       (http://www.nagiosexchange.org/NagiosGrapher.84.0.html).
52
53       Monitoring::Plugin::Performance offers both a parsing interface (via
54       parse_perfstring), for turning nagios performance output strings into
55       their components, and a composition interface (via new), for turning
56       components into perfdata strings.
57

USE'ING THE MODULE

59       If you are using this module for the purposes of parsing perf data, you
60       will probably want to set use_die => 1 at use time. This forces
61       &Monitoring::Plugin::Functions::plugin_exit to call die() - rather than
62       exit() - when an error occurs. This is then trappable by an eval. If
63       you don't set use_die, then an error in these modules will cause your
64       script to exit
65

CLASS METHODS

67       Monitoring::Plugin::Performance->new(%attributes)
68           Instantiates a new Monitoring::Plugin::Performance object with the
69           given attributes.
70
71       Monitoring::Plugin::Performance->parse_perfstring($string)
72           Returns an array of Monitoring::Plugin::Performance objects based
73           on the string entered. If there is an error parsing the string -
74           which may consists of several sets of data -  will return an array
75           with all the successfully parsed sets.
76
77           If values are input with commas instead of periods, due to
78           different locale settings, then it will still be parsed, but the
79           commas will be converted to periods.
80

OBJECT METHODS (ACCESSORS)

82       label, value, uom, warning, critical, min, max
83           These all return scalars. min and max are not well supported yet.
84
85       threshold
86           Returns a Monitoring::Plugin::Threshold object holding the warning
87           and critical ranges for this performance data (if any).
88
89       rrdlabel
90           Returns a string based on 'label' that is suitable for use as
91           dataset name of an RRD i.e. munges label to be 1-19 characters long
92           with only characters [a-zA-Z0-9_].
93
94           This calls $self->clean_label and then truncates to 19 characters.
95
96           There is no guarantee that multiple N:P:Performance objects will
97           have unique rrdlabels.
98
99       clean_label
100           Returns a "clean" label for use as a dataset name in RRD, ie, it
101           converts characters that are not [a-zA-Z0-9_] to _.
102
103           It also converts "/" to "root" and "/{name}" to "{name}".
104
105       perfoutput
106           Outputs the data in Monitoring::Plugin perfdata format i.e.
107           label=value[uom];[warn];[crit];[min];[max].
108

SEE ALSO

110       Monitoring::Plugin, Monitoring::Plugin::Threshold,
111       https://www.monitoring-plugins.org/doc/guidelines.html
112

AUTHOR

114       This code is maintained by the Monitoring Plugin Development Team: see
115       https://monitoring-plugins.org
116
118       Copyright (C) 2014      by Monitoring Plugin Team Copyright (C)
119       2006-2014 by Nagios Plugin Development Team
120
121       This library is free software; you can redistribute it and/or modify it
122       under the same terms as Perl itself.
123
124
125
126perl v5.30.0                      2019-07-26Monitoring::Plugin::Performance(3)
Impressum