my $fileSystemConn5Command1 = `netstat -ano |find /C "CLOSE_WAIT"`;
Try this instead:
# define my command to execute
my $fileSystemConn5Command1 = "netstat -ano|find /C \"CLOSE_WAIT\"";
# execute command
my $results = `$fileSystemConn5Command1`;
Now use Wily::PrintMetric::printMetric to send $results:
Wily::PrintMetric::printMetric( type => 'IntCounter',
resource => 'fileSystemConn5',
subresource => '',
name => 'conexoes_em_close_wait',
value =>$results,
)
here's what my test Perl program looks like:
#!/usr/bin/perl
use FindBin;
use lib ("$FindBin::Bin", "$FindBin::Bin/lib/perl", "$FindBin::Bin/../lib/perl");
use Wily::PrintMetric;
use strict;
use warnings;
my $netstatCommand = "netstat -ano|find /C \"CLOSE_WAIT\"";
my $results = `$netstatCommand`;
Wily::PrintMetric::printMetric( type => 'IntCounter',
resource => 'fileSystemConn5',
subresource => 'CLOSE_WAIT',
name => 'conexoes_em_close_wait',
value => $results,
)
Here is the result:
<metric type="IntCounter" name="fileSystemConn5|CLOSE_WAIT:conexoes_em_close_wait" value="21" />