in reply to Retrieving status data from a device with SSH 2 using Perl

Can you please post (the relevant parts of) your code?

  • Comment on Re: Retrieving status data from a device with SSH 2 using Perl

Replies are listed 'Best First'.
Re^2: Retrieving status data from a device with SSH 2 using Perl
by nmorenod (Novice) on Feb 17, 2010 at 10:33 UTC

    I am really astonished with all the fast answers. Thanks to all of you!

    Here is an example of the code, using Net::OpenSSH (the results with the other packages are similar):

    my $ssh = Net::OpenSSH->new($host, "user"=>$user, "passwd"=>$pass); $ssh->error and die "Couldn't establish connection: ". $ssh->error; my @output = $ssh->capture('control call dial $receiver'); $ssh->error and warn "Couldn't make the call: ". $ssh->error; print "line: $_" for (@output); sleep(1); my @output = $ssh->capture('control call hangup -a'); $ssh->error and warn "Couldn't hangup: ". $ssh->error; print "line: $_" for (@output);

    With this, I get the following output printed:

    line: line: ok,00 line: line: ok,00

    And this is the same but using the shell with the ssh command:

    $ control call dial *receiver* ok,00 CS,23,1,Dialing $ control call hangup -a ok,00 CS,23,1,Terminated $