2013-01-09 Sancho Lerena <slerena@artica.es>

* lib/PandoraFMS/NetworkServer.pm: Fixed bug #3555223 about
        different UDP ports for SNMP polling. Merged fix from 4.0.x 
        branch. 



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7390 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2013-01-09 11:43:56 +00:00
parent b872a94ad9
commit 6e25b117e7
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2013-01-09 Sancho Lerena <slerena@artica.es>
* lib/PandoraFMS/NetworkServer.pm: Fixed bug #3555223 about
different UDP ports for SNMP polling. Merged fix from 4.0.x
branch.
2013-01-09 Hirofumi Kosaka <kosaka@rworks.jp>
* lib/PandoraFMS/SNMPServer.pm: Made sure SNMP filter is valid

View File

@ -266,9 +266,9 @@ next_pair:
# Set commands for SNMP checks depending on OS type
###############################################################################
sub pandora_snmp_get_command ($$$$$$$$$) {
sub pandora_snmp_get_command ($$$$$$$$$$) {
my ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra) = @_;
my ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra, $snmp_port) = @_;
my $output = "";
@ -281,6 +281,10 @@ sub pandora_snmp_get_command ($$$$$$$$$) {
$snmp_version = "2c";
}
if (defined($snmp_port) && ($snmp_port != "161") && ($snmp_port != "") && ($snmp_port != " ")){
$snmp_target = $snmp_target.":".$snmp_port;
}
# On windows, we need the snmpget command from net-snmp, already present on win agent
# the call is the same than in linux
if (($OSNAME eq "MSWin32") || ($OSNAME eq "MSWin32-x64") || ($OSNAME eq "cygwin")){
@ -328,6 +332,8 @@ sub pandora_query_snmp ($$$) {
my $snmp_community = $module->{"snmp_community"};
my $snmp_target = $module->{"ip_target"};
my $snmp_oid = $module->{"snmp_oid"};
my $snmp_port = $module->{"tcp_port"};
return (undef, 0) unless ($snmp_oid ne '');
if ($snmp_oid =~ m/[a-zA-Z]/) {
$snmp_oid = translate_obj ($dbh, $snmp_oid, );
@ -360,7 +366,7 @@ 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, "", "");
$output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, "", "", $snmp_port);
if (defined ($output) && $output ne ""){
$module_result = 0;
$module_data = $output;
@ -382,7 +388,7 @@ 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 ";
}
$output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra);
$output = pandora_snmp_get_command ($snmpget_cmd, $snmp_version, $snmp_retries, $snmp_timeout, $snmp_community, $snmp_target, $snmp_oid, $snmp3_security_level, $snmp3_extra, $snmp_port);
if (defined ($output) && $output ne ""){
$module_result = 0;
$module_data = $output;