sorry about that chris..
actually,in the book ,it says that when the script works it will give output like this
toronto - Update Successful
and when it doesn't,this message will appear
toronto - Update Failed
and this is all the message that i get
i think i will put the script here just to be clear
Quote:
#!/usr/bin/perl -w
#
# snmpcfg.pl -- a script to perform mass configuration changes to
# a list of routers using SNMP.
#
#
# Set behavior
$workingdir="/home/nms";
$snmprw="ORARW";
$tftpsrv="172.25.1.1";
#
#
$rtrlist="$workingdir/RTR_LIST";
open (RTR, "$rtrlist") || die "Can't open $rtrlist file";
open (LOG, ">$workingdir/RESULT") || die "Can't open $workingdir/RESULT file";
#
while (<RTR>) {
chomp($rtr="$_");
print LOG "=================================== \n";
print "=================================== \n";
$snmpset="/usr/local/bin/snmpset -t 20 -r 2 v1 c $snmprw $rtr ";
chomp($result=\Q$snmpset .1.3.6.1.4.1.9.2.1.50.$tftpsrv s SNMPCFG\Q);
if ($result=~/.+ = "(.+)"$/ ) {
if( $1 eq SNMPCFG ) {
print LOG "$rtr - Update Successful\n";
print "$rtr - Update Successful\n";
chomp($result=\Q$snmpset .1.3.6.1.4.1.9.2.1.54.0 i 1\Q);
if ($result=~/.+ = (.+)$/ ) {
if( $1 == 1 ) {
print LOG "$rtr - Wr Mem Successful\n";
print "$rtr - Wr Mem Successful\n";
}
else {
print LOG "$rtr - Wr Mem Failed\n";
print "$rtr - Wr Mem Failed\n";
}
}
else {
print LOG "$rtr - Wr Mem Failed\n";
print "$rtr - Wr Mem Failed\n";
}
}
else {
print LOG "$rtr - Update Failed\n";
print "$rtr - Update Failed\n";
}
}
else {
print LOG "$rtr - Update Failed\n";
print "$rtr - Update Failed\n";
}
}
|
i guess i did something wrong in stating $snmprw and $rtrlist variable
thanks for your reply,i'm pretty newb about snmp and perl scripting..
--fathul--