Hi anyone:
I'm using the sample program (mibwalk.pl) provided as part of Net-SNMP
to experiment in getting the returned data delivered in the format
I need to see.
My version of it is below. I found 'UseNumeric' to get the
OIDs returned as numbers, but I need to get enums returned as
INTEGERS and not decoded. It seems that I can disable 'use_sprint_value'
to disable _all_ pretty printing, but I just want enums as raw,
not everything.
I thought UseEnums would do the trick, but it doesn't,
or at least I don't understand what its supposed to do.
For example, it currently returns the following for 'ifType' on my system:
.1.3.6.1.2.1.2.2.1.3.1 = softwareLoopback
but what I need is:
.1.3.6.1.2.1.2.2.1.3.1 = 24
What am I doing wrong?
TIA
Fulko
use SNMP 1.8;
my $host = shift || localhost;
my $comm = shift || public;
$SNMP::use_sprint_value = 1;
$sess = new SNMP::Session(DestHost => $host, Community => $comm, Version =>
1);
$sess->{UseNumeric} = 1; # returned OIDs are numeric only
$sess->{UseEnums} = 0; # see if we can get enums shown as INTs
$var = new SNMP::Varbind([]);
do {
$val = $sess->getnext($var);
print "$var->[$SNMP::Varbind::tag_f].$var->[$SNMP::Varbind::iid_f] = ",
"$var->[$SNMP::Varbind::val_f]\n";
} until ($sess->{ErrorStr});
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users