I'm graphing the output from the iostat command using a perl script. The iostat perl script lives on each client. I have a data input method that calls that script via ssh (using shared-key authentication). So this script, and cacti's pub key has to live on each server I wish to graph. This is where I believe there is a better way. I've tried using an snmp extend to map the output of the cacti-iostat.pl script to an OID, and didn't have much luck. It's very possible I screwed up the configuration for grabbing that OID.
I was hoping to have some Cacti gurus take a look and weigh in with thoughts for improvement.
The process flow is:
- Data Input Method Script/Command: ssh root@<hostname> '/usr/local/sbin/cacti-iostat.pl <dev>'
- Data Template
- Graph Template
Script (borrowed from http://www.dreness.com/blog/archives/33):
Code: Select all
#!/usr/bin/perl -w
# get iostat output
chomp ($iostats = `iostat -x -d -k 1 5 | tail -n 2 | grep $ARGV[0] | awk '{print \$1 " " \$2 " " \$3 " " \$4 " " \$5 " " \$6 " " \$7 " " \$8 " " \$9 " " \$10 " " \$11 " " \$12}'`);
@iostats = split(/\s/, $iostats);
$Device = $iostats[0];
$rrqm = $iostats[1];
$wrqm = $iostats[2];
$reads = $iostats[3];
$writes = $iostats[4];
$rsec = $iostats[5];
$wsec = $iostats[6];
$avgrqsz = $iostats[7];
$avgqusz = $iostats[8];
$await = $iostats[9];
$svctm = $iostats[10];
$util = $iostats[11];
print "device\:$Device rrqm\:$rrqm wrqm\:$wrqm reads\:$reads writes\:$writes rkb\:$rsec wkb\:$wsec avgrqsz\:$avgrqsz avgqusz\:$avgqusz await\:$await svctm\:$svctm util\:$util";
Code: Select all
# perl cacti-iostat.pl sda
device:sda rrqm:0.00 wrqm:22.77 reads:0.00 writes:1.98 rkb:0.00 wkb:99.01 avgrqsz:100.00 avgqusz:0.01 await:3.00 svctm:3.00 util:0.59
Anyone have any thoughts for improvement?