From 044748c8b1f3745beb9b39709f60e9ee33fc35f2 Mon Sep 17 00:00:00 2001 From: ramonn Date: Fri, 7 Jun 2013 10:12:16 +0000 Subject: [PATCH] 2013-06-07 Ramon Novoa * 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 --- pandora_server/ChangeLog | 5 +++++ pandora_server/lib/PandoraFMS/Core.pm | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 6305aaa67f..1a240991f1 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2013-06-07 Ramon Novoa + + * lib/PandoraFMS/Core.pm: Return undef from get_agent_from_name if the + agent was not found. + 2013-06-06 Ramon Novoa * lib/PandoraFMS/ReconServer.pm: Merged from 4.0 branch. Create agents diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index 647bb008f1..7a590007b6 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -231,10 +231,9 @@ sub get_agent_from_addr ($$) { sub get_agent_from_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 $agent; + return get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE tagente.nombre = ?', $name); } ########################################################################## @@ -3031,7 +3030,7 @@ sub get_module_status ($$$) { # Critical if ($critical_min ne $critical_max) { - # [critical_min, critical_max] + # [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); @@ -3039,12 +3038,13 @@ sub get_module_status ($$$) { # (-inf, critical_min), (critical_max, +inf) else { return 1 if ($data < $critical_min || $data > $critical_max); + return 1 if ($data <= $critical_max && $critical_max < $critical_min); } } # Warning if ($warning_min ne $warning_max) { - # [warning_min, warning_max] + # [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); @@ -3052,6 +3052,7 @@ sub get_module_status ($$$) { # (-inf, warning_min), (warning_max, +inf) else { return 2 if ($data < $warning_min || $data > $warning_max); + return 2 if ($data <= $warning_max && $warning_max < $warning_min); } } }