Messing with PERL when setting up Collectd-web

After a fresh installation of Gentoo I have decided to use Collectd to monitor my system status, so I have emerged it as stated in Gentoo wiki page, than I have also emerged Collectd-web which is a great frontend for Collectd. Here my problems started 🙂

Collectd-web was working (interface was present) but it displayed no graphs, after checking apache error_log I have found this:

[Tue Nov 15 22:35:24 2011] [error] [client *.*.*.*] [Tue Nov 15 22:35:24 2011] collection.modified.cgi: Can't locate HTML/Entities.pm in @INC (@INC contains: /etc/perl /usr/lib64/perl5/site_perl/5.12.4/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.12.4 /usr/lib64/perl5/vendor_perl/5.12.4/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.12.4 /usr/lib64/perl5/site_perl /usr/lib64/perl5/vendor_perl /usr/lib64/perl5/5.12.4/x86_64-linux-thread-multi /usr/lib64/perl5/5.12.4 /usr/local/lib/site_perl .) at /var/www/localhost/htdocs/collectd-web/cgi-bin/collection.modified.cgi line 25., referer: [my_host_name]

First spot was to emerge PERL again – no effect…

Than I have started searching over the Internet. First good tool was perl-cleaner, I had run:

perl-cleaner --all

which emerged all missing libraries and deleted those not used. After that I have found that I am still missing some modules i.e. URI::Escape, searching around lead me to this site:
http://forums.slimdevices.com/archive/index.php/t-16975.html
so I run

cpan URI::Escape

and that was all I needed to start Collectd-web displaying data properly

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

A place where you can find some info about struggling Gentoo Linux, photography, mountain biking and others