[099cef]: chk_mibs  Maximize  Restore  History

Download this file

33 lines (28 with data), 837 Bytes

# chk_mib - fire up every mib in a dir to get it to parse
#           and check for errors.
# Max Baker
# $Id$

my $dir = shift;
# added cisco since some nortel dependencies in there now
my $mibs = shift || 'rfc:cisco';

die "$0 dir mib_dirs\n" unless -d $dir;

open (INDEX, "< $dir/.index") or die "Can't open .index in $dir. run ./mkindex.\n";
while (<INDEX>){
    if ($_ =~ /^(.*)\s+(.*)$/){
        my $mib = $1; my $file = $2;
        push @{$MIBS{$mib}},"$dir$file";
close (INDEX);

foreach my $mib (keys %MIBS){
    # boot up snmptranslate to make it parse the mib.
    my $cmd = "snmptranslate -L e -M $dir:$mibs -m $mib ";
    my $check = `$cmd bork 2>&1`;
    # kill last line (our bogus error)
    $check =~ s/^.*\Z//m;
    if ($check !~ /^\s*$/){
        print "$mib\n";
        print $check;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks