2013-06-07 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/Core.pm: Return undef from get_agent_from_name if the
	  agent was not found.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8272 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2013-06-07 10:12:16 +00:00
parent 525a12b7e0
commit 5b5e51b0c9
2 changed files with 11 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2013-06-07 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Core.pm: Return undef from get_agent_from_name if the
agent was not found.
2013-06-06 Ramon Novoa <rnovoa@artica.es> 2013-06-06 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/ReconServer.pm: Merged from 4.0 branch. Create agents * lib/PandoraFMS/ReconServer.pm: Merged from 4.0 branch. Create agents

View File

@ -231,10 +231,9 @@ sub get_agent_from_addr ($$) {
sub get_agent_from_name ($$) { sub get_agent_from_name ($$) {
my ($dbh, $name) = @_; my ($dbh, $name) = @_;
return 0 if (! defined ($name) || $name eq ''); return undef if (! defined ($name) || $name eq '');
my $agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', $name); return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', $name);
return $agent;
} }
########################################################################## ##########################################################################
@ -3031,7 +3030,7 @@ sub get_module_status ($$$) {
# Critical # Critical
if ($critical_min ne $critical_max) { if ($critical_min ne $critical_max) {
# [critical_min, critical_max] # [critical_min, critical_max)
if ($module->{'critical_inverse'} == 0) { if ($module->{'critical_inverse'} == 0) {
return 1 if ($data >= $critical_min && $data < $critical_max); return 1 if ($data >= $critical_min && $data < $critical_max);
return 1 if ($data >= $critical_min && $critical_max < $critical_min); return 1 if ($data >= $critical_min && $critical_max < $critical_min);
@ -3039,12 +3038,13 @@ sub get_module_status ($$$) {
# (-inf, critical_min), (critical_max, +inf) # (-inf, critical_min), (critical_max, +inf)
else { else {
return 1 if ($data < $critical_min || $data > $critical_max); return 1 if ($data < $critical_min || $data > $critical_max);
return 1 if ($data <= $critical_max && $critical_max < $critical_min);
} }
} }
# Warning # Warning
if ($warning_min ne $warning_max) { if ($warning_min ne $warning_max) {
# [warning_min, warning_max] # [warning_min, warning_max)
if ($module->{'warning_inverse'} == 0) { if ($module->{'warning_inverse'} == 0) {
return 2 if ($data >= $warning_min && $data < $warning_max); return 2 if ($data >= $warning_min && $data < $warning_max);
return 2 if ($data >= $warning_min && $warning_max < $warning_min); return 2 if ($data >= $warning_min && $warning_max < $warning_min);
@ -3052,6 +3052,7 @@ sub get_module_status ($$$) {
# (-inf, warning_min), (warning_max, +inf) # (-inf, warning_min), (warning_max, +inf)
else { else {
return 2 if ($data < $warning_min || $data > $warning_max); return 2 if ($data < $warning_min || $data > $warning_max);
return 2 if ($data <= $warning_max && $warning_max < $warning_min);
} }
} }
} }