$gmetric $gmetric_conf "--name=VVname --value=$pVVname --type=uint32 --units=name";
$gmetriC $gmetric_conf "--name=t --value=$t --type=uint32 --units=t";
$gmetric $gmetric_conf "--name='I/O per second Cur' --value=$ioCur --type=uint32 --units=ioCur";
####
#!/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 $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 ( $VVname, $t, $ioCur, $ioAvg, $ioMax, $kbCur, $kbAvg, $kbMax, $svtCur, $svtAvg, $iokbCur, $iokbAvg, $Qlen) = split /\|/, $thisline;
print "$VVname $ioCur $ioAvg $ioMax $kbCur $kbAvg $kbMax $svtCur $svtAvg $iokbCur $iokbAvg $Qlen\n";
}
close(MYFILE);
open( MYFILE, ') {
my $gmetric="/usr/bin/gmetric";
my $gmetric_conf="-c /etc/gmond.conf";
my $thisline = $_;
chomp($thisline);
my ( $VVname, $t, $ioCur, $ioAvg, $ioMax, $kbCur, $kbAvg, $kbMax, $svtCur, $svtAvg, $iokbCur, $iokbAvg, $Qlen) = split /\|/, $thisline;
$gmetric $gmetric_conf "--name=VVname --value=$pVVname --type=uint32 --units=name";
$gmetriC $gmetric_conf "--name=t --value=$t --type=uint32 --units=t";
$gmetric $gmetric_conf "--name='I/O per second Cur' --value=$ioCur --type=uint32 --units=ioCur";
$gmetric $gmetric_conf "--name='I/O per second Avg' --value=$ioAvg --type=uint32 --units=ioAvg";
}
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;
}
####
[bluethundr@cc126-200:~/perl] $:./test-foo.pl
Scalar found where operator expected at ./test-foo.pl line 42, near "$gmetric $gmetric_conf"
(Missing operator before $gmetric_conf?)
String found where operator expected at ./test-foo.pl line 42, near "$gmetric_conf "--name=VVname --value=$pVVname --type=uint32 --units=name""
(Missing operator before "--name=VVname --value=$pVVname --type=uint32 --units=name"?)
Scalar found where operator expected at ./test-foo.pl line 43, near "$gmetriC $gmetric_conf"
(Missing operator before $gmetric_conf?)
String found where operator expected at ./test-foo.pl line 43, near "$gmetric_conf "--name=t --value=$t --type=uint32 --units=t""
(Missing operator before "--name=t --value=$t --type=uint32 --units=t"?)
Scalar found where operator expected at ./test-foo.pl line 44, near "$gmetric $gmetric_conf"
(Missing operator before $gmetric_conf?)
String found where operator expected at ./test-foo.pl line 44, near "$gmetric_conf "--name='I/O per second Cur' --value=$ioCur --type=uint32 --units=ioCur""
(Missing operator before "--name='I/O per second Cur' --value=$ioCur --type=uint32 --units=ioCur"?)
Scalar found where operator expected at ./test-foo.pl line 45, near "$gmetric $gmetric_conf"
(Missing operator before $gmetric_conf?)
String found where operator expected at ./test-foo.pl line 45, near "$gmetric_conf "--name='I/O per second Avg' --value=$ioAvg --type=uint32 --units=ioAvg""
(Missing operator before "--name='I/O per second Avg' --value=$ioAvg --type=uint32 --units=ioAvg"?)
syntax error at ./test-foo.pl line 42, near "$gmetric $gmetric_conf "
Global symbol "$pVVname" requires explicit package name at ./test-foo.pl line 42.
Global symbol "$gmetriC" requires explicit package name at ./test-foo.pl line 43.
syntax error at ./test-foo.pl line 43, near "$gmetriC $gmetric_conf "
syntax error at ./test-foo.pl line 44, near "$gmetric $gmetric_conf "
syntax error at ./test-foo.pl line 45, near "$gmetric $gmetric_conf "
Execution of ./test-foo.pl aborted due to compilation errors.