diff options
author | Ton Voon <tonvoon@gmail.com> | 2011-12-22 11:56:08 -0500 |
---|---|---|
committer | Ton Voon <tonvoon@gmail.com> | 2011-12-22 11:56:08 -0500 |
commit | cce4fccf608b3e4accf7cbf2f11da23b3d627f15 (patch) | |
tree | 95eab212877fef34e132c1ee4d33055611e3bb4d /lib/Nagios/Plugin/Threshold.pm | |
parent | 95426817f66bbc7a1e4ad998fe10f327f0096257 (diff) | |
download | monitoring-plugin-perl-cce4fccf608b3e4accf7cbf2f11da23b3d627f15.tar.gz |
check_threshold to check multiple values at once
Diffstat (limited to 'lib/Nagios/Plugin/Threshold.pm')
-rw-r--r-- | lib/Nagios/Plugin/Threshold.pm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Nagios/Plugin/Threshold.pm b/lib/Nagios/Plugin/Threshold.pm index 73fce53..95a089b 100644 --- a/lib/Nagios/Plugin/Threshold.pm +++ b/lib/Nagios/Plugin/Threshold.pm | |||
@@ -16,11 +16,16 @@ sub get_status | |||
16 | { | 16 | { |
17 | my ($self, $value) = @_; | 17 | my ($self, $value) = @_; |
18 | 18 | ||
19 | if ($self->critical->is_set) { | 19 | $value = [ $value ] if (ref $value eq ""); |
20 | return CRITICAL if $self->critical->check_range($value); | 20 | foreach my $v (@$value) { |
21 | if ($self->critical->is_set) { | ||
22 | return CRITICAL if $self->critical->check_range($v); | ||
23 | } | ||
21 | } | 24 | } |
22 | if ($self->warning->is_set) { | 25 | foreach my $v (@$value) { |
23 | return WARNING if $self->warning->check_range($value); | 26 | if ($self->warning->is_set) { |
27 | return WARNING if $self->warning->check_range($v); | ||
28 | } | ||
24 | } | 29 | } |
25 | return OK; | 30 | return OK; |
26 | } | 31 | } |