summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Nagios/Plugin/Performance.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm
index 63727c0..7ce5fa1 100644
--- a/lib/Nagios/Plugin/Performance.pm
+++ b/lib/Nagios/Plugin/Performance.pm
@@ -16,6 +16,12 @@ use Nagios::Plugin::Threshold;
16use Nagios::Plugin::Range; 16use Nagios::Plugin::Range;
17our ($VERSION) = $Nagios::Plugin::Functions::VERSION; 17our ($VERSION) = $Nagios::Plugin::Functions::VERSION;
18 18
19sub import {
20 my ($class, %attr) = @_;
21 $_ = $attr{use_die} || 0;
22 Nagios::Plugin::Functions::_use_die($_);
23}
24
19sub _parse { 25sub _parse {
20 my $class = shift; 26 my $class = shift;
21 my $string = shift; 27 my $string = shift;
@@ -112,7 +118,7 @@ performance data.
112 118
113=head1 SYNOPSIS 119=head1 SYNOPSIS
114 120
115 use Nagios::Plugin::Performance; 121 use Nagios::Plugin::Performance use_die => 1;
116 122
117 # Constructor (also accepts a 'threshold' obj instead of warning/critical) 123 # Constructor (also accepts a 'threshold' obj instead of warning/critical)
118 $p = Nagios::Plugin::Performance->new( 124 $p = Nagios::Plugin::Performance->new(
@@ -162,6 +168,14 @@ parse_perfstring), for turning nagios performance output strings into
162their components, and a composition interface (via new), for turning 168their components, and a composition interface (via new), for turning
163components into perfdata strings. 169components into perfdata strings.
164 170
171=head1 USE'ING THE MODULE
172
173If you are using this module for the purposes of parsing perf data, you
174will probably want to set use_die => 1 at use time. This forces
175&Nagios::Plugin::Functions::nagios_exit to call die() - rather than exit() -
176when an error occurs. This is then trappable by an eval. If you don't set use_die,
177then an error in these modules will cause your script to exit
178
165=head1 CLASS METHODS 179=head1 CLASS METHODS
166 180
167=over 4 181=over 4