[rrd-users] how to graph running total?
Alex van den Bogaerdt
alex at vandenbogaerdt.nl
Fri Apr 23 01:06:10 CEST 2010
----- Original Message -----
From: "Aleksey Tsalolikhin" <atsaloli.tech at gmail.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Thursday, April 22, 2010 11:08 PM
Subject: [rrd-users] how to graph running total?
> Hi, I am new to RRDTool. Need some help making a running total graph,
> please.
>
> I am graphing a widget factory's production using RRDtool 1.2.27
>
> What I have working: widgets made per minute, I query this out of the
> factory DB
> every minute, and store as a GAUGE in an RRD. I graph it on daily and
> weekly graphs.
>
> Now management wants another graph, showing how many widgets were made
> (running
> totals) for today and for the week. (This should be a monotonically
> increasing graph.)
Make sure all timestamps used are 'on a boundary', meaning they are an
integer number of step size * steps per row.
> How do I do this?
An increasing graph is made using the amount of widgets made, in a GAUGE.
You can take that from the factory db, so the first part is easy.
Now you want to start at zero instead of some number. That's not so hard as
it seems either. It is a two stage process.
First fire up rrdtool graph and ask for the last 'rate' at your start time.
PRINT (not: GPRINT) it.
Alternatively use rrdtool fetch.
Make sure to ask for the rate at the start of what you're interested in.
That means: --end {your start time here}
The script you use to call rrdtool collects its output and sets a variable
from that output.
However you do it, find the amount of widgets made at the start of the day,
week, whatever.
Now run rrdtool a 2nd time, using the variable to generate a CDEF line
similar to this:
CDEF:adjusted_widgets=widgets,12345,-
And then just LINE1:adjusted_widgets#color:legend
Your script has a variable in which it collected the value 12345. RRDtool
doesn't know about that variable, all it ever sees is 12345.
The effect is that your staircase does not start at 12345 and end at 12545.
Instead it will start at 0 and end at 200. That is what you want, right?
More information about the rrd-users
mailing list