#Use the Net Telnet Cisco module to getting into routers #Written by Richmon Schumann 2-19-03 #Version 1.2 #Module Declarations ########################################################### use strict; use Net::Telnet::Cisco; ########################################################### #The script will initialize my files #This opens my log file for output # open my $log, '>', 'logfile' or die "Cannnot open log file : $!\n"; # #This opens my seed file and stores it into an array # open my $seed, '<', 'seedfile' or die "Cannot open file : $!\n"; #This stores the contents of the seed file into an array my @commands = ('show line aux 0'); ############################################################ #MAIN SCRIPT #This does the telnet into the routers and logs the output to the logf +ile # while(<$seed>) { chomp; my $Telnet = Net::Telnet::Cisco->new(Host => $_) or die "Cannot op +en session to '$seed': $!\n"; $Telnet->login(Name => 'user', Password => 'pass') or die "Cannot +log into device '$_': $!\n"; print $log "$_\n", grep (/Modem hardware state:/, map $Telnet->cmd +($_), @commands); } ############################################################ #Cleanup close $log; close $seed;
In reply to Re: Re^5: Cisco Telnet
by CongoGrey
in thread Cisco Telnet
by CongoGrey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |