Respected Monks,

I am trying a different implementation of a script I had written earlier for checking EMC Celerra NAS Arrays (Uploaded in Cool Uses Of Perl Section). I wanted to check a different command and stuff doesn't seem to work. In order to reduce the error checks to a bare minimum, I wrote a simple script as given below. I have given the loopback IP and a fake username password below but in the script, I am using the correct one. I have also ssh'd into the NAS Array and ran the command from command prompt and that works fine.

#!/usr/bin/perl use warnings; use strict; use Net::SSH2; my $nasip= "127.0.0.1"; my $username = "username"; my $password = "password"; my $ssh2 = Net::SSH2->new(); $ssh2->connect("$nasip") || die "Cant connect to $nasip - $!"; $ssh2->auth_password("$username","$password") || die "Username/Passwor +d not right"; my $chan = $ssh2->channel(); $chan->blocking(0); sleep 10; $chan->exec('nas_server -list') or die "Cannot run the command - $!.$^ +E."; print while (<$chan>);

If I run the script above, I get the following ouptut:

C:\plscripts>perl newmon.pl Cannot run the command - .A non-blocking socket operation could not be + completed immediately. at newmon.pl line 16.

Sorry if my question appears stupid, but is the Net::SSH2 capable of running a command with a space in it? The command I am running in the script this time is nas_server -list and earlier it was /nas/sbin/getreason

.

As can be seen, there's a space between "nas_server" and "-list". I googled up and got to know that the Error I am getting is something to do with a Windows related socket error, but if so, how come I dont get the error when I run the /nas/sbin/getreason command? I have also ssh'd into the NAS Array and ran the command from command prompt and that works fine.Please let me know if I am going wrong somewhere. This script is running on Windows Server 2003 with DWIM Perl 5.14.

Perlpetually Indebted To PerlMonks

use Learning::Perl; use Beginning::Perl::Ovid; print "Awesome Books";
http://dwimperl.com/windows.html is a boon for Windows.


In reply to Error - A non-blocking socket operation could not be completed immediately. by perl514

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.