2013-01-09 Dario Rodriguez <dario.rodriguez@artica.es>

* lib/PandoraFMS/NetworkServer.pm: Controlled an error if output of
	SNMP command is empty and fixed several error comparing port of SNMP
	as numbers instead as strings.

	MERGED FROM 4.0.3



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7402 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
darode 2013-01-09 14:35:21 +00:00
parent b23c5ea50a
commit 328c3167ef
2 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2013-01-09 Dario Rodriguez <dario.rodriguez@artica.es>
* lib/PandoraFMS/NetworkServer.pm: Controlled an error if output of
SNMP command is empty and fixed several error comparing port of SNMP
as numbers instead as strings.
MERGED FROM 4.0.3
2013-01-09 Sancho Lerena <slerena@artica.es>
* lib/PandoraFMS/NetworkServer.pm: Fixed on port 0 (Snmp polling).

View File

@ -281,7 +281,7 @@ sub pandora_snmp_get_command ($$$$$$$$$$) {
$snmp_version = "2c";
}
if (defined($snmp_port) && ($snmp_port != "161") && ($snmp_port != "") && ($snmp_port != " ") && ($snmp_port != "0")){
if (defined($snmp_port) && ($snmp_port ne "161") && ($snmp_port ne "") && ($snmp_port ne " ") && ($snmp_port ne "0")){
$snmp_target = $snmp_target.":".$snmp_port;
}
@ -304,12 +304,19 @@ sub pandora_snmp_get_command ($$$$$$$$$$) {
}
}
# Remove starting & ending double quotes, to easily parse numeric data on String types
if ($output =~ /^\"(.*)\"$/){
return $1;
}
else {
return $output;
# Check if output was defined because if the snmpget fails this variable will be undef
if (defined ($output)) {
if ($output =~ /^\"(.*)\"$/){
return $1;
}
else {
return $output;
}
} else {
return "";
}
}