2009-09-02 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Fixed the matches_value alert option (was not
          working properly).




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1904 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2009-09-02 11:22:05 +00:00
parent 7097b6ace8
commit 983d1f373a
2 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2009-09-02 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Fixed the matches_value alert option (was not
working properly).
2009-09-02 Ramon Novoa <rnovoa@artica.es>
* conf/pandora_server.conf,

View File

@ -157,20 +157,23 @@ sub pandora_evaluate_alert ($$$$$$) {
return $status if ($alert->{'type'} eq "max" && $data <= $alert->{'max_value'});
if ($alert->{'type'} eq "max_min") {
return $status if ($alert->{'matches_value'} == 1 &&
$data <= $alert->{'min_value'} &&
$data >= $alert->{'max_value'});
return $status if ($data >= $alert->{'min_value'} &&
$data <= $alert->{'max_value'});
if ($alert->{'matches_value'} == 1) {
return $status if ($data <= $alert->{'min_value'} &&
$data >= $alert->{'max_value'});
} else {
return $status if ($data >= $alert->{'min_value'} &&
$data <= $alert->{'max_value'});
}
}
return $status if ($alert->{'type'} eq "equal" && $data != $alert->{'value'});
return $status if ($alert->{'type'} eq "not_equal" && $data == $alert->{'value'});
if ($alert->{'type'} eq "regex") {
return $status if ($alert->{'matches_value'} == 1 && $data =~ m/$alert->{'value'}/i);
return $status if ($data !~ m/$alert->{'value'}/i);
if ($alert->{'matches_value'} == 1) {
return $status if ($data !~ m/$alert->{'value'}/i);
} else {
return $status if ($data =~ m/$alert->{'value'}/i);
}
}
return $status if ($last_status != 1 && $alert->{'type'} eq 'critical');