From cce4fccf608b3e4accf7cbf2f11da23b3d627f15 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Thu, 22 Dec 2011 11:56:08 -0500 Subject: check_threshold to check multiple values at once --- lib/Nagios/Plugin/Threshold.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/Nagios/Plugin') 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 { my ($self, $value) = @_; - if ($self->critical->is_set) { - return CRITICAL if $self->critical->check_range($value); + $value = [ $value ] if (ref $value eq ""); + foreach my $v (@$value) { + if ($self->critical->is_set) { + return CRITICAL if $self->critical->check_range($v); + } } - if ($self->warning->is_set) { - return WARNING if $self->warning->check_range($value); + foreach my $v (@$value) { + if ($self->warning->is_set) { + return WARNING if $self->warning->check_range($v); + } } return OK; } -- cgit v1.2.3-74-g34f1