I have taken your idea and made a few changes to include turning it into a
perl script.
++++++++++++++Begin Script Here++++++++++++++++++++++++++++++++++++
#!/usr/bin/perl
############################################################################
##
#This script will gather the nodes in the smartest Cisco_Router and using
the
#snmpwalk command will get the chassis serial number. Output is a comma
#seperated list.
############################################################################
##
@routers=`/usr/OV/bin/nvUtil l Cisco_Router`;
open(OUTPUT, ">/usr/OV/tmp/cisco/hosts/cisco_serial.out");
$begintime=`date`;
print OUTPUT "#Collection Process Begins $begintime";
foreach $host ( @routers ) {
chomp $host;
$_=`/usr/OV/bin/snmpwalk -c communityname -t 10 $host
.1.3.6.1.4.1.9.3.6.3 2>&1`;
s/^cisco.*:\t//;
print OUTPUT "$host,$_";
$endtime=`date`;
}
print OUTPUT "#Collection Process Ends $endtime";
close(OUTPUT);
++++++++++++++End Script Here++++++++++++++++++++++++++++++++++++
Scott Bursik
Pepsico Business Solutions Group
Event Systems Management
972-334-3757
scott.bursik@pbsg.com
-----Original Message-----
From: CATALINA MARTINEZ [mailto:CATALINA.MARTINEZ@tlc.state.tx.us]
Sent: Tuesday, March 18, 2003 11:17 AM
To: nv-l@lists.tivoli.com; Bursik, Scott {PBSG}
Subject: Re: [nv-l] Gather Data
Scott,
I have a script that queries all smartsets and dumps the contents to a file:
I've attached the one I currently have working ok but I've modified the one
below to what you want.. I have not tested it though...
#!bin/ksh
#set -x
##############################################
# This script will do store the contents of Snmpwalk for Smartset
Cisco_Routers
##########################################################
/usr/OV/bin/nvUtil l Cisco_Routers > /tmp/contents.out
for node in `cat /tmp/contents.out`
do
/usr/OV/bin/snmpwalk -c community name -t 100 $node > /tmp/$node.out
done
exit 0
You may want to increase the timeout. If you only need system information, I
found that doing snmpget works better.. "/usr/OV/bin/snmpget -c xxxxx -t 100
node system instead of snmpwalk...
hope that helps...
>>> "Bursik, Scott {PBSG}" <Scott.Bursik@pbsg.com> 03/18/03 08:52AM >>>
NetView 7.1.3 AIX 4.3.3
Hello group,
I am looking for a way to gather and store the results of a snmpwalk or
snmpget for a group of nodes. Here are the details:
Smartset contains all Cisco Routers (Cisco_Router)
Need to get the results of snmpwalk -c communityname hostname
.1.3.6.1.4.1.9.3.6.3 for all of the nodes in that smartest and log it to a
file.
This task isn't too difficult because all of them have the same community
names. Has anyone written a script that would do something similar that
would try all configured community names if there is a SNMP time out when
the snmpwalk or snmpget command is issued?
I am just trying to save a little time if someone out there has taken this
approach before.
Thanks!
Scott Bursik
Pepsico Business Solutions Group
Event Systems Management
972-334-3757
scott.bursik@pbsg.com
---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe@lists.tivoli.com
For additional commands, e-mail: nv-l-help@lists.tivoli.com
*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)
---------------------------------------------------------------------
To unsubscribe, e-mail: nv-l-unsubscribe@lists.tivoli.com
For additional commands, e-mail: nv-l-help@lists.tivoli.com
*NOTE*
This is not an Offical Tivoli Support forum. If you need immediate
assistance from Tivoli please call the IBM Tivoli Software Group
help line at 1-800-TIVOLI8(848-6548)
|