Ganglia – rrd remove negative spikes

 

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

Syntax:

$ 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:

<ds>
<name> sum </name>
<type> GAUGE </type>
<minimal_heartbeat>240</minimal_heartbeat>
<min>NaN</min>
<max>NaN</max>

<!– PDP Status –>
<last_ds>0.600769042969</last_ds>
<value>0.0000000000e+00</value>
<unknown_sec> 0 </unknown_sec>
</ds>

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 (127.0.0.1:8652): 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 (127.0.0.1:8652): 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.

-Sany