Category: | Networking Code |
Author/Contact Info | Richmon iskydiver@cox.net |
Description: | This script will import a list of Ip addresses into an array and then telnet to the Cisco routers and execute commands and log the output to a file. useful for making changes to a lot of routers where SNMP MIBS are not available. |
# #Use the Net Telnet Cisco module to getting into routers #Richmon Schumann 2-15-03 ###################################################################### use Net::Telnet::Cisco; ###################################################################### #This opens my log file for output open (LOGFILE, '>mylogfilepath') or die "Cannnot open log file : $!\n" +; # #This opens my seed file and stores it into an array # open (FILE, 'myseedfilepath') or die "Cannot open file : $!\n"; my @array = <FILE>; chomp @array; # #This does the telnet into the routers and logs the output to the logf +ile foreach my $ip (@array) { print { 'LOGFILE' } "$ip\n"; my $Telnet = Net::Telnet::Cisco->new(Host => $ip); $Telnet->login(Name => 'user', Password => 'pass'); print { 'LOGFILE' } $Telnet->cmd('show line 1'); print { 'LOGFILE' } $Telnet->cmd('show line 5'); } # close LOGFILE; close FILE; |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Cisco Telnet
by Aristotle (Chancellor) on Feb 19, 2003 at 01:35 UTC | |
by CongoGrey (Sexton) on Feb 19, 2003 at 14:37 UTC | |
by Aristotle (Chancellor) on Feb 19, 2003 at 15:37 UTC | |
by CongoGrey (Sexton) on Feb 20, 2003 at 17:29 UTC | |
by Aristotle (Chancellor) on Feb 20, 2003 at 18:10 UTC | |
| |
Re: Cisco Telnet
by CongoGrey (Sexton) on Feb 18, 2003 at 20:32 UTC | |
by jasonk (Parson) on Feb 18, 2003 at 20:46 UTC |