2010-11-19 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Fixed regexp alerts. The patch to detect malformed regular expressions made them malfunction. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3603 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
fb18038db6
commit
5731f640f8
|
@ -1,3 +1,8 @@
|
||||||
|
2010-11-19 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
|
* lib/PandoraFMS/Core.pm: Fixed regexp alerts. The patch to detect
|
||||||
|
malformed regular expressions made them malfunction.
|
||||||
|
|
||||||
2010-11-18 Ramon Novoa <rnovoa@artica.es>
|
2010-11-18 Ramon Novoa <rnovoa@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/Core.pm,
|
* lib/PandoraFMS/Core.pm,
|
||||||
|
|
|
@ -298,16 +298,21 @@ sub pandora_evaluate_alert ($$$$$$$) {
|
||||||
return $status if ($alert->{'type'} eq "equal" && $data != $alert->{'value'});
|
return $status if ($alert->{'type'} eq "equal" && $data != $alert->{'value'});
|
||||||
return $status if ($alert->{'type'} eq "not_equal" && $data == $alert->{'value'});
|
return $status if ($alert->{'type'} eq "not_equal" && $data == $alert->{'value'});
|
||||||
if ($alert->{'type'} eq "regex") {
|
if ($alert->{'type'} eq "regex") {
|
||||||
|
|
||||||
|
# Make sure the regexp is valid
|
||||||
eval {
|
eval {
|
||||||
local $SIG{'__DIE__'};
|
local $SIG{'__DIE__'};
|
||||||
if ($alert->{'matches_value'} == 1) {
|
$data =~ m/$alert->{'value'}/i;
|
||||||
return $status if ($data !~ m/$alert->{'value'}/i);
|
|
||||||
} else {
|
|
||||||
return $status if ($data =~ m/$alert->{'value'}/i);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
logger ($pa_config, "Error evaluating alert '" . $alert->{'name'} . "' for agent '" . $agent->{'nombre'} . "': '" . $alert->{'value'} . "' is not a valid regular expression.", 10);
|
logger ($pa_config, "Error evaluating alert '" . $alert->{'name'} . "' for agent '" . $agent->{'nombre'} . "': '" . $alert->{'value'} . "' is not a valid regular expression.", 10);
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($alert->{'matches_value'} == 1) {
|
||||||
|
return $status if ($data !~ m/$alert->{'value'}/i);
|
||||||
|
} else {
|
||||||
|
return $status if ($data =~ m/$alert->{'value'}/i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue