Hi Monks, I am working on a script to automate health check of EMC VNX box in this i am using command nas_checkup to get the output . Problem I am facing right now this command takes 10 mins to complete health check OUTPUT .But this script is returing first 2 lines of output in just seconds.Need help!

#!/usr/bin/perl use Net::SSH2; use warnings; use strict; use diagnostics; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(t +ime); my $datestring = sprintf("%4d_%02d_%02d_%02d",($year + 1900),($mon+1), +$mday,$hour); my $sw; use constant BUFLEN => 50_0000 ; my $user = ""; my $password = ""; my $buf; my $channel; my $command; my $read; #get ip’s #open file open(FILE, "c:/scripts/ips2.txt") or die("Unable to open file"); # read file into an array my @data = <FILE>; # print output to file open OUTPUT, '+>', "EMC-$datestring.txt" or die $!; # create / open th +e out.txt for STDOUT redirection open ERROR, '+>', "err-$datestring.txt" or die $!; # create / open t +he err.txt for errors redirection STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!; # redirecting the STDOUT to + file STDERR->fdopen( \*ERROR, 'w' ) or die $!; # redirecting the errors to + file foreach $sw (@data) { my $ssh = Net::SSH2->new(); if(!$ssh->connect($sw)){ print("Connection Failed\n"); exit(1); } if(!$ssh->auth_password($user,$password)){ print("Authentication Failed"); exit(1); } print "############################################################### +######################\n"; print "Status report of EMC VNX with IP:$sw \n"; print "############################################################### +######################\n"; # Printing Hardware print "Health Check \n"; { $buf =""; my $channel = $ssh->channel(); my $command = $channel->exec("/nas/bin/nas_checkup"); my $read = $channel->read($buf, BUFLEN ); warn 'More than', BUFLEN, 'characters in listing' if $read >= BUFLEN; print "$buf \n"; } print "############################################################### +######################\n"; print "END of Report \n"; print "############################################################### +######################\n"; }

Output , I am getting right now ================================

##################################################################################### Status report of EMC VNX with IP:10.193.140.139 ##################################################################################### Health Check Check Version: 8.1.9.217 Check Command: /nas/bin/nas_checkup ##################################################################################### END of Report #####################################################################################


In reply to EMC VNX SCRIPT by atulperl

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.