in reply to Need help with a grep script
I'll help since this may push you back in the direction of using ssh instead of slinging router passwords around in cleartext :)
use Net::OpenSSH; use Net::Telnet; my $promptre = '/\w+[\$\%\#\>]\s{0,1}$/o'; my $ssh = Net::OpenSSH->new('hostname', user => 'username', password => 'password', kill_ssh_on_timeout => 1, timeout => 30); my ($fh, $pid) = $ssh->open2pty({stderr_to_stdout => 1}); my $cn = Net::Telnet->new( fhopen => $fh, prompt => $promptre, timeout => 30, errmode => 'return', telnetmode => 0, cmd_remove_mode => 1, output_record_separator => "\r", ); my @memory = $cn->cmd("show memory"); my @process = $cn->cmd("show process");
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Need help with a grep script
by FloydATC (Deacon) on Nov 08, 2013 at 16:26 UTC | |
by kschwab (Vicar) on Nov 08, 2013 at 16:47 UTC |
In Section
Seekers of Perl Wisdom