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");
    # ""

    printf " specifys %s\n", oidt("");
    # ifType

    printf "OID of MIB %s is %s\n", oidm("ifName");
    # "ifName", ""

    oid_load("someMib1" => "",
             "someMib2" => "");
    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.

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.


This module, Net::SNMP::Util::OID, exports oid_load(), oid(), oidt() and 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


    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().


t.onodera, <cpan ::>


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.