2006-09-13 Sancho Lerena <slerena@artica.es>

* pandora_network.pl: Fixed problems with OID index. Perl needs to
	referente a .0 index, like SNMPv2-MIB::sysDescr.0 as
	SNMPv2-MIB::sysDescr. Also, other numerical indexes are referenced
	different from system SNMP or PHP. IF-MIB::ifDescr.3 is
	IF-MIB::ifDescr.2 for PERL's SNMP.
	


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@167 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2006-09-13 11:32:46 +00:00
parent 8ead28b95d
commit 0e67af2469
9 changed files with 162764 additions and 6 deletions

View File

@ -0,0 +1,9 @@
2006-09-13 Sancho Lerena <slerena@artica.es>
* pandora_network.pl: Fixed problems with OID index. Perl needs to
referente a .0 index, like SNMPv2-MIB::sysDescr.0 as
SNMPv2-MIB::sysDescr. Also, other numerical indexes are referenced
different from system SNMP or PHP. IF-MIB::ifDescr.3 is
IF-MIB::ifDescr.2 for PERL's SNMP.

View File

@ -268,7 +268,24 @@ sub pandora_query_snmp {
logger($pa_config, "SNMP ERROR SESSION", 4);
$_[4]="1";
} else {
my $OIDLIST = new SNMP::VarList([$snmp_oid]);
# Perl uses different OID syntax than SNMPWALK or PHP's SNMP
# for example:
# SNMPv2-MIB::sysDescr for PERL SNMP
# is equivalent to SNMPv2-MIB::sysDescr.0 in SNMP and PHP/SNMP
# So we parse last byte and cut off if = 0 and delete 1 if != 0
my $perl_oid = $snmp_oid;
if ($perl_oid =~ m/(.*)\.([0-9]*)\z/){
my $local_oid = $1;
my $local_oid_idx = $2;
if ($local_oid_idx == 0){
$perl_oid = $local_oid; # Strip .0 from orig. OID
} else {
$local_oid_idx--;
$perl_oid = $local_oid.".".$local_oid_idx;
}
}
my $OIDLIST = new SNMP::VarList([$perl_oid]);
# Pass the VarList to getnext building an array of the output
my @OIDINFO = $SESSION->getnext($OIDLIST);
$output = $OIDINFO[0];

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
1 52

View File

@ -1 +0,0 @@
10107

View File

@ -1 +0,0 @@
12938

View File

@ -1 +0,0 @@
7748

View File

@ -1 +0,0 @@
7734