Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Jun 29, 2017 9:12 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Discussion: Graphing MAX of MAX vs. MAX of AVERAGE
PostPosted: Tue Jan 26, 2010 4:21 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Sit down. Be calm. The following is rrdtool hardcore stuff. If I find time, I will (perhaps) add some graphs to make things clear, but I hope to find somebody out there who understands and provides input. This perhaps sounds a bit boastful but is not meant that way.

THE PROBLEM

Let's assume a standard Cacti Traffic Graph. There is an AREA and a LINE graph item. Each of them makes a DEF appear in the rrdtool graph statement. The standard template uses the AVERAGE consolidation statement on them DEF.

Then, you find 3 GPRINTs related to that DEF (via a CDEF that multiplies by 8 to "Turn bytes into Bits"). The Cacti graph template item makes you think that the consolidation function (CF) used is LAST, AVERAGE and MAX, respectively. In fact, this is wrong. The GPRINT does not change the consolidation function.

So in fact, we have the consolidation function AVERAGE for all 3 GPRINTs. The LAST GPRINT print the value of the last data point of the AVERAGE CF (that is: last of CF:AVERAGE, not last of CF:LAST).
The AVERAGE GRPINT prints the average of all printed data points of the AVERAGE CF (that is: average of CF:AVERAGE); which sound quite normal.
The MAX GPRINT prints the maximum of all printed data points of the AVERAGE CF (that is maximum of CF:AVERAGE and not maximum of CF:MAXIMUM)

This is the related part of rrdtool graph
Code:
DEF:a="/var/www/html/cacti-087/rra/4/68.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/cacti-087/rra/4/68.rrd":traffic_out:AVERAGE \
CDEF:cdefa=a,8,* \
CDEF:cdeff=b,8,* \
AREA:cdefa#00CF00FF:"Inbound"  \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdeff#002A97FF:"Outbound"  \
GPRINT:cdeff:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdeff:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdeff:MAX:"Maximum\:%8.2lf %s\n"  \

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: The Workaround
PostPosted: Tue Jan 26, 2010 5:13 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
THE WORKAROUND

In most cases, you want to have peak data in your (consolidated) graphs. In rrdtool lingo, this mean to associate the CF:MAX.

Unfortunately, with current Cacti you can't get a new DEF into the graph without using a LINEx, AREA or STACK. So I've made up my mind to create a graph that both uses the CF:AVERAGE and the CF_MAX along with the standard set of GPRINTs for both. Here's the result:
Code:
DEF:a="/var/www/html/workspace/cacti-087/rra/4/76.rrd":traffic_in:AVERAGE \
DEF:b="/var/www/html/workspace/cacti-087/rra/4/76.rrd":traffic_in:MAX \
DEF:c="/var/www/html/workspace/cacti-087/rra/4/76.rrd":traffic_out:AVERAGE \
DEF:d="/var/www/html/workspace/cacti-087/rra/4/76.rrd":traffic_out:MAX \
CDEF:cdefa=a,8,* \
CDEF:cdefe=b,8,* \
CDEF:cdefi=c,8,*,-1,* \
CDEF:cdefj=c,8,* \
CDEF:cdefbc=d,8,*,-1,* \
CDEF:cdefbd=d,8,* \
AREA:cdefa#00CF00FF:"100000"  \
GPRINT:cdefa:LAST:"    Current\:%8.2lf %s"  \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefe#005D57FF:"Peak Usage"  \
GPRINT:cdefe:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefe:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefe:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:cdefi#002A97FF:"100000"  \
GPRINT:cdefj:LAST:"    Current\:%8.2lf %s"  \
GPRINT:cdefj:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefj:MAX:"Maximum\:%8.2lf %s\n"  \
LINE1:cdefbc#0000AAFF:"Peak Usage"  \
GPRINT:cdefbd:LAST:"Current\:%8.2lf %s"  \
GPRINT:cdefbd:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefbd:MAX:"Maximum\:%8.2lf %s\n"

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: The Goal
PostPosted: Tue Jan 26, 2010 5:41 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
THE GOAL

When graphing both CF:AVERAGE and CF_MAX, the solution above seems to be fine. But rrdtool allows for using a DEF in a GPRINT even if the same DEF is _not_ used in any LINEx, AREA or STACK.
In other words, Cacti currently lacks the option to only add a DEF.

So we may add a new Graph Item Type, named e.g. DEF only.

Please discuss
Reinhard

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2010 4:04 am 
Offline

Joined: Wed Mar 10, 2010 3:59 am
Posts: 7
Now i just put MAX line without legend just before MAX GPRINT. But there also problem with summarizing CDEFs and STACKs, which is forcing you to pass a small challenge when you create Aggregate graphs.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 10, 2010 2:35 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
rps64 wrote:
..., which is forcing you to pass a small challenge when you create Aggregate graphs.
Yes, I know. But I nearly amde up my mind to
- support "pure" DEFs were you currently only have AREA, STACK or LINE
- enhance AGGREGATE to e.g. turn a AVERAGE/AREA into a MAX/AREA when aggregating
But this is still future
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2010 4:43 am 
Offline

Joined: Wed Mar 10, 2010 3:59 am
Posts: 7
I think that using AVERAGE/AREA is good, but we also draw MAX/LINE to show spikes. When aggregating now we draw all MAX DEFs as 100% transparent lines and colored summary LINE at the end.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 01, 2010 7:58 am 
Offline

Joined: Thu Feb 12, 2009 3:02 pm
Posts: 29
Location: Slovenia
gandalf wrote:
- support "pure" DEFs were you currently only have AREA, STACK or LINE


Could we also specify which DEF we want to use in a GPRINT graph item?

Just this week I nearly lost my mind creating a graph with two AREAS one for AVERAGE and one for MAX to achieve an effect similar to this:
http://www.lonap.net/mrtg/lonap-total-year.png

But I also wanted the legend to look something like this:
Code:
[color1] average traffic [color2] max traffic
Current: <value>
Average: <value>
Max: <value>


It drove me nuts why the average GPRINT value didn't match up with the graph. It took me hours to figure out how Cacti selects DEFs for GTPRINTs.

Granted it didn't occur to me that I could just add another MAX or AVERAGE LINE with no color just before the appropriate GPRINT. After reading rps64 first post I now have an idea how to improve that damn graph :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 02, 2010 2:36 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Your statements are quite correct for 087. That's why I made up my mind to implement it hopefully correct for 088.
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: Discussion: Graphing MAX of MAX vs. MAX of AVERAGE
PostPosted: Fri Sep 14, 2012 12:34 pm 
Offline
Cacti User

Joined: Thu Apr 10, 2008 6:52 pm
Posts: 141
this thread helped me a lot! Thank you.


Top
 Profile  
 
 Post subject: Re:
PostPosted: Fri Sep 14, 2012 1:54 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
gandalf wrote:
Your statements are quite correct for 087. That's why I made up my mind to implement it hopefully correct for 088.
R.

I have to update: code is in for current branch named 089
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group