Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Net::SNMP, hrPrinterDetectedErrorStatus

by jvuman (Novice)
on Nov 06, 2017 at 04:07 UTC ( #1202797=perlquestion: print w/replies, xml ) Need Help??

jvuman has asked for the wisdom of the Perl Monks concerning the following question:

When I access the hrPrinterDetectedErrorState OID ( using the Net-SNMP command line tools, I get a string of two hex digits, like "0A 00". This can be interpreted as a bitmask using instructions in the HOST-RESOURCES mib.

However, when I retrieve this value using Net::SNMP, I always get a pair of ASCII space characters. Data::Dumper confirms this.

Example code:

my $oid = ''; my ($snmp,$error) = Net::SNMP->session(...); my $result = $snmp->get_request(-varbindlist => [ $oid ]; print $result->{$oid},"\n";

Am I missing something? I get the same results on ActiveState Perl 5.24 on Windows and Perl 5.16 on Linux. Thank you for any suggestions!

Replies are listed 'Best First'.
Re: Net::SNMP, hrPrinterDetectedErrorStatus
by Corion (Pope) on Nov 06, 2017 at 08:35 UTC

    How far can you trust the output of the Net-SNMP command line tools? Maybe they are just printing the data in hexdump format because the SNMP OID isn't known a string, or the data doesn't look like a string?

    Without knowing anything about SNMP, it seems that at least from the examples will use the snmp_type_ntop function to convert things to something printable. I don't know if the data you receive already is supposed to be the decoded value or maybe is still in ASN.1 format.

      The "snmpget" binary returns a value consistent with the printer's real observed status.

      Did try snmp_type_ntop, but it did not help. Thanks though!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1202797]
Approved by haukex
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2020-11-30 01:57 GMT
Find Nodes?
    Voting Booth?

    No recent polls found