Florian Endler > Net-SNMP-Vendor > Net::SNMP::Vendor

Download:
Net-SNMP-Vendor-0.01a.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Net::SNMP::Vendor - lookup the Vendor for a sysObjectID based on the IANA list

SYNPOSIS ^

        use Net::SNMP::Vendor;
        
        my $sysObjectID = '.1.3.6.1.4.1.0';
        
        my $v = Net::SNMP::Vendor->new;
        $v->load_cache;
        my $vendor = $v->lookup(sysid => $sysObjectID);

DESCRIPTION ^

The Internet Assigned Numbers Association (www.iana.org) maintains a list of all assgined sysObjectID which can be used to determine the vendor of a SNMP agent. Futhermore this ID points usually to an entry in the vendors SMI within the enterprise subtree under '.1.3.6.1.4.1'.

To obtain the sysObjectID perform a SNMP get_request operation on the SNMP agent for the following OID '.1.3.6.1.2.1.1.2.0'. The result will be as described above a dotted decimal string with the prefix '.1.3.6.1.4' followed by the vendors identification ID and the vendor assigned device ID.

You might then either pass the whole string or the extracted vendor ID to the module as described above. If the ID is assigned and in the cache the module will return a hash reference to a vendor object giving all information stored by the IANA for that certain vendor ID. If the ID is unkown the module will return undef. To get the cause for the error you might call the get_error() function.

This module tries to persistently cache with DBM::Deep the vendor information to avoid obsesive network use. If you prefer not to store the result persistently you might use Net::SNMP::Vendor::CACHE in combination with the type option in the constructor. That will cause the module to store the loaded list within a normal hash reference

NOTE: The result will be lost as soon as the process finishes that created the hash.

CONSTRUCTOR ^

new ( [type => DB|CACHE, db_dir => DIR, db_file => FILE, db_optimize => Bool] )

Creates and returns a blessed reference to a Vendor object. The module can be run in two different modes. The recommended mode is the database mode (set type to Net::SNMP::Vendor::DB) which is enabled by default. The other mode is called cache mode (set type to Net::SNMP::Vendor::CACHE).

If run in the DB mode the constructor will try to create a DBM::Deep database either under './sysoid.db' or under the location specified through the 'db_dir' and 'db_file' option. If the creation of the database fails the cause for the error can be determined calling the get_error() function. In this case the type option will be set to CACHE automatically.

The db_optimize option can be used to enforce the release of unused disk space used by the DBM::Deep object. NOTE: Under rare conditions this sometimes leads to the loss of data. The feature is disabled by default.

Running in CACHE mode means that the list of loaded sysObjectID list will be stored temporarily in a hash reference and the list will be lost when the process finishes.

METHODS ^

load_cache

Loads the list of assigned sysObjectIDs from 'http://www.iana.org/assignments/enterprise-numbers'. Depending on the type the result is either stored in a DBM::Deep database or in a hash reference. If not initially loaded the functions first checks if the stored list comply with the current list loaded before updating the database or cache. If an error occurred the function will return undef. Else ERROR_SUCCESS is returned.

lookup(sysoid => sysObjectID)

Tries to lookup the passed sysObjectID. The sysObjectID might be either passed as the whole dotted decimal string or as an unsigned integer to the function. If the function succeeds it will return a hash reference with the sysObjectID corresponding vendor. If not it will return undef. To determine the error cause call the get_error() function.

get_error

Returns the cause for the last error that occured. If no error occured it will return ERROR_SUCCESS. If the error was caused by another module that was called by the Vendor object there will be additional error information available calling this function.

get_lastupdated

Returns the date in the style YYYY-MM-DD when the loaded and probably saved list last has been updated by the IANA.

AUTHOR ^

Florian Endler endler@cpan.org

COPYRIGHT AND LICENSE ^

Copyright (c) 2007 Florian Endler. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: