summaryrefslogtreecommitdiffstats
path: root/lib/Nagios/Plugin/Threshold.pm
diff options
context:
space:
mode:
authorGavin Carr <gonzai@users.sourceforge.net>2006-09-11 01:57:26 +0000
committerGavin Carr <gonzai@users.sourceforge.net>2006-09-11 01:57:26 +0000
commit1f8410dd1914449ce52ffa8fd47a308c5b372e52 (patch)
treedc14d10c159541daa211ef59f8d69e859e05fd13 /lib/Nagios/Plugin/Threshold.pm
parentbc239b3bd5023ed2da77ab03c581e56a4772f1d4 (diff)
downloadmonitoring-plugin-perl-1f8410dd1914449ce52ffa8fd47a308c5b372e52.tar.gz
Add constants, nagios_exit, and nagios_die to Nagios::Plugin::Base.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1477 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/Nagios/Plugin/Threshold.pm')
-rw-r--r--lib/Nagios/Plugin/Threshold.pm20
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/Nagios/Plugin/Threshold.pm b/lib/Nagios/Plugin/Threshold.pm
index 9e7b938..d7a8177 100644
--- a/lib/Nagios/Plugin/Threshold.pm
+++ b/lib/Nagios/Plugin/Threshold.pm
@@ -6,7 +6,7 @@ use strict;
6use warnings; 6use warnings;
7 7
8use Nagios::Plugin::Range; 8use Nagios::Plugin::Range;
9use Nagios::Plugin::Base; 9use Nagios::Plugin::Base qw(:codes nagios_die);
10our ($VERSION) = $Nagios::Plugin::Base::VERSION; 10our ($VERSION) = $Nagios::Plugin::Base::VERSION;
11 11
12use Class::Struct; 12use Class::Struct;
@@ -23,10 +23,7 @@ sub set_thresholds {
23 if (defined $r) { 23 if (defined $r) {
24 $t->warning($r); 24 $t->warning($r);
25 } else { 25 } else {
26 Nagios::Plugin::Base->die( { 26 nagios_die( "Warning range incorrect: '$args{warning}'" );
27 return_code => $ERRORS{UNKNOWN},
28 message => "Warning range incorrect: '$args{warning}'"
29 } );
30 } 27 }
31 } 28 }
32 if (defined $args{critical}) { 29 if (defined $args{critical}) {
@@ -34,10 +31,7 @@ sub set_thresholds {
34 if (defined $r) { 31 if (defined $r) {
35 $t->critical($r); 32 $t->critical($r);
36 } else { 33 } else {
37 Nagios::Plugin::Base->die( { 34 nagios_die( "Critical range incorrect: '$args{critical}'" );
38 return_code => $ERRORS{UNKNOWN},
39 message => "Critical range incorrect: '$args{critical}'"
40 } );
41 } 35 }
42 } 36 }
43 return $t; 37 return $t;
@@ -48,15 +42,15 @@ sub get_status {
48 42
49 if ($self->critical->is_set) { 43 if ($self->critical->is_set) {
50 if ($self->critical->check_range($value) == 1) { 44 if ($self->critical->check_range($value) == 1) {
51 return $ERRORS{CRITICAL}; 45 return CRITICAL;
52 } 46 }
53 } 47 }
54 if ($self->warning->is_set) { 48 if ($self->warning->is_set) {
55 if ($self->warning->check_range($value) == 1) { 49 if ($self->warning->check_range($value) == 1) {
56 return $ERRORS{WARNING}; 50 return WARNING;
57 } 51 }
58 } 52 }
59 return $ERRORS{OK}; 53 return OK;
60} 54}
61 55
621; 561;
@@ -81,7 +75,7 @@ Returns the warning or critical range as a Nagios::Plugin::Range object.
81 75
82=item get_status($value) 76=item get_status($value)
83 77
84Given a value, will see if the value breeches the critical or the warning range. Returns the status code. 78Given a value, will see if the value breaches the critical or the warning range. Returns the status code.
85 79
86=back 80=back
87 81