Hi Tom.

Tom O'Brien wrote:
Hi all:
I'm trying to write a Perl module (for my own use) based on the SNMP module distributed with Net-SNMP.


What I'd like to do is based on a trap number and OID, look up a TRAP-TYPE (v1) definition, and determine what OIDs, data-types, and values that the trap requires.

I'd then be able to build up a call to SNMP::TrapSession::trap() that would get all the required information directly from the MIB file, rather than hard-coding information already in the MIB into my code.

My interface to the module would look something like:
sendTrap($$@)
        $ = enterprise OID of the trap to send
        $ = specific trap to send
        @ = array of parameters that are attached to the trap

I haven't found examples of getting information out of the SNMP::MIB tied hash; is what I'm thinking of feasible at all?

It sounds like you want to pull out the VARIABLES line (v1) or OBJECTS line (v2+) from the MIB using the Perl module. Based on what I see in the perl/SNMP/README file, I don't think it's possible. There is no hash entry for those variables.


Here is a bit of code that will pull some data from the hash for a linkDown (.1.3.6.1.6.3.1.1.5.3) which may help you:

#!/usr/bin/perl
use SNMP;
$ENV{'MIBS'} = 'ALL';
&SNMP::initMib();

$a = '.1.3.6.1.6.3.1.1.5.3';
print qq/key:    $a\n
label:  $SNMP::MIB{$a}{label}\n
type:   $SNMP::MIB{$a}{type}\n
module: $SNMP::MIB{$a}{moduleID}\n\n"
/;

Are you trying to write a program to create test traps based on the MIB?

Alex




------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to