pjzero@90 has asked for the wisdom of the Perl Monks concerning the following question:
Hi perl monks, I'm trying to go through 250 aix lpars and capture. I SSH into each host and attempting to run a for loop within backticks, come to find out this does not work, it fails when it gets to "do" Any ideas or workarouns? Thanks.
sub aixstorage { my $all_servers = 'path to my AIX list of servers'; my @hosts=`cat $all_servers`; my $filename = '/tmp/aixstorage_report.rtf'; foreach my $one (@hosts){ chomp $one; my $ping = `ping -c 1 -w 1 $one 1>/dev/null 2>&1`; if (defined ($ping)) { my $SSH ="/usr/bin/ssh -o ConnectTimeout=3 -o Stri +ctHostKeyChecking=no"; my $space = $SSH root\@$one for i in lspv | awk '{pri +nt \$1}'; do bootinfo -s \$i; done | awk '{sum+=\$1}END{print (sum\/1 +024)}'}'"`; print "$space\n"; }else { print "\nATTENTION: $one is offline\n" } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AIX harddisk sum of storage
by Corion (Patriarch) on Jul 22, 2018 at 17:40 UTC | |
by pjzero@90 (Novice) on Jul 23, 2018 at 17:32 UTC | |
by Corion (Patriarch) on Jul 23, 2018 at 17:56 UTC | |
|
Re: AIX harddisk sum of storage
by haukex (Archbishop) on Jul 22, 2018 at 21:05 UTC | |
|
Re: AIX harddisk sum of storage
by Lotus1 (Vicar) on Jul 22, 2018 at 20:20 UTC |