Graphing a rolling average.

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Jeff_Smith
Posts: 14
Joined: Thu May 04, 2006 11:53 am

Graphing a rolling average.

Post by Jeff_Smith »

I currently have a data source and graph that show the number of SMTP message delivered per second. I would like a graph that shows the number of messages delivered each hour. Is this possible. I looked at teh CDEF's but I have to admit I am kind of a new to Cacti.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Create a CDEF that looks like

Code: Select all

cdef=CURRENT_DATA_SOURCE,3600,*
to multiply the current data source by 60*60 (seconds * minutes). Apply this new CDEF to the graphed items and the legends as well
Reinhard
Jeff_Smith
Posts: 14
Joined: Thu May 04, 2006 11:53 am

Post by Jeff_Smith »

Does that average out the last hour or just take the current value times 3600?

I don't think I explained myself very well. What I am looking for is a graph with the granularity of 1 hour.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Oops, I misunderstood. My CDEF will make the results read as "per hour" data instead of "per second".
So you want to poll and display not at standard 5 min interval but at 60 min interval? Or do you want to collect data still every 5 mins but average them out? Or do you want to have TREND information (introduced with rrdtool 1.2.x)?
The TREND thingy is easy, the rest can be done as well but requires some more planning
Reinhard
Jeff_Smith
Posts: 14
Joined: Thu May 04, 2006 11:53 am

Post by Jeff_Smith »

Once again I hav e to admit my ignorance. I wanted to still collect the data every 5 minutes but wanted to average it out. I guess my confusing is coming from the TREND information you are talking about. I am not 100% what the difference is between an average and a trend. Thanks for your continued patient.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

The AVERAGE is computed by rrdtool automatically when "consolidating" data. E.g. rrdtool takes 6 values, adds them and divides them by 6. For the given timespan, this AVERAGE is the only value stored in the rrd file (e.g. covering 2 h).
The TREND is computed every 5 minutes (assuming standard rra definitions) and takes into account a configurable timespan of historical data (e.g. 30 minutes). The resulting value is printed into the graphs but not stored in the database.
Perhaps I'll post a screenshot this week
Reinhard
Jeff_Smith
Posts: 14
Joined: Thu May 04, 2006 11:53 am

Post by Jeff_Smith »

Thanks, that helps me understand the difference prefectly. How do I add the TREND line? I looked at the functions and I saw MIN, MAX, and Average.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Find example attached for Traffic Graph Template
The black LINE1 is TRENDed Traffic In/Out, respectively
The TREND CDEF for positive values works quite the same way (substitue -8 by 8 does the trick)
Reinhard
Attachments
The CDEF
<br />(multiplying by 8 necessary for Bytes to Bits conversion only)
The CDEF
(multiplying by 8 necessary for Bytes to Bits conversion only)
TREND-CDEF.jpg (110.73 KiB) Viewed 5202 times
The Graph Template
The Graph Template
Traffic.jpg (204.84 KiB) Viewed 5202 times
TREND in action
TREND in action
TREND.jpg (81.7 KiB) Viewed 5202 times
Jeff_Smith
Posts: 14
Joined: Thu May 04, 2006 11:53 am

Post by Jeff_Smith »

Thanks again Mr lvm. :) hopefully I will be able to get a better understanding of Cacti and start helpling out instead of just asking questions?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Thank you for the flowers. But I learned this from the forums some months ago :wink:
Reinhard
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

Post by niobe »

Hmm, this is cool, but not without flaws.

Hourly is too fine to be useful for my graph of numbers of wireless users, so I want to see a moving 24 hour average.

The CDEF works but seems to break whenever you are displaying less than 24 hours worth of data, or rather not displaying more than 24 hours worth of data. So even on the daily graphs the moving average is not drawn.

Also when in list mode it seems to be broken for any of the time presets given.

Can anyone think of a workaround? I am considering creating a new data source that stores the moving average, then the value will be printable at any resolution.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

TREND was changed somehow in rrdtool 1.3.x
I did not yet check it out, I only saw this on rrdtool-users mailinglist.
Your first problem, not seeeing a 24h trend on a 24h graph is easily explained: The first trend is graphed only after an initial gap of TREND length.
Reinhard
niobe
Cacti User
Posts: 228
Joined: Mon Mar 10, 2008 6:52 pm
Location: Australia

Post by niobe »

gandalf wrote:TREND was changed somehow in rrdtool 1.3.x
I did not yet check it out, I only saw this on rrdtool-users mailinglist.
Your first problem, not seeeing a 24h trend on a 24h graph is easily explained: The first trend is graphed only after an initial gap of TREND length.
Reinhard
Yes, you can workaround this by changing your CDEF to 24 hours less one poller period.

There is a new TRENDNAN in rrdtool to ignore NANs and still calculate the trend, but perhaps you mean something else? I'll have a look at that list.

cheers
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest