diff options
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 | } |