mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
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:
parent
7e359ad331
commit
5ad3d10529
@ -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.
|
||||||
|
|
||||||
|
|
@ -268,7 +268,24 @@ sub pandora_query_snmp {
|
|||||||
logger($pa_config, "SNMP ERROR SESSION", 4);
|
logger($pa_config, "SNMP ERROR SESSION", 4);
|
||||||
$_[4]="1";
|
$_[4]="1";
|
||||||
} else {
|
} 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
|
# Pass the VarList to getnext building an array of the output
|
||||||
my @OIDINFO = $SESSION->getnext($OIDLIST);
|
my @OIDINFO = $SESSION->getnext($OIDLIST);
|
||||||
$output = $OIDINFO[0];
|
$output = $OIDINFO[0];
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
|||||||
1 52
|
|
@ -1 +0,0 @@
|
|||||||
10107
|
|
@ -1 +0,0 @@
|
|||||||
12938
|
|
@ -1 +0,0 @@
|
|||||||
7748
|
|
@ -1 +0,0 @@
|
|||||||
7734
|
|
Loading…
x
Reference in New Issue
Block a user