nv-l
[Top] [All Lists]

Re: RES: [nv-l] Mib Expression

To: <wagnergc@itautec-philco.com.br>
Subject: Re: RES: [nv-l] Mib Expression
From: netview@toddh.net (Todd H.)
Date: 18 Dec 2002 14:14:44 -0600
Cc: <nv-l@lists.tivoli.com>
Reply-to: nv-l@lists.tivoli.com
"Wagner" <wagnergc@itautec-philco.com.br> writes:
>
> Thanks Todd,
> 
> I still didn't find a solution for this problem...
> 
> Maybe a script is the only solution... i'll try it out...

Excellent excuse to think perl thoughts and make the world better.
Here's a banged together example in Perl.  Modify to suit: 

----------------------------------------------------------------------
#!/usr/bin/perl -w

#aix07[/home/toddh]$ /usr/OV/bin/snmpwalk localhost
#interfaces.ifTable.>
#interfaces.ifTable.ifEntry.ifType.1 : INTEGER: 7
#interfaces.ifTable.ifEntry.ifType.2 : INTEGER: 7
#interfaces.ifTable.ifEntry.ifType.3 : INTEGER: 7
#interfaces.ifTable.ifEntry.ifType.4 : INTEGER: 24

my $instance;
my $oid;
my $type;
my $value;

my $totalmem = 0;
my @output = `/usr/OV/bin/snmpwalk localhost
interfaces.ifTable.ifEntry.ifType`;
print @output;
foreach $instance (@output) {
        ($oid,$type,$value) = split(/:/, $instance, 3);
        chomp $value;
print $value;
        $totalmem += $value ;
}

print "\n The total is: $totalmem \n";

# my $somethreshold = 3000;
# if ( $totalmem >= $sometthreshold) {
#        exec("/usr/bin/mail blah@foo.com 'The sky is falling');
#}

Best Regards, 
-- 
Todd H.
http://www.toddh.net/

<Prev in Thread] Current Thread [Next in Thread>

Archive operated by Skills 1st Ltd

See also: The NetView Web