- #!/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, '<data.txt' );
- while (<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 ( $VVname, $t, $ioCur, $ioAvg, $ioMax, $kbCur, $kbAvg, $kbMax, $svtCur, $svtAvg, $iokbCur, $iokbAvg, $Qlen) = split /\|/, $thisline;
- my @array= ( $VVname, $t, $ioCur, $ioAvg, $ioMax, $kbCur, $kbAvg, $kbMax, $svtCur, $svtAvg, $iokbCur, $iokbAvg, $Qlen);
- foreach my $item (@array) {
- print "$item \n";
- }
- print "test\n";
- system($gmetric "--name=VVname --value=$VVname --type=uint32 --units=name");
- system($gmetric "--name=t --value=$t --type=uint32 --units=t");
- system($gmetric "--name='I/O per second Cur' --value=$ioCur --type=uint32 --units=ioCur");
- system($gmetric "--name='I/O per second Avg' --value=$ioAvg --type=uint32 --units=ioAvg");
- system($gmetric "--name='I/O per second Max' --value=$ioMax --type=uint32 --units=ioMax");
- system($gmetric "--name='KBytes per sec Cur' --value=$kbCur --type=uint32 --units=kbCur");
- system($gmetric "--name='KBytes per sec Avg' --value=$kbAvg --type=uint32 --units=kbAvg");
- system($gmetric "--name='KBytes per sec Max' --value=$kbMax --type=uint32 --units=kbMax");
- system($gmetric "--name='Svt ms Cur' --value=$svtCur --type=uint32 --units=svtCur");
- system($gmetric "--name='Svt ms Avg' --value=$svtAvg --type=uint32 --units=svtAvg");
- system($gmetric "--name='IOSz KB Cur' --value=$iokbCur --type=uint32 --units=iokbCur");
- system($gmetric "--name='IOSz KB Avg' --value=$iokbAvg --type=uint32 --units=iokbAvg");
- system($gmetric "--name='IOSz KB Qlen' --value=$Qlen --type=uint32 --units=Qlenq");
- }
- 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;
- }
- ====================================================================
- Incorrect options supplied, exiting.
- exastore_data_500G.16
- t
- 101
- 101
- 101
- 4342
- 4342
- 4342
- 8.8
- 8.8
- 42.8
- 42.8
- 0
- test
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- exastore_data_500G.17
- t
- 98
- 98
- 98
- 2626
- 2626
- 2626
- 10.0
- 10.0
- 26.8
- 26.8
- 1
- test
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- exastore_data_500G.18
- t
- 71
- 71
- 71
- 3626
- 3626
- 3626
- 12.5
- 12.5
- 50.8
- 50.8
- 1
- test
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- exastore_data_500G.19
- t
- 96
- 96
- 96
- 3681
- 3681
- 3681
- 10.1
- 10.1
- 38.5
- 38.5
- 0
- test
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- exastore_data_500G.20
- t
- 77
- 77
- 77
- 5041
- 5041
- 5041
- 11.2
- 11.2
- 65.2
- 65.2
- 0
- test
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- Incorrect options supplied, exiting.
- exastore_data_500G.21