Syed Jahanzaib Personal Blog to Share Knowledge !

December 8, 2016

Plotting Negative Value in rrdtool graph

Filed under: Linux Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 3:30 PM

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.

negative tempr.PNG


Regard’s
Syed Jahanzaib

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: