Recently I was configuring an mrtg/rrd graph Where I had to display negative value as well along with others, but as per my findings mrtg/rrd graph doesn’t allow plotting Negative value. Let’s say we want to plot the temperature where we get both plus and negative values at different time of the day/night.
To do so, we have to tune the required rrd file to allow such storing.
Example: we have test.rrd file.
First get info by rrdtool
rrdtool info test.rrd |grep ds
you may see following
rrdtool info test.rrd |grep ds ds[ds0].index = 0 ds[ds0].type = "GAUGE" ds[ds0].minimal_heartbeat = 600 ds[ds0].min = 0.0000000000e+00 ds[ds0].max = 1.0000000000e+02 ds[ds0].last_ds = "0" ds[ds0].value = 0.0000000000e+00 ds[ds0].unknown_sec = 0 ds[ds1].index = 1 ds[ds1].type = "GAUGE" ds[ds1].minimal_heartbeat = 600 ds[ds1].min = 0.0000000000e+00 ds[ds1].max = 1.0000000000e+02 ds[ds1].last_ds = "0" ds[ds1].value = 0.0000000000e+00 ds[ds1].unknown_sec = 0
now modify it by
rrdtool tune test.rrd --minimum ds0:-100
Now query rrdtool info again
rrdtool info test.rrd |grep ds ds[ds0].index = 0 ds[ds0].type = "GAUGE" ds[ds0].minimal_heartbeat = 600 ds[ds0].min = -1.0000000000e+02 ds[ds0].max = 1.0000000000e+02 ds[ds0].last_ds = "0" ds[ds0].value = 0.0000000000e+00 ds[ds0].unknown_sec = 0 ds[ds1].index = 1 ds[ds1].type = "GAUGE" ds[ds1].minimal_heartbeat = 600 ds[ds1].min = 0.0000000000e+00 ds[ds1].max = 1.0000000000e+02 ds[ds1].last_ds = "0" ds[ds1].value = 0.0000000000e+00 ds[ds1].unknown_sec = 0
You will see the difference in ds[ds0].min value. Now we are good to go with negative plotting.
An example on how to plot negative values.
Regard’s
Syed Jahanzaib
Leave a Reply