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

Ganglia – error collecting data ( fsockopen error: Connection refused

Recently after rebooting ganglia server and while accessing ganglia-webfrontend I got following error.

There was an error collecting ganglia data ( fsockopen error: Connection refused.

Until reboot ganglia is working without any issue.

While debugging this issue the reason I got to know is there some problem with ownership permissions to /var/lib/ganglia/rrds.

There are wrong owner and group is set for directory /var/lib/ganglia/rrds.

/var/lib/ganglia/rrds directory following user and group permissions are needed:

User: nobody

Group: root

Use following command to set above permissions

$ chown -R nobody:root /var/lib/ganglia/rrds

After updating the permissions I am able to access ganglia-webfrontend without any issue.