Web Hosting Talk Australia


Go Back   Web Hosting Talk Australia : General Forums : Programming and Web Development : RRDTool & Cacti
Reply

Programming and Web Development Discussion on scripting/programming and web development

 
Thread Tools
Old 11-08-2008, 09:46 PM   #1
Spirit Connect
Uptime Addict
Moderator
 
Spirit Connect's Avatar
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 5,854
RRDTool & Cacti

Does anyone know how Cacti generates the graphs?

For example in debug mode it generates the following:

/usr/local/rrdtool-1.2.27/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Port X" \
--rigid \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="bits per second" \
--slope-mode \
DEF:a="/home/cacti/public_html/rra/0_0_0_0_traffic_in_97.rrd":traffic_in:AVERAGE \
DEF:b="/home/cacti/public_html/rra/0_0_0_0_traffic_in_97.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdeff=b,8,* \
AREA:cdefa#00CF00:"Inbound" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total In\: 20.3 GB\n" \
LINE1:cdeff#002A97:"Outbound" \
GPRINT:cdeff:LAST:"Current\:%8.2lf %s" \
GPRINT:cdeff:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdeff:MAX:"Maximum\:%8.2lf %s" \
COMMENT:"Total Out\: 48.36 GB"

I'm trying to work out how it generates the "Total Out" and "Total In" values so I can than get a daily break down of traffic stats, etc for display in a table with a break down in traffic for the month? I'm getting confused with the Perl documentation... Wonder if somebody has done this before?
__________________
Web Hosting

Spirit Connect is offline  
View Public Profile Visit Spirit Connect's homepage! Find all posts by Spirit Connect Reply With Quote
Old 12-08-2008, 01:03 PM   #2
mmc
Registered User
 
Join Date: Apr 2007
Location: Adelaide
Posts: 15
Re: RRDTool & Cacti

Quote:
Originally Posted by Spirit Connect View Post
Does anyone know how Cacti generates the graphs?

I'm trying to work out how it generates the "Total Out" and "Total In" values so I can than get a daily break down of traffic stats, etc for display in a table with a break down in traffic for the month? I'm getting confused with the Perl documentation... Wonder if somebody has done this before?
How close is multiplying the kbps average by the number of seconds in a day/time period?

(ie. if the average is 100kbps then the data transfered in one day using that average speed is 1080MB (100kbps = 12.5Kbytes/sec * 3600 * 24)).

Then use rrdtool fetch <rrd db> AVERAGE -r 900 -s -1d (example from http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html) to figure out the averages over different time frames etc.

(I don't mess around with this much - we use our snmp billing application, but I do the occasional evil thing with rrdtool).
mmc is offline  
View Public Profile Find all posts by mmc Reply With Quote
Old 12-08-2008, 09:52 PM   #3
perlboy
Cooking? Traderecipes.net
 
perlboy's Avatar
 
Join Date: Jun 2002
Location: Brisbane, QLD, Australia
Posts: 1,093
Re: RRDTool & Cacti

Hey Spirit,

Cacti stores things in RRD so you can just use it's functions:

As an example (Tomcat but concept the same):

[root@foobar:~]# rrdtool fetch /var/www/cacti/rra/tomcatserver_customer_tomcat_jvm_memory_free_2432.rrd AVERAGE | more
jvm_memory_free jvm_memory_max jvm_memory_total error_count max_time
bytes_sent processing_time request_count bytes_received current_threads min_spare_thre
ads max_threads max_spare_threads current_threads_bus

1218459300: 1.4280048000e+06 6.6650112000e+07 2.1245952000e+07 0.0000000000e+00 7.6273560876e-02 2.2322932955e+01
3.9794901327e-02 1.3264967109e-02 0.0000000000e+00 2.5000000000e+01 2.5000000000e+01 1.5000000000e+02 7.5000000000
e+01 2.0000000000e+00

So you get a set of columns and an epoch (EDIT: or should I say epoch then a set :-/)

Remember though, RRD's are 'degrading' so 'totals' will change as time progresses (you'll need to take a 'snapshot' per month for that month).

Stu
__________________
Personal: GooFi - Google Maps WiFi!

perlboy is offline  
View Public Profile Visit perlboy's homepage! Find all posts by perlboy Reply With Quote
Old 12-08-2008, 09:56 PM   #4
perlboy
Cooking? Traderecipes.net
 
perlboy's Avatar
 
Join Date: Jun 2002
Location: Brisbane, QLD, Australia
Posts: 1,093
Re: RRDTool & Cacti

Oh yeah,

And to answer your question it's 'Cacti foo'. Duplicating is damn hard which is why so many people use cacti in the first place. You might find a plugin at cactiusers.net (or even cacti.net) so maybe look there?

Stu
__________________
Personal: GooFi - Google Maps WiFi!

perlboy is offline  
View Public Profile Visit perlboy's homepage! Find all posts by perlboy Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cacti in a Windows environment Expressnet Technical Support 8 12-08-2008 10:11 PM
RRDTOOL Help + SETUP Choppy Australia 0 17-06-2008 03:19 PM
Hole That I Found In Cacti! Briggsie Running a Web Hosting Business 8 21-08-2007 11:49 AM
Cacti setup for incoming 95th ? pixie Technical Support 13 05-04-2006 11:01 PM