tags:

views:

293

answers:

1

Is there a simple way/module to map snmp(MIB) strings to OIDs in Perl?

E.g. I start with "sysUpTime.0" and get "1.3.6.1.2.1.1.3.0". As far as I can see, Net::SNMP expects you to have them already mapped.

+5  A: 

You can use NetSNMP::OID to do the conversion.

use NetSNMP::OID;

my $oid = NetSNMP::OID->new('sysUpTime.0');

NetSNMP::OID is part of the Net-SNMP project, not to be confused with the Net::SNMP module.

daotoad
NetSNMP::OID doesn't compile for me, and at least for ubuntu I can't find a package.
Sec
@Sec: you can install directly from CPAN; there are posts about this on SO with more information if you have questions about this process.
Ether
I _was_ using "perl -MCPAN -e 'install NetSNMP::OID'".
Sec
Try downloading Net-SNMP from sourceforge and using it. Worked like a charm for me with Ubuntu 8.4.
daotoad