We are exploring capturing local laptop metrics as research for applying collectd recordings on our server (so we can get weekly emails).
The rrdtool
syntax is non-obvious but we are making progress.
The apt
package for collectd
collects information into a few buckets (e.g. 10 second average, 50 second average, etc). We can see this information at a high level via rrdtool info
:
rrdtool info /var/lib/collectd/rrd/Euclid/battery-0/charge.rrd
# step = 10
# last_update = 1454486292
rra[0].cf = "AVERAGE"
rra[0].rows = 1200
rra[0].cur_row = 246
rra[0].pdp_per_row = 1 # second per group
rra[0].xff = 1.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
# ...
rra[3].pdp_per_row = 7 # seconds per group
It's plausible to receive a NaN
value for a row. This is due to missed data.
To view a dump of data in an XML format, use:
rrdtool dump /var/lib/collectd/rrd/Euclid/battery-0/charge.rrd
To draw a graph, we need to specify a variable and then a line to draw said variable.
Reference link: http://mailman.verplant.org/pipermail/collectd/2011-April/004470.html
Here is an example graph:
rrdtool graph output.png --start=1454485842 --end=1454485942 \
DEF:a=/var/lib/collectd/rrd/Euclid/entropy/entropy.rrd:value:AVERAGE \
LINE2:a#FF000
We can also use relative timings (e.g. -120
for 120 seconds ago):
rrdtool graph output.png --start=-120 --end=-0 \
DEF:a=/var/lib/collectd/rrd/Euclid/entropy/entropy.rrd:value:AVERAGE \
LINE2:a#FF000
The DEF's value (i.e. excluding a=
which sets name of graph variable) has 3 parts:
/var/lib/collectd/rrd/Euclid/entropy/entropy.rrd:value:AVERAGE
/var/lib/collectd/rrd/Euclid/entropy/entropy.rrd
is the source filevalue
is the key used fords
- When using
rrdtool info
we can seeds[value].index
at the top - For metrics like disk, this can be
ds[read]
andds[write]
which are 2 separate metrics would be:read:AVERAGE
and:write:AVERAGE
in a graph- To view all possible variations provided by
collectd
, look at thetypes.db
(set in/etc/collectd/collectd.conf
viaTypesDB
) - For example,
cat /usr/share/collectd/types.db
- To view all possible variations provided by
- When using
AVERAGE
is the metric we want to view, we typically haveMIN
,MAX
, andAVERAGE
set but they will be visible ininfo
as well
We aren't currently sure how to change the step used during graphing.
Thanks for sharing this!
A small nitpick: the shared above commands produce empty graphs for me with RRDtool 1.7.2 due to missing last character of the color specification, instead of:
should be one more zero zero at the end of
FF000
for red color: