SNMP Perl module and MIB navigation
Daniel Savard <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello everyone,
I am trying to convert notifications from a serie of MIB files I have. In
fact, I need to read the MIB files and output couple of other files which
content depends on the notifications and traps defined into the MIB files.
Rather than writing my own MIB file parser, I tried to use the Perl SNMP
module. However, I am not able to get the MIB files loaded and read
appropriately. Whatever I am doing, it seems the information is not made
available into the MIB hash (%MIB).
Here is a snippet of my code for review:
use SNMP;
my $mibDirs = join(',',@ARGV);
&SNMP::addMibDirs($mibDirs);
&SNMP::loadModules('NetWare-Server-Alarm-MIB','NetWare-Server-Alarm-Extension-MIB');
&SNMP::initMib();
foreach my $oid (keys(%SNMP::MIB)) {
if ( $SNMP::MIB{$oid}{'type'} =~ /NOTIF/ ||
$SNMP::MIB{$oid}{'type'} =~ /TRAP/ ) {
print "OID=", $oid, "\n";
print "\tTYPE=", $SNMP::MIB{$oid}{'type'}, "\n\tLABEL=",
$SNMP::MIB{$oid}{'label'}, "\n";
print "\tDESCRIPTION=", $SNMP::MIB{$oid}{'description'}, "\n";
}
}
...
I did try also reading the file with addMibFiles() without more success.
Anyone can help me with this one?
TIA
--
-----------------
Daniel Savard
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users