Net::SNMP::Util::OID - OID mapper functions for Net::SNMP::Util
# load system and interfaces MIB map use Net::SNMP::Util::OID qw(sys* if*); printf "OID of sysDescr is %s\n", oid("sysDescr"); # "1.3.6.1.2.1.1.1" printf "1.3.6.1.2.1.2.2.1.3 specifys %s\n", oidt("1.3.6.1.2.1.2.2.1.3"); # ifType printf "OID of MIB %s is %s\n", oidm("ifName"); # "ifName", "1.3.6.1.2.1.31.1.1.1.1" oid_load("someMib1" => "1.3.6.1.4.1.99999.1.2.3", "someMib2" => "1.3.6.1.4.1.99999.4.5.6"); printf "OID of MIB %s is %s\n", oidm("someMib1");
Module Net::SNMP::Util::OID gives some functions which treats mapping data between MIB name and OID.
Net::SNMP::Util::OID
This module is preparing some basic MIB and OID maps mainly definded RFC-1213. For example, if you want to treat some MIB and OID with among 'system' and 'snmp' entry group's, declare with use pragma and gives arguments with tailing '*' like;
use
use Net::SNMP::Util::OID qw(system* snmp*);
So, note that no declaring with this tagging couldn't treat mapping data.
use Net::SNMP::Util::OID; $oid = oid("ifType"); # Null string will return!
The prepared entrys are; system*, interfaces*, at*, ip*, icmp*, tcp*, udp*, egp*, snmp*, tcp* and ifXTable*. And there are few sugar syntaxs. Only one character '*' means all prepared mapping, 'sys*' means 'system*' and 'if*' means importing 'interfaces' and 'ifXTable' at same time.
system*
interfaces*
at*
ip*
icmp*
tcp*
udp*
egp*
snmp*
ifXTable*
This module, Net::SNMP::Util::OID, exports oid_load(), oid(), oidt() and oidm().
oid_load()
oid()
oidt()
oidm()
oid_load( $mib_name => $oid, ... ); oid_load( \%somehash, ... );
Functions oid_load() takes hash pairs or a referances of hash as arguments, and store intarnally MIB name and OID (Object IDentifier) mapping data from them.
oid( $mib_name, ... )
Function oid() takes MIB names and returns OIDs of them. If OID is not found, given MIB name uses as returing value.
This function treats sub OID of a part of given MIB name as well as sample below;
print oid("ifName.100"); # shows 1.3.6.1.2.1.31.1.1.1.1.100
oidt( $mib_oid, ... )
Function oidt() translates OID to MIB name. This returns null string '' if it can't find specified OID.
''
($mib_name, $oid) = oidp( $mib_name )
Function oidp() takes a MIB name and returns array contains itself and it's OID search by oid().
oidp()
t.onodera, <cpan :: garakuta.net>
<cpan :: garakuta.net>
Net::SNMP::Util, Net::SNMP::Util::TC
Copyright(C) 2010 Takahiro Ondoera.
This program is free software; you may redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::SNMP::Util, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SNMP::Util
CPAN shell
perl -MCPAN -e shell install Net::SNMP::Util
For more information on module installation, please visit the detailed CPAN module installation guide.