Again: this is _not_ referring to the "Net::SNMP" module
(http://search.cpan.org/~dtown/Net-SNMP-5.2.0/lib/Net/SNMP.pm)
but to Net-SNMP (the corresponding Perl module is just "SNMP")
(http://net-snmp.sourceforge.net/docs/perl-SNMP-README.html)
(The similar names certainly cause lots of confusion ...)
With "Net::SNMP", it works to retrieve the value in question,
but it has some other issues, so I am trying to get "SNMP" to
work ...
Peter
Rob Dixon wrote:
Peter Daum wrote:
I am trying to retrieve a bit vector containing the error status of
a printer with the Net-SNMP module.
With the command line snmpget program, this works:
# snmpget -v1 -cpublic printer .1.3.6.1.2.1.25.3.5.1.2.1
HOST-RESOURCES-MIB::hrPrinterDetectedErrorState.1 = Hex-STRING: 00
With the Net::SNMP module, I can also retrieve the value;
When I do the same with Net-SNMP, I always get an empty string,
regardless of the actual value:
my $session = new SNMP::Session(
DestHost => $host, Version => 1, Community => 'public');
my $result = $session->get($oid));
Other attributes with "normal" string values are no problem.
Is there anything special I have to do to retrieve binary values?
Your code bears little relation to the documentation of Net::SNMP.
First of all there is no 'DestHost' parameter to the the session method, and I
think you should be calling
my $session = new SNMP::Session(-hostname => $host);
(The version and community default to SNMPv1 and public, respectively)
Also there is no get method and I am surprised your code runs. Perhaps you
should write
my $result = $session->get(-varbindlist => [$oid]);
but I have no way of testing this code.
HTH,
Rob
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/