Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Template Architecture/Design Review

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
Chappy



Joined: 22 Aug 2008
Posts: 3

PostPosted: Wed Sep 10, 2008 1:48 pm    Post subject: Template Architecture/Design Review Reply with quote

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:
#!/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:
# 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?



Picture 1.png
 Description:
Data Input Method
 Filesize:  103.98 KB
 Viewed:  1090 Time(s)

Picture 1.png



Picture 2.png
 Description:
Data Template
 Filesize:  129.98 KB
 Viewed:  1090 Time(s)

Picture 2.png



Picture 5.png
 Description:
Graph Template
 Filesize:  36.99 KB
 Viewed:  1090 Time(s)

Picture 5.png



Picture 3.png
 Description:
iostat %util
 Filesize:  19.68 KB
 Viewed:  1090 Time(s)

Picture 3.png



Picture 4.png
 Description:
iostat Average Request Size
 Filesize:  24.82 KB
 Viewed:  1090 Time(s)

Picture 4.png


Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Thu Sep 11, 2008 12:12 pm    Post subject: Reply with quote

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
Back to top
Chappy



Joined: 22 Aug 2008
Posts: 3

PostPosted: Thu Sep 11, 2008 2:30 pm    Post subject: Reply with quote

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)?
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Fri Sep 12, 2008 2:13 pm    Post subject: Reply with quote

Not to the manual, but the HowTo. You will see my sig when logging into the forum
Reinhard
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group