Skip Menu |

This queue is for tickets about the Net-SNMP CPAN distribution.

Report information
The Basics
Id: 41295
Status: resolved
Worked: 16 min
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: KMichaels [...] atlanticbb.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Net:SNMP not pulling one particualr OID
Date: Fri, 28 Nov 2008 10:39:20 -0500
To: <bug-Net-SNMP [...] rt.cpan.org>
From: "Michaels, Kevin" <KMichaels [...] atlanticbb.com>
Could someone please give me some assistance with one particular OID I can't seem to query: I am using the Net::SNMP module to pull values of cable modem and logging the results to a database. One of the OID's I am trying to pull are not giving me any results, and I can't see why. The OID is .1.3.6.1.4.1.1166.1.200.4.3.0 Snmpget works for that OID: #snmpget -v2c -c aaaaaaaa xx.xx.xx.xx .1.3.6.1.4.1.1166.1.200.4.3.0 SNMPv2-SMI::enterprises.1166.1.200.4.3.0 = INTEGER: 1 Here is an example of the script I am running: #! /usr/local/bin/perl use Net::SNMP; $numberbat =".1.3.6.1.4.1.1166.1.200.12.1.7.0"; $ac = ".1.3.6.1.4.1.1166.1.200.4.3.0"; ($session, $error) = Net::SNMP->session( -hostname => shift || "xx.xx.xx.xx", -community => shift || 'xxxxxxx', -version => shift || '2', -timeout => shift || 1); $result = $session->get_request($ac); $AcPowerStatus = $result->{$ac}; $result = $session->get_request($numberbat); $NumberofBatteries = $result->{$numberbat}; print "AC Power Status $AcPowerStatus "; print "\nNumber of Batteries $NumberofBatteries "; Which gives me this output: AC Power Status Number of Batteries 1 Any help that I can get to figure this out would be great. Thanks in advance. Kevin L. Michaels
There is no obvious error that I can see in your usage of the Net::SNMP module. Can you enable debugging by adding the argument "-debug => 0xff" to the session() constructor and send me the output produced by running the script in question? On Fri Nov 28 10:39:45 2008, KMichaels@atlanticbb.com wrote: Show quoted text
> Could someone please give me some assistance with one particular OID I > can't seem to query: > > > > > > > > I am using the Net::SNMP module to pull values of cable modem and > logging the results to a database. > > > > One of the OID's I am trying to pull are not giving me any results, and > I can't see why. > > > > The OID is .1.3.6.1.4.1.1166.1.200.4.3.0 > > > > Snmpget works for that OID: > > > > #snmpget -v2c -c aaaaaaaa xx.xx.xx.xx .1.3.6.1.4.1.1166.1.200.4.3.0 > > SNMPv2-SMI::enterprises.1166.1.200.4.3.0 = INTEGER: 1 > > > > Here is an example of the script I am running: > > > > > > #! /usr/local/bin/perl > > > > use Net::SNMP; > > > > $numberbat =".1.3.6.1.4.1.1166.1.200.12.1.7.0"; > > $ac = ".1.3.6.1.4.1.1166.1.200.4.3.0"; > > > > ($session, $error) = Net::SNMP->session( > > -hostname => shift || "xx.xx.xx.xx", > > -community => shift || 'xxxxxxx', > > -version => shift || '2', > > -timeout => shift || 1); > > > > $result = $session->get_request($ac); > > $AcPowerStatus = $result->{$ac}; > > > > $result = $session->get_request($numberbat); > > $NumberofBatteries = $result->{$numberbat}; > > > > print "AC Power Status $AcPowerStatus "; > > print "\nNumber of Batteries $NumberofBatteries "; > > > > > > Which gives me this output: > > > > AC Power Status > > Number of Batteries 1 > > > > Any help that I can get to figure this out would be great. > > > > Thanks in advance. > > > > Kevin L. Michaels > > >
Subject: RE: [rt.cpan.org #41295] Net:SNMP not pulling one particualr OID
Date: Mon, 1 Dec 2008 08:46:16 -0500
To: <bug-Net-SNMP [...] rt.cpan.org>
From: "Michaels, Kevin" <KMichaels [...] atlanticbb.com>
Here is the requested output. debug: [627] Net::SNMP::Transport::_new(): opened UDP/IPv4 socket [3] debug: [968] Net::SNMP::Message::_prepare_object_identifier(): leading dot present debug: [448] Net::SNMP::Dispatcher::_event_insert(): created new head and tail [ARRAY(0x473af0)] debug: [593] Net::SNMP::Dispatcher::_event_handle(): event [ARRAY(0x473af0)], poll delay = 0.000000 debug: [646] Net::SNMP::Message::send(): transport address 10.144.121.51:161 debug: [1896] Net::SNMP::Message::_buffer_dump(): 51 bytes [0000] 30 31 02 01 01 04 0B 63 68 61 72 74 65 72 39 33 01.....charter93 [0016] 70 61 A0 1F 02 02 22 7A 02 01 00 02 01 00 30 13 pa...."z......0. [0032] 30 11 06 0D 2B 06 01 04 01 89 0E 01 81 48 04 03 0...+........H.. [0048] 00 05 00 ... debug: [202] Net::SNMP::Dispatcher::register(): adding descriptor [3] debug: [471] Net::SNMP::Dispatcher::_event_insert(): modified tail [ARRAY(0x473dfc)] debug: [542] Net::SNMP::Dispatcher::_event_delete(): deleted [ARRAY(0x473af0)], defined new head [ARRAY(0x473dfc)] debug: [593] Net::SNMP::Dispatcher::_event_handle(): event [ARRAY(0x473dfc)], poll delay = 0.999402 debug: [645] Net::SNMP::Dispatcher::_event_select(): descriptor [3] ready for read debug: [670] Net::SNMP::Message::recv(): transport address 10.144.121.51:161 debug: [1896] Net::SNMP::Message::_buffer_dump(): 52 bytes [0000] 30 32 02 01 01 04 0B 63 68 61 72 74 65 72 39 33 02.....charter93 [0016] 70 61 A2 20 02 02 22 7A 02 01 00 02 01 01 30 14 pa. .."z......0. [0032] 30 12 06 0D 2B 06 01 04 01 89 0E 01 81 48 04 03 0...+........H.. [0048] 00 02 01 01 .... error: [869] Net::SNMP::PDU::_process_pdu_sequence(): Received noError(0) error-status at error-index 1 error: [268] Net::SNMP::MessageProcessing::prepare_data_elements(): Received noError(0) error-status at error-index 1 error: [407] Net::SNMP::Dispatcher::_transport_response_received(): Received noError(0) error-status at error-index 1 debug: [524] Net::SNMP::Dispatcher::_event_delete(): deleted [ARRAY(0x473dfc)], list is now empty debug: [241] Net::SNMP::Dispatcher::deregister(): removing descriptor [3] error: [2304] Net::SNMP::__ANON__(): Received noError(0) error-status at error-index 1 debug: [968] Net::SNMP::Message::_prepare_object_identifier(): leading dot present debug: [448] Net::SNMP::Dispatcher::_event_insert(): created new head and tail [ARRAY(0x473940)] debug: [593] Net::SNMP::Dispatcher::_event_handle(): event [ARRAY(0x473940)], poll delay = 0.000000 debug: [646] Net::SNMP::Message::send(): transport address 10.144.121.51:161 debug: [1896] Net::SNMP::Message::_buffer_dump(): 52 bytes [0000] 30 32 02 01 01 04 0B 63 68 61 72 74 65 72 39 33 02.....charter93 [0016] 70 61 A0 20 02 02 22 7B 02 01 00 02 01 00 30 14 pa. .."{......0. [0032] 30 12 06 0E 2B 06 01 04 01 89 0E 01 81 48 0C 01 0...+........H.. [0048] 07 00 05 00 .... debug: [202] Net::SNMP::Dispatcher::register(): adding descriptor [3] debug: [471] Net::SNMP::Dispatcher::_event_insert(): modified tail [ARRAY(0x473e2c)] debug: [542] Net::SNMP::Dispatcher::_event_delete(): deleted [ARRAY(0x473940)], defined new head [ARRAY(0x473e2c)] debug: [593] Net::SNMP::Dispatcher::_event_handle(): event [ARRAY(0x473e2c)], poll delay = 0.999516 debug: [645] Net::SNMP::Dispatcher::_event_select(): descriptor [3] ready for read debug: [670] Net::SNMP::Message::recv(): transport address 10.144.121.51:161 debug: [1896] Net::SNMP::Message::_buffer_dump(): 53 bytes [0000] 30 33 02 01 01 04 0B 63 68 61 72 74 65 72 39 33 03.....charter93 [0016] 70 61 A2 21 02 02 22 7B 02 01 00 02 01 00 30 15 pa.!.."{......0. [0032] 30 13 06 0E 2B 06 01 04 01 89 0E 01 81 48 0C 01 0...+........H.. [0048] 07 00 02 01 01 ..... debug: [1440] Net::SNMP::Message::_process_object_identifier(): adding leading dot debug: [953] Net::SNMP::PDU::_process_var_bind_list(): { .1.3.6.1.4.1.1166.1.200.12.1.7.0 => INTEGER: 1 } debug: [524] Net::SNMP::Dispatcher::_event_delete(): deleted [ARRAY(0x473e2c)], list is now empty debug: [241] Net::SNMP::Dispatcher::deregister(): removing descriptor [3] AC Power Status Number of Batteries 1 Show quoted text
-----Original Message----- From: David M. Town via RT [mailto:bug-Net-SNMP@rt.cpan.org] Sent: Saturday, November 29, 2008 8:50 AM To: Michaels, Kevin Subject: [rt.cpan.org #41295] Net:SNMP not pulling one particualr OID <URL: http://rt.cpan.org/Ticket/Display.html?id=41295 > There is no obvious error that I can see in your usage of the Net::SNMP module. Can you enable debugging by adding the argument "-debug => 0xff" to the session() constructor and send me the output produced by running the script in question? On Fri Nov 28 10:39:45 2008, KMichaels@atlanticbb.com wrote:
> Could someone please give me some assistance with one particular OID I > can't seem to query: > > > > > > > > I am using the Net::SNMP module to pull values of cable modem and > logging the results to a database. > > > > One of the OID's I am trying to pull are not giving me any results,
and
> I can't see why. > > > > The OID is .1.3.6.1.4.1.1166.1.200.4.3.0 > > > > Snmpget works for that OID: > > > > #snmpget -v2c -c aaaaaaaa xx.xx.xx.xx .1.3.6.1.4.1.1166.1.200.4.3.0 > > SNMPv2-SMI::enterprises.1166.1.200.4.3.0 = INTEGER: 1 > > > > Here is an example of the script I am running: > > > > > > #! /usr/local/bin/perl > > > > use Net::SNMP; > > > > $numberbat =".1.3.6.1.4.1.1166.1.200.12.1.7.0"; > > $ac = ".1.3.6.1.4.1.1166.1.200.4.3.0"; > > > > ($session, $error) = Net::SNMP->session( > > -hostname => shift || "xx.xx.xx.xx", > > -community => shift || 'xxxxxxx', > > -version => shift || '2', > > -timeout => shift || 1); > > > > $result = $session->get_request($ac); > > $AcPowerStatus = $result->{$ac}; > > > > $result = $session->get_request($numberbat); > > $NumberofBatteries = $result->{$numberbat}; > > > > print "AC Power Status $AcPowerStatus "; > > print "\nNumber of Batteries $NumberofBatteries "; > > > > > > Which gives me this output: > > > > AC Power Status > > Number of Batteries 1 > > > > Any help that I can get to figure this out would be great. > > > > Thanks in advance. > > > > Kevin L. Michaels > > >
Kevin, The device you are polling is incorrectly setting the "error-index" field to 1 in the Response-PDU. This should be set to 0 if there has not been an error. The Net::SNMP module is also being too strict. According to RFC 3414 a non-zero error-index should be ignored if the error-status is noError(0). I have a pending change to this effect for an upcoming release. You can manually edit your existing Net::SNMP installation to relax this check by editing the PDU.pm file (most likely in the "lib/site_perl/<version>/Net/SNMP" directory). Remove the check for "|| ($this->{_error_index})" (line 869 in Net::SNMP v5.2.0). Is this a Motorola modem? This was previously reported. -David On Mon Dec 01 08:47:34 2008, KMichaels@atlanticbb.com wrote: Show quoted text
> Here is the requested output. > > debug: [1896] Net::SNMP::Message::_buffer_dump(): 52 bytes > [0000] 30 32 02 01 01 04 0B 63 68 61 72 74 65 72 39 33 > 02.....charter93 > [0016] 70 61 A2 20 02 02 22 7A 02 01 00 02 01 01 30 14 pa. > .."z......0. > [0032] 30 12 06 0D 2B 06 01 04 01 89 0E 01 81 48 04 03 > 0...+........H.. > [0048] 00 02 01 01 .... > error: [869] Net::SNMP::PDU::_process_pdu_sequence(): Received > noError(0) error-status at error-index 1 > error: [268] Net::SNMP::MessageProcessing::prepare_data_elements(): > Received noError(0) error-status at error-index 1 > error: [407] Net::SNMP::Dispatcher::_transport_response_received(): > Received noError(0) error-status at error-index 1 > debug: [524] Net::SNMP::Dispatcher::_event_delete(): deleted > [ARRAY(0x473dfc)], list is now empty
Subject: RE: [rt.cpan.org #41295] Net:SNMP not pulling one particualr OID
Date: Mon, 1 Dec 2008 11:25:17 -0500
To: <bug-Net-SNMP [...] rt.cpan.org>
From: "Michaels, Kevin" <KMichaels [...] atlanticbb.com>
David, That did the trick. I removed the "|| ($this->{_error_index})" check out of PDU.pm. I hate to have to relax error checking, but I guess it is easier to change that then have Motorola change their modems, plus even if they do change the modems you would have to flash the firmware on every modem. Thank you very much for you help and for an awesome module. :) Kevin Michaels Show quoted text
-----Original Message----- From: David M. Town via RT [mailto:bug-Net-SNMP@rt.cpan.org] Sent: Monday, December 01, 2008 10:40 AM To: Michaels, Kevin Subject: [rt.cpan.org #41295] Net:SNMP not pulling one particualr OID <URL: http://rt.cpan.org/Ticket/Display.html?id=41295 > Kevin, The device you are polling is incorrectly setting the "error-index" field to 1 in the Response-PDU. This should be set to 0 if there has not been an error. The Net::SNMP module is also being too strict. According to RFC 3414 a non-zero error-index should be ignored if the error-status is noError(0). I have a pending change to this effect for an upcoming release. You can manually edit your existing Net::SNMP installation to relax this check by editing the PDU.pm file (most likely in the "lib/site_perl/<version>/Net/SNMP" directory). Remove the check for "|| ($this->{_error_index})" (line 869 in Net::SNMP v5.2.0). Is this a Motorola modem? This was previously reported. -David On Mon Dec 01 08:47:34 2008, KMichaels@atlanticbb.com wrote:
> Here is the requested output. > > debug: [1896] Net::SNMP::Message::_buffer_dump(): 52 bytes > [0000] 30 32 02 01 01 04 0B 63 68 61 72 74 65 72 39 33 > 02.....charter93 > [0016] 70 61 A2 20 02 02 22 7A 02 01 00 02 01 01 30 14 pa. > .."z......0. > [0032] 30 12 06 0D 2B 06 01 04 01 89 0E 01 81 48 04 03 > 0...+........H.. > [0048] 00 02 01 01 .... > error: [869] Net::SNMP::PDU::_process_pdu_sequence(): Received > noError(0) error-status at error-index 1 > error: [268] Net::SNMP::MessageProcessing::prepare_data_elements(): > Received noError(0) error-status at error-index 1 > error: [407] Net::SNMP::Dispatcher::_transport_response_received(): > Received noError(0) error-status at error-index 1 > debug: [524] Net::SNMP::Dispatcher::_event_delete(): deleted > [ARRAY(0x473dfc)], list is now empty
The relaxing of the check is in compliance with RFC 3414, so I do not have a problem with it. Closing ticket. -David