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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |