#!/usr/bin/perl my $debug = 0; my $limit=10; foreach( 1 .. $limit ) { open( IOSTAT, "iostat -d -t -x /dev/sda |")|| die ; while ( ) { if ( /Time:(.*)/ ) { $time="$1"; } elsif( /sda/ ) { ($disk,$rrqm_s,$wrqm_s,$r_s,$w_s,$rsec_s,$wsec_s,$avgrq_sz,$avgqu_sz,$await,$svctm,$util)=split(/\s+/, $_); } } close(IOSTAT); # Pack the data into arrays push( @time, $time ); push( @disk, $disk ); push( @rrqm_s, $rrqm_s ); push( @wrqm_s, $wrqm_s ); push( @r_s, $r_s ); push( @w_s, $w_s ); push( @rsec_s, $rsec_s ); push( @wsec_s, $wsec_s ); push( @avgrq_sz,$avgrq_sz); push( @avgqu_sz,$avgqu_sz); push( @await, $await ); push( @svctm , $svctm ); push( @util, $util ); } print "Processing Data"; while ( $thing >= 0 ){ print "$thing $time[$thing]\t$disk[$thing]\n" ; $thing=$thing-1; }