summaryrefslogtreecommitdiffstats
path: root/lib/Nagios
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Nagios')
-rw-r--r--lib/Nagios/Plugin.pm6
-rw-r--r--lib/Nagios/Plugin/Base.pm196
-rw-r--r--lib/Nagios/Plugin/ExitResult.pm6
-rw-r--r--lib/Nagios/Plugin/Functions.pm344
-rw-r--r--lib/Nagios/Plugin/Getopt.pm6
-rw-r--r--lib/Nagios/Plugin/Performance.pm4
-rw-r--r--lib/Nagios/Plugin/Range.pm4
-rw-r--r--lib/Nagios/Plugin/Threshold.pm4
8 files changed, 359 insertions, 211 deletions
diff --git a/lib/Nagios/Plugin.pm b/lib/Nagios/Plugin.pm
index 41bff91..5ff6709 100644
--- a/lib/Nagios/Plugin.pm
+++ b/lib/Nagios/Plugin.pm
@@ -11,7 +11,7 @@ struct "Nagios::__::Plugin" => {
11 11
12package Nagios::Plugin; 12package Nagios::Plugin;
13 13
14use Nagios::Plugin::Base; 14use Nagios::Plugin::Functions;
15use Nagios::Plugin::Performance; 15use Nagios::Plugin::Performance;
16use Nagios::Plugin::Threshold; 16use Nagios::Plugin::Threshold;
17 17
@@ -24,7 +24,7 @@ use Exporter;
24our @ISA = qw(Exporter Nagios::__::Plugin); 24our @ISA = qw(Exporter Nagios::__::Plugin);
25our @EXPORT_OK = qw(%ERRORS); 25our @EXPORT_OK = qw(%ERRORS);
26 26
27our $VERSION = $Nagios::Plugin::Base::VERSION; 27our $VERSION = $Nagios::Plugin::Functions::VERSION;
28 28
29sub add_perfdata { 29sub add_perfdata {
30 my ($self, %args) = @_; 30 my ($self, %args) = @_;
@@ -41,7 +41,7 @@ sub set_thresholds { shift; Nagios::Plugin::Threshold->set_thresholds(@_); }
41 41
42sub die { 42sub die {
43 my $self = shift; 43 my $self = shift;
44 Nagios::Plugin::Base::die(@_, { plugin => $self }); 44 Nagios::Plugin::Functions::die(@_, { plugin => $self });
45} 45}
46 46
471; 471;
diff --git a/lib/Nagios/Plugin/Base.pm b/lib/Nagios/Plugin/Base.pm
deleted file mode 100644
index 92651ed..0000000
--- a/lib/Nagios/Plugin/Base.pm
+++ /dev/null
@@ -1,196 +0,0 @@
1# This module holds all exported variables
2# and base functions
3package Nagios::Plugin::Base;
4
5use strict;
6use warnings;
7use File::Basename;
8
9our $VERSION = "0.13";
10
11our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT);
12
13require Exporter;
14our @ISA = qw(Exporter);
15our @EXPORT = (@STATUS_CODES, qw(nagios_exit %ERRORS));
16our @EXPORT_OK = qw(nagios_die %STATUS_TEXT);
17our %EXPORT_TAGS = (
18 all => [ @EXPORT, @EXPORT_OK ],
19 codes => [ @STATUS_CODES ],
20 functions => [ qw(nagios_exit nagios_die) ],
21);
22
23use constant OK => 0;
24use constant WARNING => 1;
25use constant CRITICAL => 2;
26use constant UNKNOWN => 3;
27use constant DEPENDENT => 4;
28
29our %ERRORS = (
30 'OK' => OK,
31 'WARNING' => WARNING,
32 'CRITICAL' => CRITICAL,
33 'UNKNOWN' => UNKNOWN,
34 'DEPENDENT' => DEPENDENT,
35);
36
37our %STATUS_TEXT = reverse %ERRORS;
38
39# _fake_exit flag and accessor/mutator, for testing
40my $_fake_exit = 0;
41sub _fake_exit { @_ ? $_fake_exit = shift : $_fake_exit };
42
43sub get_shortname {
44 my %arg = @_;
45
46 return $arg{plugin}->shortname if $arg{plugin};
47
48 my $shortname = uc basename($ENV{NAGIOS_PLUGIN} || $0);
49 $shortname =~ s/^CHECK_//;
50 return $shortname;
51}
52
53# nagios_exit( $code, $message )
54sub nagios_exit {
55 my ($code, $message, $arg) = @_;
56
57 # Handle named parameters
58 if (defined $code && ($code eq 'return_code' || $code eq 'message')) {
59 # Remove last argument if odd no and last is ref
60 if (int(@_ / 2) != @_ / 2 && ref $_[$#_]) {
61 $arg = pop @_;
62 } else {
63 undef $arg;
64 }
65 my %arg = @_;
66 $code = $arg{return_code};
67 $message = $arg{message};
68 }
69 $arg ||= {};
70
71 # Handle string codes
72 $code = $ERRORS{$code} if defined $code && exists $ERRORS{$code};
73
74 # Set defaults
75 $code = UNKNOWN unless defined $code && exists $STATUS_TEXT{$code};
76 $message = '' unless defined $message;
77 $message = join(' ', @$message) if ref $message eq 'ARRAY';
78
79 # Setup output
80 my $output = "$STATUS_TEXT{$code}";
81 $output .= " - $message" if defined $message && $message ne '';
82 my $shortname = get_shortname(plugin => $arg->{plugin});
83 $output = "$shortname $output" if $shortname;
84 if ($arg->{plugin}) {
85 my $plugin = $arg->{plugin};
86 $output .= " | ". $plugin->all_perfoutput if $plugin->perfdata;
87 }
88 $output .= "\n";
89
90 # Don't actually exit if _fake_exit set
91 if ($_fake_exit) {
92 require Nagios::Plugin::ExitResult;
93 return Nagios::Plugin::ExitResult->new($code, $output);
94 }
95
96 # Print output and exit
97 print $output;
98 exit $code;
99}
100
101# nagios_die( $message, [ $code ]) OR nagios_die( $code, $message )
102# Default $code: UNKNOWN
103sub nagios_die {
104 my ($arg1, $arg2, $rest) = @_;
105
106 # Named parameters
107 if (defined $arg1 && ($arg1 eq 'return_code' || $arg1 eq 'message')) {
108 return nagios_exit(@_);
109 }
110
111 # ($code, $message)
112 elsif (defined $arg1 && (exists $ERRORS{$arg1} || exists $STATUS_TEXT{$arg1})) {
113 return nagios_exit(@_);
114 }
115
116 # ($message, $code)
117 elsif (defined $arg2 && (exists $ERRORS{$arg2} || exists $STATUS_TEXT{$arg2})) {
118 return nagios_exit($arg2, $arg1, $rest);
119 }
120
121 # Else just assume $arg1 is the message and hope for the best
122 else {
123 return nagios_exit( UNKNOWN, $arg1, $rest );
124 }
125}
126
127# For backwards compatibility
128sub die { nagios_die(@_); }
129
130
131=pod old
132
133my $exit_on_die = 1;
134sub exit_on_die { shift; @_ ? $exit_on_die = shift : $exit_on_die };
135my $print_on_die = 1;
136sub print_on_die { shift; @_ ? $print_on_die = shift : $print_on_die };
137
138# Old version - TODO: remove
139sub old_die {
140 my ($class, $args, $plugin) = @_;
141 my $return_code;
142
143 if ( exists $args->{return_code}
144 && exists $STATUS_TEXT{$args->{return_code}}
145 ) {
146 $return_code = $args->{return_code};
147 }
148 else {
149 $return_code = $ERRORS{UNKNOWN};
150 }
151 my $message = $args->{message} || "Internal error";
152 my $output = join(" ", $STATUS_TEXT{$return_code}, $message);
153 if ($plugin) {
154 $output = $plugin->shortname." $output" if $plugin->shortname;
155 $output .= " | ".$plugin->all_perfoutput if $plugin->perfdata;
156 }
157 if ($print_on_die) {
158 print $output, $/;
159 }
160 if ($exit_on_die) {
161 exit $return_code;
162 } else {
163 return $output;
164 }
165}
166
167=cut
168
1691;
170
171# vim:sw=4:sm:et
172
173__END__
174
175=head1 NAME
176
177Nagios::Plugin::Base - Base functions for Nagios::Plugins
178
179=head1 DESCRIPTION
180
181See Nagios::Plugin for public interfaces. This module is for Nagios::Plugin developers to incorporate
182common backend functionality.
183
184=head1 AUTHOR
185
186Ton Voon, E<lt>ton.voon@altinity.comE<gt>
187
188=head1 COPYRIGHT AND LICENSE
189
190Copyright (C) 2006 by Nagios Plugin Development Team
191
192This library is free software; you can redistribute it and/or modify
193it under the same terms as Perl itself, either Perl version 5.8.4 or,
194at your option, any later version of Perl 5 you may have available.
195
196=cut
diff --git a/lib/Nagios/Plugin/ExitResult.pm b/lib/Nagios/Plugin/ExitResult.pm
index f059424..191c92a 100644
--- a/lib/Nagios/Plugin/ExitResult.pm
+++ b/lib/Nagios/Plugin/ExitResult.pm
@@ -30,10 +30,10 @@ return codes when testing.
30=head1 SYNOPSIS 30=head1 SYNOPSIS
31 31
32 use Test::More; 32 use Test::More;
33 use Nagios::Plugin::Base; 33 use Nagios::Plugin::Functions;
34 34
35 # In a test file somewhere 35 # In a test file somewhere
36 Nagios::Plugin::Base::_fake_exit(1); 36 Nagios::Plugin::Functions::_fake_exit(1);
37 37
38 # Later ... 38 # Later ...
39 $e = nagios_exit( CRITICAL, 'aiiii ...' ); 39 $e = nagios_exit( CRITICAL, 'aiiii ...' );
@@ -50,7 +50,7 @@ return codes when testing.
50Nagios::Plugin::ExitResult is a tiny helper class intended for use 50Nagios::Plugin::ExitResult is a tiny helper class intended for use
51when testing other Nagios::Plugin modules. A Nagios::Plugin::ExitResult 51when testing other Nagios::Plugin modules. A Nagios::Plugin::ExitResult
52object is returned by nagios_exit() and friends when 52object is returned by nagios_exit() and friends when
53Nagios::Plugin::Base::_fake_exit has been set, instead of doing a 53Nagios::Plugin::Functions::_fake_exit has been set, instead of doing a
54conventional print + exit. 54conventional print + exit.
55 55
56=head1 AUTHOR 56=head1 AUTHOR
diff --git a/lib/Nagios/Plugin/Functions.pm b/lib/Nagios/Plugin/Functions.pm
new file mode 100644
index 0000000..9c20288
--- /dev/null
+++ b/lib/Nagios/Plugin/Functions.pm
@@ -0,0 +1,344 @@
1# This module holds all exported variables
2# and base functions
3package Nagios::Plugin::Functions;
4
5use strict;
6use warnings;
7use File::Basename;
8use Params::Validate qw(validate :types);
9
10our $VERSION = "0.13";
11
12our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT);
13
14require Exporter;
15our @ISA = qw(Exporter);
16our @EXPORT = (@STATUS_CODES, qw(nagios_exit nagios_die check_messages));
17our @EXPORT_OK = qw(%ERRORS %STATUS_TEXT);
18our %EXPORT_TAGS = (
19 all => [ @EXPORT, @EXPORT_OK ],
20 codes => [ @STATUS_CODES ],
21 functions => [ qw(nagios_exit nagios_die check_messages) ],
22);
23
24use constant OK => 0;
25use constant WARNING => 1;
26use constant CRITICAL => 2;
27use constant UNKNOWN => 3;
28use constant DEPENDENT => 4;
29
30our %ERRORS = (
31 'OK' => OK,
32 'WARNING' => WARNING,
33 'CRITICAL' => CRITICAL,
34 'UNKNOWN' => UNKNOWN,
35 'DEPENDENT' => DEPENDENT,
36);
37
38our %STATUS_TEXT = reverse %ERRORS;
39
40# _fake_exit flag and accessor/mutator, for testing
41my $_fake_exit = 0;
42sub _fake_exit { @_ ? $_fake_exit = shift : $_fake_exit };
43
44sub get_shortname {
45 my %arg = @_;
46
47 return $arg{plugin}->shortname if $arg{plugin};
48
49 my $shortname = uc basename($ENV{NAGIOS_PLUGIN} || $0);
50 $shortname =~ s/^CHECK_//;
51 return $shortname;
52}
53
54# nagios_exit( $code, $message )
55sub nagios_exit {
56 my ($code, $message, $arg) = @_;
57
58 # Handle named parameters
59 if (defined $code && ($code eq 'return_code' || $code eq 'message')) {
60 # Remove last argument if odd no and last is ref
61 if (int(@_ / 2) != @_ / 2 && ref $_[$#_]) {
62 $arg = pop @_;
63 } else {
64 undef $arg;
65 }
66 my %arg = @_;
67 $code = $arg{return_code};
68 $message = $arg{message};
69 }
70 $arg ||= {};
71
72 # Handle string codes
73 $code = $ERRORS{$code} if defined $code && exists $ERRORS{$code};
74
75 # Set defaults
76 $code = UNKNOWN unless defined $code && exists $STATUS_TEXT{$code};
77 $message = '' unless defined $message;
78 $message = join(' ', @$message) if ref $message eq 'ARRAY';
79
80 # Setup output
81 my $output = "$STATUS_TEXT{$code}";
82 $output .= " - $message" if defined $message && $message ne '';
83 my $shortname = get_shortname(plugin => $arg->{plugin});
84 $output = "$shortname $output" if $shortname;
85 if ($arg->{plugin}) {
86 my $plugin = $arg->{plugin};
87 $output .= " | ". $plugin->all_perfoutput if $plugin->perfdata;
88 }
89 $output .= "\n";
90
91 # Don't actually exit if _fake_exit set
92 if ($_fake_exit) {
93 require Nagios::Plugin::ExitResult;
94 return Nagios::Plugin::ExitResult->new($code, $output);
95 }
96
97 # Print output and exit
98 print $output;
99 exit $code;
100}
101
102# nagios_die( $message, [ $code ]) OR nagios_die( $code, $message )
103# Default $code: UNKNOWN
104sub nagios_die {
105 my ($arg1, $arg2, $rest) = @_;
106
107 # Named parameters
108 if (defined $arg1 && ($arg1 eq 'return_code' || $arg1 eq 'message')) {
109 return nagios_exit(@_);
110 }
111
112 # ($code, $message)
113 elsif (defined $arg1 && (exists $ERRORS{$arg1} || exists $STATUS_TEXT{$arg1})) {
114 return nagios_exit(@_);
115 }
116
117 # ($message, $code)
118 elsif (defined $arg2 && (exists $ERRORS{$arg2} || exists $STATUS_TEXT{$arg2})) {
119 return nagios_exit($arg2, $arg1, $rest);
120 }
121
122 # Else just assume $arg1 is the message and hope for the best
123 else {
124 return nagios_exit( UNKNOWN, $arg1, $rest );
125 }
126}
127
128# For backwards compatibility
129sub die { nagios_die(@_); }
130
131
132# ------------------------------------------------------------------------
133# check_messages - return a status and/or message based on a set of
134# message arrays.
135# Returns a nagios status code in scalar context.
136# Returns a code and a message in list context.
137# The message is join($join, @array) for the relevant array for the code,
138# or join($join_all, $message) for all arrays if $join_all is set.
139sub check_messages {
140 my %arg = validate( @_, {
141 critical => { type => ARRAYREF },
142 warning => { type => ARRAYREF },
143 ok => { type => ARRAYREF | SCALAR, optional => 1 },
144 'join' => { default => ' ' },
145 join_all => 0,
146 });
147 $arg{join} = ' ' unless defined $arg{join};
148
149 # Decide $code
150 my $code = OK;
151 $code ||= CRITICAL if @{$arg{critical}};
152 $code ||= WARNING if @{$arg{warning}};
153 return $code unless wantarray;
154
155 # Compose message
156 my $message = '';
157 if ($arg{join_all}) {
158 $message = join( $arg{join_all},
159 map { @$_ ? join( $arg{'join'}, @$_) : () }
160 $arg{critical},
161 $arg{warning},
162 $arg{ok} ? (ref $arg{ok} ? $arg{ok} : [ $arg{ok} ]) : []
163 );
164 }
165
166 else {
167 $message ||= join( $arg{'join'}, @{$arg{critical}} )
168 if $code == CRITICAL;
169 $message ||= join( $arg{'join'}, @{$arg{warning}} )
170 if $code == WARNING;
171 $message ||= ref $arg{ok} ? join( $arg{'join'}, @{$arg{ok}} ) : $arg{ok}
172 if $arg{ok};
173 }
174
175 return ($code, $message);
176}
177
178# ------------------------------------------------------------------------
179
1801;
181
182# vim:sw=4:sm:et
183
184__END__
185
186=head1 NAME
187
188Nagios::Plugin::Functions - functions to simplify the creation of
189Nagios plugins.
190
191=head1 SYNOPSIS
192
193 # Constants OK, WARNING, CRITICAL, and UNKNOWN exported by default
194 use Nagios::Plugin::Functions;
195
196 # nagios_exit( ODE, $message ) - exit with error code CODE,
197 # and message "PLUGIN CODE - $message"
198 nagios_exit( CRITICAL, $critical_error ) if $critical_error;
199 nagios_exit( WARNING, $warning_error ) if $warning_error;
200 nagios_exit( OK, $result );
201
202 # nagios_die( $message, [$CODE] ) - just like nagios_exit(),
203 # but CODE is optional, defaulting to UNKNOWN
204 do_something()
205 or nagios_die("do_something() failed horribly");
206 do_something_critical()
207 or nagios_die("do_something_critical() failed", CRITICAL);
208
209 # check_messages - check a set of message arrays, returning a
210 # CODE and/or a result message
211 $code = check_messages(critical => \@crit, warning => \@warn);
212 ($code, $message) = check_messages(
213 critical => \@crit, warning => \@warn,
214 ok => \@ok );
215
216
217=head1 DESCRIPTION
218
219This module is part of the Nagios::Plugin family, a set of modules
220for simplifying the creation of Nagios plugins. This module exports
221convenience functions for the class methods provided by
222Nagios::Plugin. It is intended for those who prefer a simpler
223functional interface, and who do not need the additional
224functionality of Nagios::Plugin.
225
226=head2 Exports
227
228Nagios status code constants are exported by default:
229
230 OK
231 WARNING
232 CRITICAL
233 UNKNOWN
234 DEPENDENT
235
236as are the following functions:
237
238 nagios_exit
239 nagios_die
240 check_messages
241
242The following variables are exported only on request:
243
244 %ERRORS
245 %STATUS_TEXT
246
247
248=head2 Functions
249
250The following functions are supported:
251
252=over 4
253
254=item nagios_exit( CODE, $message )
255
256Exit with return code CODE, and a standard nagios message of the
257form "PLUGIN CODE - $message".
258
259=item nagios_die( $message, [CODE] )
260
261Same as nagios_exit(), except that CODE is optional, defaulting
262to UNKNOWN.
263
264=item check_messages( critical => \@crit, warning => \@warn )
265
266Convenience function to check a set of message arrays and return
267an appropriate nagios return code and/or a result message. Returns
268only a return code in scalar context; returns a return code and an
269error message in list context i.e.
270
271 # Scalar context
272 $code = check_messages(critical => \@crit, warning => \@warn);
273 # List context
274 ($code, $msg) = check_messages(critical => \@crit, warning => \@warn);
275
276check_messages() accepts the following named arguments:
277
278=over 4
279
280=item critical => ARRAYREF
281
282An arrayref of critical error messages - check_messages() returns
283CRITICAL if this arrayref is non-empty. Mandatory.
284
285=item warning => ARRAYREF
286
287An arrayref of warning error messages - check_messages() returns
288WARNING if this arrayref is non-empty ('critical' is checked
289first). Mandatory.
290
291=item ok => ARRAYREF | SCALAR
292
293An arrayref of informational messages (or a single scalar message),
294used in list context if both the 'critical' and 'warning' arrayrefs
295are empty. Optional.
296
297=item join => SCALAR
298
299A string used to join the relevant array to generate the message
300string returned in list context i.e. if the 'critical' array @crit
301is non-empty, check_messages would return:
302
303 join( $join, @crit )
304
305as the result message. Optional; default: ' ' (space).
306
307=item join_all => SCALAR
308
309By default, only one set of messages are joined and returned in the
310result message i.e. if the result is CRITICAL, only the 'critical'
311messages are included in the result; if WARNING, only the 'warning'
312messages are included; if OK, the 'ok' messages are included (if
313supplied) i.e. the default is to return an 'errors-only' type
314message.
315
316If join_all is supplied, however, it will be used as a string to
317join the resultant critical, warning, and ok messages together i.e.
318all messages are joined and returned.
319
320=back
321
322=back
323
324
325=head1 SEE ALSO
326
327Nagios::Plugin; the nagios plugin developer guidelines at
328http://nagiosplug.sourceforge.net/developer-guidelines.html.
329
330
331=head1 AUTHORS
332
333Ton Voon, E<lt>ton.voon@altinity.comE<gt>
334
335
336=head1 COPYRIGHT AND LICENSE
337
338Copyright (C) 2006 by Nagios Plugin Development Team
339
340This library is free software; you can redistribute it and/or modify
341it under the same terms as Perl itself, either Perl version 5.8.4 or,
342at your option, any later version of Perl 5 you may have available.
343
344=cut
diff --git a/lib/Nagios/Plugin/Getopt.pm b/lib/Nagios/Plugin/Getopt.pm
index 7f32c3b..8a9fc1c 100644
--- a/lib/Nagios/Plugin/Getopt.pm
+++ b/lib/Nagios/Plugin/Getopt.pm
@@ -12,9 +12,9 @@ use Carp;
12use Params::Validate qw(:all); 12use Params::Validate qw(:all);
13use base qw(Class::Accessor); 13use base qw(Class::Accessor);
14 14
15use Nagios::Plugin::Base; 15use Nagios::Plugin::Functions;
16use vars qw($VERSION); 16use vars qw($VERSION);
17$VERSION = $Nagios::Plugin::Base::VERSION; 17$VERSION = $Nagios::Plugin::Functions::VERSION;
18 18
19# Standard defaults 19# Standard defaults
20my %DEFAULT = ( 20my %DEFAULT = (
@@ -586,7 +586,7 @@ Gavin Carr <gavin@openfusion.com.au>
586 586
587=head1 COPYRIGHT AND LICENSE 587=head1 COPYRIGHT AND LICENSE
588 588
589Copyright 2005-2006 Gavin Carr. All Rights Reserved. 589Copyright (C) 2006 by the Nagios Plugin Development Team.
590 590
591This module is free software. It may be used, redistributed 591This module is free software. It may be used, redistributed
592and/or modified under either the terms of the Perl Artistic 592and/or modified under either the terms of the Perl Artistic
diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm
index 9e99f54..38803a6 100644
--- a/lib/Nagios/Plugin/Performance.pm
+++ b/lib/Nagios/Plugin/Performance.pm
@@ -7,8 +7,8 @@ use warnings;
7 7
8use Carp; 8use Carp;
9use Nagios::Plugin::Threshold; 9use Nagios::Plugin::Threshold;
10use Nagios::Plugin::Base; 10use Nagios::Plugin::Functions;
11our ($VERSION) = $Nagios::Plugin::Base::VERSION; 11our ($VERSION) = $Nagios::Plugin::Functions::VERSION;
12 12
13use Class::Struct; 13use Class::Struct;
14struct "Nagios::Plugin::Performance" => { 14struct "Nagios::Plugin::Performance" => {
diff --git a/lib/Nagios/Plugin/Range.pm b/lib/Nagios/Plugin/Range.pm
index b17cc96..f354a54 100644
--- a/lib/Nagios/Plugin/Range.pm
+++ b/lib/Nagios/Plugin/Range.pm
@@ -6,8 +6,8 @@ use strict;
6use warnings; 6use warnings;
7use Carp; 7use Carp;
8 8
9use Nagios::Plugin::Base; 9use Nagios::Plugin::Functions;
10our ($VERSION) = $Nagios::Plugin::Base::VERSION; 10our ($VERSION) = $Nagios::Plugin::Functions::VERSION;
11 11
12use overload 12use overload
13 '""' => sub { shift->stringify }; 13 '""' => sub { shift->stringify };
diff --git a/lib/Nagios/Plugin/Threshold.pm b/lib/Nagios/Plugin/Threshold.pm
index d7a8177..3e14d82 100644
--- a/lib/Nagios/Plugin/Threshold.pm
+++ b/lib/Nagios/Plugin/Threshold.pm
@@ -6,8 +6,8 @@ use strict;
6use warnings; 6use warnings;
7 7
8use Nagios::Plugin::Range; 8use Nagios::Plugin::Range;
9use Nagios::Plugin::Base qw(:codes nagios_die); 9use Nagios::Plugin::Functions qw(:codes nagios_die);
10our ($VERSION) = $Nagios::Plugin::Base::VERSION; 10our ($VERSION) = $Nagios::Plugin::Functions::VERSION;
11 11
12use Class::Struct; 12use Class::Struct;
13struct "Nagios::Plugin::Threshold" => { 13struct "Nagios::Plugin::Threshold" => {