in reply to Monitor memory on a cisco router
In any case, using Net::SSH2 correctly is quite hard and often involves looking at the module source code or even at libssh2 one. If you are on a Unix/Linux box, Net::OpenSSH is far easier to use.
You can even perform the querying in parallel using Net::OpenSSH::Parallel:
use Net::OpenSSH::Parallel; my $pssh = Net::OpenSSH::Parallel; $pssh->add_host($_, user => $user, password => $password) for @hosts; $pssh->all(parsub => \&query_device); $pssh->run; sub query_device { my ($host, $ssh) = @_; my $output = $ssh->capture({ stdin_data => <<EOD, stderr_to_stdout + => 1 }); enable $secret term len 0; sh mls cef sum EOD $output =~ s/\s+/ /g; print "data from $host: $output\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Monitor memory on a cisco router
by vlad3848 (Acolyte) on Mar 19, 2014 at 14:51 UTC |