#!/usr/bin/perl use strict; use warnings; use IO::Pipe; use IO::Handle; use IO::File; my $system; my @systems = ( '3par-S400', '3par-E200' ); #open( MYFILE, '>>data.txt' ); #foreach my $system (@systems) { # my $output = run_command($system); # while (<$output>) { # next if (m/^$/); # next if (m/KBytes/); # next if (m/VVname/); # last if (m/^\-\-\-\-\-.*$/); # s/^ *//; # s/ +/\|/g; # print MYFILE $_; # } #} #close(MYFILE); #open( MYFILE, ') { # my $thisline = $_; # chomp($thisline); # my $gmetric="/usr/bin/gmetric"; ## This is what we grab and build the array ## 22:28:29|08/30/10|r/w|I/O|per|second|KBytes|per|sec|Svt|ms|IOSz|KB| ## VVname|Cur|Avg|Max|Cur|Avg|Max|Cur|Avg|Cur|Avg|Qlen ## This is the data we get per line # racprod_data03_500G_tpvv|t|674|674|674|6782|6782|6782|3.6|3.6|10.1|10.1|2 # my @array= ( $VVname, $t, $ioCur, $ioAvg, $ioMax, $kbCur, $kbAvg, $kbMax, $svtCur, $svtAvg, $iokbCur, $iokbAvg, $Qlen) = split /\|/, $thisline; # foreach @array { # print $_; # } #} #close(MYFILE); sub run_command { my $user = 'gmon'; my $system = shift; my $protocol = 'ssh'; my $ssh_flags = "-l $user"; my $command = "statvv -ni"; my $space = " "; my $do_command = $protocol . $space . $ssh_flags . $space . $system . $space . $command; my $cmd = IO::Pipe->new; $cmd->reader($do_command); return $cmd; }