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:
parent
e8e4f65153
commit
53e25643a2
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue