diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-15 09:11:54 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-15 09:11:54 +0000 |
commit | f948ceecba9b5f6cb0aef9aae6f6be18ba6feffe (patch) | |
tree | 687e8c72f89ae9cced849754e362f1cde19ae745 /lib/Nagios/Plugin/Threshold.pm | |
parent | e736a3c2b0a62707f12cf66fbb65ef23eeb01dd6 (diff) | |
download | monitoring-plugin-perl-f948ceecba9b5f6cb0aef9aae6f6be18ba6feffe.tar.gz |
is_set method to see if a range has been set
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1429 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/Nagios/Plugin/Threshold.pm')
-rw-r--r-- | lib/Nagios/Plugin/Threshold.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Nagios/Plugin/Threshold.pm b/lib/Nagios/Plugin/Threshold.pm index 9c5d042..1b332b9 100644 --- a/lib/Nagios/Plugin/Threshold.pm +++ b/lib/Nagios/Plugin/Threshold.pm | |||
@@ -16,7 +16,7 @@ struct "Nagios::Plugin::Threshold" => { | |||
16 | 16 | ||
17 | sub set_thresholds { | 17 | sub set_thresholds { |
18 | my ($class, %args) = @_; | 18 | my ($class, %args) = @_; |
19 | my $t = $class->new; | 19 | my $t = $class->new( warning => Nagios::Plugin::Range->new, critical => Nagios::Plugin::Range->new ); |
20 | if (defined $args{warning}) { | 20 | if (defined $args{warning}) { |
21 | my $r = Nagios::Plugin::Range->parse_range_string($args{warning}); | 21 | my $r = Nagios::Plugin::Range->parse_range_string($args{warning}); |
22 | if (defined $r) { | 22 | if (defined $r) { |
@@ -44,12 +44,12 @@ sub set_thresholds { | |||
44 | 44 | ||
45 | sub get_status { | 45 | sub get_status { |
46 | my ($self, $value) = @_; | 46 | my ($self, $value) = @_; |
47 | if ($self->critical) { | 47 | if ($self->critical->is_set) { |
48 | if ($self->critical->check_range($value) == 1) { | 48 | if ($self->critical->check_range($value) == 1) { |
49 | return $ERRORS{CRITICAL}; | 49 | return $ERRORS{CRITICAL}; |
50 | } | 50 | } |
51 | } | 51 | } |
52 | if ($self->warning) { | 52 | if ($self->warning->is_set) { |
53 | if ($self->warning->check_range($value) == 1) { | 53 | if ($self->warning->check_range($value) == 1) { |
54 | return $ERRORS{WARNING}; | 54 | return $ERRORS{WARNING}; |
55 | } | 55 | } |