问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/2433187/is-there-a-simple-way-to-map-snmpmib-strings-to-oids-in-perl