diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index fd0a7508aa..563dce0233 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-08-18 Ramon Novoa + + * lib/PandoraFMS/NetworkServer.pm, + lib/PandoraFMS/Core.pm: Fixed some warnings on undefined values. + 2011-08-17 Sancho Lerena * SNMPServer.pm: Custom value and custom type are not used anymore. diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index a8bde6d78e..6afadb6460 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -166,7 +166,7 @@ our @EXPORT = qw( pandora_server_statistics pandora_self_monitoring pandora_process_policy_queue - get_agent_from_addr + get_agent_from_addr @ServerTypes ); @@ -2433,8 +2433,11 @@ sub pandora_self_monitoring ($$) { $xml_output .=" "; my $load_average = load_average(); - my $free_mem = free_mem();; + $load_average = '' unless defined ($load_average); + my $free_mem = free_mem(); + $free_mem = '' unless defined ($load_average); my $free_disk_spool = disk_free ($pa_config->{"incomingdir"}); + $free_disk_spool = '' unless defined ($free_disk_spool); my $my_data_server = get_db_value ($dbh, "SELECT id_server FROM tserver WHERE server_type = 0 AND name = '".$pa_config->{"servername"}."'"); # Number of unknown agents diff --git a/pandora_server/lib/PandoraFMS/NetworkServer.pm b/pandora_server/lib/PandoraFMS/NetworkServer.pm index bcf5b67b09..1976143c48 100644 --- a/pandora_server/lib/PandoraFMS/NetworkServer.pm +++ b/pandora_server/lib/PandoraFMS/NetworkServer.pm @@ -329,9 +329,8 @@ sub pandora_query_snmp ($$$) { # SNMP v1, v2 and v2c call if ($snmp_version ne '3'){ - $output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, "", ""); - - if ($output ne ""){ + $output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, "", ""); + if (defined ($output) && $output ne ""){ $module_result = 0; $module_data = $output; } @@ -352,10 +351,9 @@ sub pandora_query_snmp ($$$) { $snmp3_extra = " -a $snmp3_auth_method -u $snmp3_auth_user -A $snmp3_auth_pass -x $snmp3_privacy_method -X $snmp3_privacy_pass "; } - $snmp3_execution = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra); - + $snmp3_execution = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra); $output = `$snmp3_execution`; - if ($output ne ""){ + if (defined ($output) && $output ne ""){ $module_result = 0; $module_data = $output; }