Template Architecture/Design Review

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Chappy
Posts: 3
Joined: Fri Aug 22, 2008 12:37 pm

Template Architecture/Design Review

Post by Chappy »

After much trial and error I just built my first graph template. It works great, but the process flow is not as refined as I like - or think it should be.

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";
Output:

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
As you can see from the image attachments, the Data Input Method is parsing the cacti-iostat.pl output and storing that in an RRD file. The Graph Template is Data Source as it's Item Inputs.

Anyone have any thoughts for improvement?
Attachments
iostat Average Request Size
iostat Average Request Size
Picture 4.png (24.82 KiB) Viewed 3006 times
iostat %util
iostat %util
Picture 3.png (19.68 KiB) Viewed 3006 times
Graph Template
Graph Template
Picture 5.png (36.99 KiB) Viewed 3006 times
Data Template
Data Template
Picture 2.png (129.98 KiB) Viewed 3006 times
Data Input Method
Data Input Method
Picture 1.png (103.98 KiB) Viewed 3006 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please find help and a similar step-by-step procedure at the first link of my sig. It still seems to not be that popular as I though it should
Reinhard
Chappy
Posts: 3
Joined: Fri Aug 22, 2008 12:37 pm

Post by Chappy »

Edit:
Hmm, now I see your signature. Never mind then, I'll take a look!

--
Hi Reinhard,
I'm not seeing your sig and I can not find anything relevant in your profile either.

Are you referring to the Cacti Manual (http://docs.cacti.net/?q=node/438)?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Not to the manual, but the HowTo. You will see my sig when logging into the forum
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests