2012-09-17 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Added support for inverse intervals when calculating
	  the status of a module.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6978 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
ramonn 2012-09-17 15:05:48 +00:00
parent fdb73fb29f
commit b28bd1f49d
2 changed files with 38 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2012-09-17 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Added support for inverse intervals when calculating
the status of a module.
2012-09-17 Vanessa Gil <vanessa.gil@artica.es>
* lib/PandoraFMS/ReconServer.pm: Added new fields

View File

@ -2740,22 +2740,47 @@ sub get_module_status ($$$) {
# Critical
if ($critical_min ne $critical_max) {
return 1 if ($data >= $critical_min && $data < $critical_max);
return 1 if ($data >= $critical_min && $critical_max < $critical_min);
# [critical_min, critical_max]
if ($module->{'critical_inverse'} == 0) {
return 1 if ($data >= $critical_min && $data < $critical_max);
return 1 if ($data >= $critical_min && $critical_max < $critical_min);
}
# (-inf, critical_min), (critical_max, +inf)
else {
return 1 if ($data < $critical_min || $data > $critical_max);
}
}
# Warning
if ($warning_min ne $warning_max) {
return 2 if ($data >= $warning_min && $data < $warning_max);
return 2 if ($data >= $warning_min && $warning_max < $warning_min);
# [warning_min, warning_max]
if ($module->{'warning_inverse'} == 0) {
return 2 if ($data >= $warning_min && $data < $warning_max);
return 2 if ($data >= $warning_min && $warning_max < $warning_min);
}
# (-inf, warning_min), (warning_max, +inf)
else {
return 2 if ($data < $warning_min || $data > $warning_max);
}
}
}
# String
else {
# Critical
return 1 if ($critical_str ne '' && $data =~ /$critical_str/);
# Critical
if ($module->{'critical_inverse'} == 0) {
return 1 if ($critical_str ne '' && $data =~ /$critical_str/);
} else {
return 1 if ($critical_str ne '' && $data !~ /$critical_str/);
}
# Warning
return 2 if ($warning_str ne '' && $data =~ /$warning_str/);
# Warning
if ($module->{'warning_inverse'} == 0) {
return 2 if ($warning_str ne '' && $data =~ /$warning_str/);
} else {
return 2 if ($warning_str ne '' && $data !~ /$warning_str/);
}
}
# Normal
return 0;