Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: accessing Cisco via SSH

by afresh1 (Hermit)
on Oct 13, 2010 at 16:08 UTC ( [id://865116]=note: print w/replies, xml ) Need Help??


in reply to Re^2: accessing Cisco via SSH
in thread accessing Cisco via SSH

In this line:
my(@hostline, $stderr, $exit) = $cs->cmd('sh run | inc hostname');
gives you all return values in @hostline and nothing in $stderr or $exit. If you are getting logged in, it should be able to run commands. Using print is a very valuable diagnostic tool. I would probably even go as far as making something very simple for testing.

use strict; use warnings; use Net::SSH::Perl; $ENV{'HOME'} = 'c:\strawberry'; my $ip = 'xxx'; my $user = '********'; my $pw = '********'; # If you use single quotes, only single quotes +will to be escaped with '\' my $cs = Net::SSH::Perl->new($ip); if ($cs->login( $user, $pw)) { print $cs->cmd('sh run | inc hostname'); } else { warn "Unable to login\n"; } $cs->close;
l8rZ,
--
andrew

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://865116]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found