Ganglia – rrd remove negative spikes


By using rrdtool tune we can remove negative spikes from any rrd(round robin database).


$ rrdtool tune <RRD_FileName> --minimum ds-name:min

where, ds-name is the name you will use to reference this particular data source from an RRD.

min is minimum value, if we set minimum value of zero, it prevents negative rates.

In this example I am using test.rrd as my input rrd file.

To get ds-name first extract rrd file and with following command:

$ rrdtool dump test.rrd

Now look for following block in extracted data:

<name> sum </name>
<type> GAUGE </type>

<!– PDP Status –>
<unknown_sec> 0 </unknown_sec>

In above output value between <name> and </name> is ds-name, so in above example sum is ds-name.

To remove negative run following commands:

#Set minimum value
$ rrdtool tune test.rrd --minimum sum:0
#Save new rrd
$ rrdtool dump test.rrd | rrdtool restore --range-check - test.rrd-fix
#Replace old rrd with new rrd
$ mv test.rrd-fix test.rrd

After running above 3 commands you wont see any negative values test.rrd

If the rrd is ganglia’s rrd you need to change permissions of rrd otherwise due to permissions new data won’t get updated to this rrd.

Use following command to change rrd permission:

$ chown nobody:root test.rrd

Leave a Reply

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

You are commenting using your 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