我在perl中执行get_bulk_request时遇到问题,因为它没有完全递增OID的最后部分。 我怀疑这是Arris没有做正确的事情,但是想知道是否有人遇到类似的情况,他们是否有任何解决方案可以解决? 从命令行运行snmpbulkget会正确返回所有OID,这是我希望在perl脚本中完成的。
use Net::SNMP;
use Net::SNMP::Util;
my @testoid = ( 1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2 );
my ($snmp, $error) = Net::SNMP->session(
-hostname => "$host",
-community => "$Community",
-timeout => 60,
-nonblocking => 1,
-debug => 0,
-maxmsgsize => 65535,
-version => 'snmpv2c'
);
if (!defined $snmp) {
print STDERR "ERROR: %s.\n", $error;
exit 1;
}
my $ret = $snmp->get_bulk_request(
-callback => [\& table_cb, {}],
-maxrepetitions => 10,
-varbindlist => [@testoid]
);
sub table_cb {
my $everything = shift;
print Dumper($everything);
}
Print Dumper $ everything返回以下内容并且不会从.10008跳转到.10101所以我错过了arrisRouterWPAPreSharedKey.10101和arrisRouterWPAPreSharedKey.10102
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10001' => 'TopSecret',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10002' => 'BPP8EX50',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10003' => 'BPP8EX50',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10004' => 'BPP8EX50',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10005' => 'BPP8EX50',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10006’ => 'BPP8EX50',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10007' => 'BPP8EX50',
'1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2.10008’ => 'BPP8EX50',
从同一个框中的命令行运行snmpbulkget,我返回我正在寻找的所有OID。
snmpbulkget -v2c -mall -cpublic x.x.x.x 1.3.6.1.4.1.4115.1.20.1.1.3.26.1.2
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10001 = STRING: “TopSecret”
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10002 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10003 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10004 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10005 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10006 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10007 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10008 = STRING: "BPP8EX50"
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10101 = STRING: “SuperTopSecret”
ARRIS-ROUTER-DEVICE-MIB::arrisRouterWPAPreSharedKey.10102 = STRING: "BPP8EX50"