WaltSteadman
MIS
Greetings all,
I found a script that works to SSH Version 2 into my Cisco Routers but the problem I am having with it is that it oftentimes gives a timed out error and I am not sure how to avoid that, so was hoping someone might have a solution
Correct Results:
Error Message I get often:
Any assistance with a wait or maybe even a check and relog would be greatly appreciated
TIA
Wally
I found a script that works to SSH Version 2 into my Cisco Routers but the problem I am having with it is that it oftentimes gives a timed out error and I am not sure how to avoid that, so was hoping someone might have a solution
Code:
#!/usr/bin/perl
use Net::SSH::Expect;
my $ssh = Net::SSH::Expect->new (
host => "routername",
password=> 'password',
user => 'uesrname',
raw_pty => 1
);
my $login_output = $ssh->login();
if ($login_output !~ /rtr-/) {
die "Login has failed. Login output was $login_output";
}
#$ssh->exec("stty raw -echo");
$output1=$ssh->exec("show etherchannel summary | inc (s)");
print $output1;
print "\n";
Correct Results:
Code:
[server@myserver]# perl ether.cgi
show etherchannel summary | inc (s)
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
U - in use f - failed to allocate aggregator
M - not in use, minimum links not met
u - unsuitable for bundling
Number of channel-groups in use: 3
Number of aggregators: 3
Group Port-channel Protocol Ports
routername-rtr-2>
Error Message I get often:
Code:
[server@myserver]# perl ether.cgi
SSHAuthenticationError Login timed out. The input stream currently has the contents bellow:
********************************************************************
* Access to this system is limited to authorized users for company *
* business purposes only. *
* r040315 *
********************************************************************
username@routername's password: at /usr/local/lib/perl5/site_perl/5.8.8/Expect.pm line 828
Any assistance with a wait or maybe even a check and relog would be greatly appreciated
TIA
Wally