NAME
Net::SNMP::Util::OID - OID mapper functions for Net::SNMP::Util
SYNOPSIS
# 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");
DESCRIPTION
Module Net::SNMP::Util::OID
gives some functions which treats mapping data between MIB name and OID.
Basic entry group importing
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 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.
EXPORT
This module, Net::SNMP::Util::OID
, exports oid_load()
, oid()
, oidt()
and oidm()
.
FUNCTIONS
oid_load()
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
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
oidt( $mib_oid, ... )
Function oidt()
translates OID to MIB name. This returns null string ''
if it can't find specified OID.
oidp
($mib_name, $oid) = oidp( $mib_name )
Function oidp()
takes a MIB name and returns array contains itself and it's OID search by oid()
.
AUTHOR
t.onodera, <cpan :: garakuta.net>
SEE ALSO
Net::SNMP::Util, Net::SNMP::Util::TC
LICENSE AND COPYRIGHT
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.