I'll add my 2 cents worth and say that if you're interested in having an all-inclusive program, there are examples of how to use the default metric builder PrintMetric.pm found in <epagent_home>/lib/perl/Wily.
I use the module in all of my perl programs for EPA.
---start code block---
use FindBin;
use lib ("$FindBin::Bin", "$FindBin::Bin/lib/perl", "$FindBin::Bin/../lib/perl");
use Wily::PrintMetric;
--do some stuff here
--send metrics to epa
Wily::PrintMetric::printMetric( type => 'IntCounter',
resource => 'Device',
subresource => $device,
name => 'Reads/sec',
value => int ($deviceStats[1]),
);
---end block---
You can call PrintMetric as many times as needed depending on the number of metrics collected.
-Hiko