Making collectd ping plugin work in Collectd-web

After setting up Collectd and Collectd-web I have started looking for interesting plugins for them. One of them is definitely ping plugin, which is capable of monitoring your Internet connection constantly by simply sending a ping request to selected hosts, more about plugin can be fount on Collectd wiki page located here:

http://collectd.org/wiki/index.php/Plugin:Ping

After making plugin work (configuration is pretty simple, but don’t forget to run collectd as root – otherwise plugin is not gathering data) I wanted to view my results, unfortunately Collecd-web displayed no graphs for ping data. As I checked corresponding RRD files were updated as all other RRDs. Apache error_log stated:

[Sun Nov 06 16:27:06 2011] [error] [client 192.168.44.108] [Sun Nov 6 16:27:06 2011] collection.modified.cgi: RRDs::graph: No DS called 'ping' in '/var/lib/collectd/mnet-proliant/ping/ping-google.com.rrd' at /var/www/localhost/htdocs/collectd-web/cgi-bin/collection.modified.cgi line 838., referer: [my_host_name]

So I have manually converted RRD to XML to view what is in there by issuing command:

rrdtool dump ping-google.com.rrd > ping-google.com.xml (more on this here http://oss.oetiker.ch/rrdtool/doc/rrddump.en.html)

There I have found that Collectd is writing data not as ping but as value. So I have quickly applied corrections to collection.modified.cgi and graphdef.cgi where I have changed definition of ping RRD to:

ping => [
'DEF:ping_avg={file}:value:AVERAGE',
'DEF:ping_min={file}:value:MIN',
'DEF:ping_max={file}:value:MAX',
"AREA:ping_max#$HalfBlue",
"AREA:ping_min#$Canvas",
"LINE1:ping_avg#$FullBlue:Ping",
'GPRINT:ping_min:MIN:%4.1lf ms Min,',
'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
'GPRINT:ping_max:MAX:%4.1lf ms Max,',
'GPRINT:ping_avg:LAST:%4.1lf ms Last'
],

ping_droprate => [
'DEF:ping_avg={file}:value:AVERAGE',
'DEF:ping_min={file}:value:MIN',
'DEF:ping_max={file}:value:MAX',
"AREA:ping_max#$HalfBlue",
"AREA:ping_min#$Canvas",
"LINE1:ping_avg#$FullBlue:Drop rate",
'GPRINT:ping_min:MIN:%4.1lf Min,',
'GPRINT:ping_avg:AVERAGE:%4.1lf Avg,',
'GPRINT:ping_max:MAX:%4.1lf Max,',
'GPRINT:ping_avg:LAST:%4.1lf Last'
],

ping_stddev => [
'DEF:ping_avg={file}:value:AVERAGE',
'DEF:ping_min={file}:value:MIN',
'DEF:ping_max={file}:value:MAX',
"AREA:ping_max#$HalfBlue",
"AREA:ping_min#$Canvas",
"LINE1:ping_avg#$FullBlue:StDev",
'GPRINT:ping_min:MIN:%4.1lf ms Min,',
'GPRINT:ping_avg:AVERAGE:%4.1lf ms Avg,',
'GPRINT:ping_max:MAX:%4.1lf ms Max,',
'GPRINT:ping_avg:LAST:%4.1lf ms Last'
],

This resulted in correct display of ping statistics and also two others gathered by Collectd

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>