HI,
Getting SNMP Data could be easier with this script. I thought it might be useful for cacti users. This script takes in four inputs IP Community Baseoid numberofinstances
I guess IP,Community are understood. Baseoid can be the startOID, so for example a diskutil is x.x.x.a in which 'a' is a instance for example c drive utilization
now all you have to do is to use the script is to give
ip community baseoid numberofinstances (you should know how many drives are there, so 3 drives makes this "2")
and then this script gives the output value for all the instances. I guess configuring data input source and datasource are understood.
======Script starts here ==================
#!/usr/bin/perl -w
#
# Pls Supply an Argument
$arg = shift || die "Usage :$0 <IP> <OID> <No of Iterations> " ;
print "Arg: $arg \n" if ($debug) ;
$community = shift || die "Usage :$0 <IP> <OID> <No of Iterations> " ;
print "Commu: $community \n " if ($debug) ;
$oid = shift || die "Usage :$0 <IP> <OID> <No of Iterations> " ;
print "Oid: $oid \n " if ($debug);
$nofitr = shift || die "Usage :$0 <IP> <OID> <No of Iterations> ";
print "No of Iterations $nofitr \n" if ($debug) ;
for ($i=0;$i<=$nofitr;$i++){
print "The Run is : $i \n" if ($debug);
$Oid = "$oid"."$i" ;
print "$Oid \n" if ($debug) ;
open ( FH ," snmpget $arg $community $Oid | ") || die "Can't open SNMP1 $! ";
while (<FH>){
chomp;
my (undef , $value ) = split (/\s=\s/,$_ );
print " $value ";}
}
============ends here ==================
hope it helps
ACE
Script to fetch snmp data with oid instances
Moderators: Developers, Moderators
Script to fetch snmp data with oid instances
ONE MORE DAY WASTED !
Who is online
Users browsing this forum: No registered users and 4 guests