hi, I would like to get some output from an UPS (http://en.wikipedia.org/wiki/Uninterruptible_power_supply) unit. This thing has a ssh and a web interface. If I login interactively to the unit, this is what I see:
slogin user@ups Authenticated with partial success. user@ups's password: American Power Conversion Network Management Card AOS + v3.7.3 (c) Copyright 2009 All Rights Reserved Smart-UPS & Matrix-UPS APP + v3.7.2 ---------------------------------------------------------------------- +--------- Name : asset Date : 29.08.201 +3 Contact : sysadmin Time : 12:27:03 Location : somewhere User : Administr +ator Up Time : 0 Days 4 Hours 9 Minutes Stat : P+ N+ A+ Smart-UPS 1500 RM named asset : On Line, No Alarms Present ------- Control Console ---------------------------------------------- +--------- 1- Device Manager 2- Network 3- System 4- Logout <ESC>- Main Menu, <ENTER>- Refresh, <CTRL-L>- Event Log
So this is like a motd when you login. How can I capture this info? I have tried this:
use strict; use warnings; use Net::OpenSSH; my $host = shift; my $stdin; my $stdout; my $stderr; print $host, "\n"; my $ssh = Net::OpenSSH->new( $host, user => "user", password => "password", timeout => 30, default_stdin_fh => $stdin, default_stdout_fh => $stdout, default_stderr_fh => $stderr, ); $ssh->error and die "Can't ssh to $host: " . $ssh->error; print "stdin is $stdin\n" if defined $stdin ; print "stdout is $stdout\n" if defined $stdout; print "stderr is $stderr\n" if defined $stderr ;
But I am afraid I am getting nothing. I know I can log in, I see that on the log file, but am a bit confused about getting the info. Any help appreciated.

In reply to Net::OpenSSH to ups appliance by natxo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.