2010-10-25 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Fixed a bug that made the server crash when
	  trying to match an alert with an invalid regular expression.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3463 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2010-10-25 17:29:11 +00:00
parent e8e4f65153
commit 53e25643a2
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2010-10-25 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Fixed a bug that made the server crash when
trying to match an alert with an invalid regular expression.
2010-10-25 Sergio Martin <sergio.martin@artica.es>
* util/pandora_manage.pl: Change a Warning notice to

View File

@ -294,10 +294,16 @@ sub pandora_evaluate_alert ($$$$$$$) {
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") {
if ($alert->{'matches_value'} == 1) {
return $status if ($data !~ m/$alert->{'value'}/i);
} else {
return $status if ($data =~ m/$alert->{'value'}/i);
eval {
local $SIG{'__DIE__'};
if ($alert->{'matches_value'} == 1) {
return $status if ($data !~ m/$alert->{'value'}/i);
} else {
return $status if ($data =~ m/$alert->{'value'}/i);
}
};
if ($@) {
logger ($pa_config, "Error evaluating alert '" . $alert->{'name'} . "' for agent '" . $agent->{'nombre'} . "': '" . $alert->{'value'} . "' is not a valid regular expression.", 10);
}
}