Hi,
I'm still getting to grips with cacti. One thing that would be useful for certain datasets would be to graph the difference between the data and what it's supposed to be and/or the long-term average. Examples:
Fan sensors & voltage sensors:
http://www.insaneoc.com/graphs/graph_370.html
http://www.insaneoc.com/graphs/graph_372.html
I've tried two different approaches to getting the effect I wanted. One, the simplest, is with the voltage sensors:
http://www.insaneoc.com/graphs/graph_408.html
For this effect, I've simply made up a bunch of CDEFs that subtract the respective nominal voltages (and reverse the negative ones after, so that undervoltage is always graphed as under 0).
That's fine for one graph, but terribly labour intensive.
The other one I tried first was this:
http://www.insaneoc.com/graphs/graph_405.html
simply making a cdef that subtracted the 30min trendline. There are two problems with this, though:
* the 30min trendline doesn't start until 30 minutes into the start of the graph, even when the dataset (as for the first RRA) is 5 or 6 hours long. This suggests it won't be using any of the before-graph data let alone the data from the other RRAs.
* comparing to a 30 min trend will get you short-term variations only, if the fan were to, say, slowly spin down over a long time, you wouldn't know it.
Alleviating the second problem requires using a longer term trendline to compare against, which is longer than most problems would appear in. But this makes the second problem much, much worse.
How *can* I do what I want? Basically I guess I want a variable for a single value that represents the longest term average I can get for a given dataset, say a week or month or so [1], and which can be used as a value in a CDEF across all the graphs.
[1] so a drastic change coming from, say, hardware changes, doesn't make the data unusable for *too* long.
Graphing the difference to the long-time average
Moderators: Developers, Moderators
Okay, I've figured it out.
It requires two CDEFs, which are slightly hacky.
Firstly:
Make average, stick in avgCURRENT_DATA_SOURCE Note: all of that is in one custom-string.
Secondly (and a lot less hacky):
graph diff with avgCURRENT_DATA_SOURCE
Then for every line you want this to do, insert one COMMENT item with CDEF 1, and one LINE item with CDEF 2. Make sure the COMMENT is *before* the LINE.
The comment and its CDEF are essentially irrelevant, except that you sneakily add a VDEF in the rear (which acts on the entire dataset instead of single points and produces a single value from that).
Resulting RRD command, for example:
Resulting graphs are in, among others,
http://www.insaneoc.com/graphs/graph_413.html
http://www.insaneoc.com/graphs/graph_415.html
It requires two CDEFs, which are slightly hacky.
Firstly:
Make average, stick in avgCURRENT_DATA_SOURCE
Code: Select all
Item #1 Custom String: CURRENT_DATA_SOURCE VDEF:avgCURRENT_DATA_SOURCE=CURRENT_DATA_SOURCE,AVERAGE
Secondly (and a lot less hacky):
graph diff with avgCURRENT_DATA_SOURCE
Code: Select all
Item #1 Special Data Source: CURRENT_DATA_SOURCE
Item #2 Custom String: avgCURRENT_DATA_SOURCE
Item #3 Operator: -
The comment and its CDEF are essentially irrelevant, except that you sneakily add a VDEF in the rear (which acts on the entire dataset instead of single points and produces a single value from that).
Resulting RRD command, for example:
Code: Select all
DEF:a="/var/lib/cacti/rra/localhost_sensorreading_348.rrd":sensorReading:MAX \
DEF:b="/var/lib/cacti/rra/localhost_sensorreading_348.rrd":sensorReading:AVERAGE \
DEF:c="/var/lib/cacti/rra/localhost_sensorreading_347.rrd":sensorReading:MAX \
DEF:d="/var/lib/cacti/rra/localhost_sensorreading_347.rrd":sensorReading:AVERAGE \
DEF:e="/var/lib/cacti/rra/localhost_sensorreading_349.rrd":sensorReading:MAX \
DEF:f="/var/lib/cacti/rra/localhost_sensorreading_349.rrd":sensorReading:AVERAGE \
CDEF:cdefa=b VDEF:avgb=b,AVERAGE \
CDEF:cdefb=b,avgb,- \
CDEF:cdefg=d VDEF:avgd=d,AVERAGE \
CDEF:cdefh=d,avgd,- \
CDEF:cdefbc=f VDEF:avgf=f,AVERAGE \
CDEF:cdefbd=f,avgf,- \
\
LINE2:cdefb#00FF00FF:"Chassis" \
GPRINT:b:LAST:" Current\:%8.2lf%s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf%s" \
GPRINT:b:MIN:"Minimum\:%8.2lf%s" \
GPRINT:a:MAX:"Maximum\:%8.2lf%s\n" \
\
LINE2:cdefh#FF0000FF:"CPU Fan" \
GPRINT:d:LAST:" Current\:%8.2lf%s" \
GPRINT:d:AVERAGE:"Average\:%8.2lf%s" \
GPRINT:d:MIN:"Minimum\:%8.2lf%s" \
GPRINT:c:MAX:"Maximum\:%8.2lf%s\n" \
\
LINE3:cdefbd#8D85F3FF:"Power Fan" \
GPRINT:f:LAST:"Current\:%8.2lf%s" \
GPRINT:f:AVERAGE:"Average\:%8.2lf%s" \
GPRINT:f:MIN:"Minimum\:%8.2lf%s" \
GPRINT:e:MAX:"Maximum\:%8.2lf%s\n"
http://www.insaneoc.com/graphs/graph_413.html
http://www.insaneoc.com/graphs/graph_415.html
Who is online
Users browsing this forum: No registered users and 0 guests