Configuring Collectd-web for collectd on CentOS 6

If you have tried to get collectd-web running and were presented with the nice graphs without having to mess around for hours, you are lucky. It never ‘just works’ for me…

collectd-webAfter installing collectd and making sure the rrd files were being updated, I ‘installed’ collectd-web. This just involves getting the files from git.

I copied the files to a directory under apache (/var/www/collectd-web), then in the apache config file, made that the root, modified the cgi-bin directory to point to the one in the collectd-web folder. Restarted apache, started the collectd python server (You don’t need this if you are running under apache, but that isn’t obvious from the instructions) and loaded the collectd page which gave me a few menus and not much content.

First off it took me a while to discover that you need to create a config file called ‘collection.conf’ in ‘/etc/collectd’ and in that file, you tell collectd-web where your collectd rrd files are located with the ‘DataDir:’ directive. In a default collectd install on Centos 6 the rrd files are located in ‘/var/lib/collectd/rrd/” under a directory named the same as the host. So within the collection.conf file you have this:

DataDir: "/var/lib/collectd/rrd/"

Collectd-web then lists ‘hosts’ (in its WeUI) for every directory under this one. So if you have a directory called ‘host1’ then you will see a host listed in the WebUI called ‘host1’.

Clicking on the host shows the available ‘plugins’ but clicking on them, I still wasn’t seeing graphs…

Eventually I tracked down an error in the apache error logs.

Can't locate RRDs.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /var/www/collectd-web/cgi-bin/collection.modified.cgi

A quick google for “Can’t locate RRDs.pm” suggest that ‘librrds-perl’ is missing, however on Centos,

yum install perl-rrdtool

fixed the problem.

After refreshing the page I still don’t see graphs – clicking the host and then a plugin finally showed some graphs!