varalaxmibbnl has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
I want to login to bgp to run few commands often so i thought of making script to run those commands and i used
Net::SSH::Perlto login to bgp and run a command..the script is as follows
#!/usr/bin/perl use Net::SSH::Perl; use POSIX qw(strftime); $time = strftime "%d-%b-%Y", localtime; $host = "XXX.XXX.XXX.XXX"; $username = "user"; $password = "password"; $port = "XXXX"; $ssh = Net::SSH::Perl->new($host,port=>"$port",protocol=>2); @array = $ssh->login($username,$password); #@ary = $ssh ->cmd("show arp"); @data = $ssh->cmd("show interfaces"); print "@array\n@data\n"; @data2 = $ssh ->cmd("exit"); print "@data2\n";
if i run the above script it will login but it prints invalid command show
please some one suggest how to solve this problem
Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Login to BGP via Perl
by AppleFritter (Vicar) on Jul 13, 2014 at 11:57 UTC | |
|
Re: Login to BGP via Perl
by LanX (Saint) on Jul 13, 2014 at 09:16 UTC | |
by marto (Cardinal) on Jul 13, 2014 at 10:17 UTC | |
by varalaxmibbnl (Acolyte) on Jul 13, 2014 at 11:00 UTC | |
by varalaxmibbnl (Acolyte) on Jul 13, 2014 at 10:58 UTC |