Collectd could not find plugin rrdtool

This is an annoying gotcha that I keep meaning to document. When installing collectd and rrdtool via yum on Centos 6/7, I always miss out the rrdtool lib. This manifests as

Starting collectd: Could not find plugin rrdtool.

when restarting the services.
Thankfully it is easy to fix. Run

yum install collectd-rrdtool

and restart the collectd service and it should start without complaint.

Collectd-web and hostnames?

In my previous post I asserted that collectd-web would display hostnames based on the directory created by collectd to store the rrd files, but that doesn’t appear to be true.

After staging a server and installing collectd & collectd-web and getting that and everything else I needed working, I changed its hostname as it was replacing an existing server.

Collectd-web now displays host entries for the old temporary hostname and the new one but I don’t know where collectd-web is getting or even storing those hostnames.

If I figure out how to remove the redundant hostnames i’ll update this post.

Update: Looks like I was right, but I didn’t bother to check the directory. Collectd is creating the directories based on the hostname. For each change of hostname (and after restarting collectd) collectd created a new set of RRD files in a new directory that reflects the change of hostname.

In the default collectd dir I see something like:




So that is where collectd-web is getting its hostnames from. Remove the ones you don’t want (Note: You will lose any rrd data collected under those hostnames) and the hostnames will vanish from collectd-web. Easy!

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 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” 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!


Programming one USBasp with another USBasp

The lazy way to update the firmware on a USBasp without faffing with an Arduino Uno as a programmer and lots of jumper leads? Get another USBasp and use it to program the other one.

Instructions based on this blog post.

1) Plug both USBasp programmers together using the 10 way cable.

2) Short JP2 on the target USBasp (the one you want to update).

3) Plug the source USBasp into your computers USB port. Do NOT plug the target USBasp into a USB port!

4) In a terminal type

avrdude -c usbasp -p atmega8 -u -U hfuse:w:0xc9:m -U lfuse:w:0xef:m

to set the fuses. “-c usbasp” tells avrdude that you are using a USBasp as your programmer and “-p atmega8” tells avrdude that the target device (the other USBasp) is based on an Atmega8 microcontroller.

5) Then program the firmware (you can download the precompiled hex file from the blog post I mentioned earlier).

avrdude -c usbasp -p atmega8 -U flash:w:usbasp.atmega8.2011-05-28.hex

If everything worked you should be done. Disconnect everything, remove the jumper on JP2 and give the new firmware a spin burning bootloaders.

MSP430 POV kits

With the firmware nearly complete, I started bagging up the components to make some kits for one of the Make Bournemouth workshops.

This is what is in the through hole kit:


And this is the surface mount kit:IMG_20140930_204122

That gives me 8 through hole and 8 surface mount kits. (I Still need to source some more batteries for the surface mount kits).



Each kit comes with a CP2102 USB to serial adaptor to talk to the MSP430 microprocessor and upload text messages. Firmware programming will require a TI Launchpad board or TI MSP programmer.

MSP430 based POV

I’ve been working on the MSP430 based Persistence of Vision (POV) board for a while now. The original version was meant to be etched with DIY PCB kit, but the results were less than spectacular and I kinda gave up and never put a board together.

The current version (rev2) is a much nicer board but is meant to be manufactured professionally. This isn’t a big deal anymore as it is possible to get small runs of small boards made at a really good price. I used the iTead Studios PCB service and have been really impressed with the results.

IMG_20140728_214829Surface mount board (left) vs thru-hole board (right).

It has taken me a while to sort out the firmware. For a long while it has just been displaying a pacman style ghost and didn’t do anything else. It could only be programmed via a TI Launchpad, and I couldn’t upload a text message via serial.

IMG_20140723_005024Basic firmware – displaying Pacman style ghost

Right now the firmware is pretty much working how I had hoped. I can now upload an ASCII text message via serial and display that on the leds, store it in flash memory so it will be persistent when the device is powered off and powered back on. It still needs a bit of work to tidy things up, but it is about 80% of the way there.

Firmware is on

Check out the flash_memory branch – that is where all the interesting changes are taking place, but be warned, the code may not be in a working state.

Pi Cam – Web cam

Its been a while since I looked at the RaspberryPi camera. I had intended to turn it into a door bell that emailed me a still of whoever had just rung the door bell – or maybe even a mobile phone app that could display a live stream in near real time… and… I was also going to try using it to take time lapse video but… I just didn’t get round to it.

However, I had a pressing need to resurrect the Pi and its camera recently when our Springer pup damaged her cruciate  ligament and had, what in hindsight was, pretty major surgery. I wanted to be able to keep an eye on her remotely and also so my wife could check on her from work.


So with the raspistill command, the screen command and the Apache web server all running on the Pi, I had a quick and dirty web cam.

First off I blew away the old OS on the 16GB SD card and reinstalled Raspbian.

Updated with:

apt-get update; apt-get upgrade

Enabled the camera with:


Installed the apache webserver with:

apt-get install apache2

Installed screen with:

apt-get install screen

Started screen with:


Note: screen allows you to run multiple ssh sessions from a single ‘ssh terminal’, detach from the ‘ssh terminal’ (i.e. disconnect) while all the commands continue to run. You can then reconnect to the screen session at any time. Probably overkill for this, but was handy for testing…

Then in the screen session run:

raspistill -t 0 -vf -hf -tl 10000 -w 800 -h 600 -o /var/www/immi.jpg &

Which does the following:

raspistill   is the command to take a still picture with the raspberry pi camera.

-t 0   means don’t wait to take a picture. If I set this to 5 (which I think is the default if you don’t use the -t switch) then the software will wait 5 seconds before taking a picture. Note: the -tl switch (we’ll get to that shortly)  doesn’t work if you ommit the -t switch.

-vf   means vertical flip – so flip the image vertically. For some reason the images from my Pi cam are back to front so I have to use the -vf command.

-hf   means horitonal flip – flip the image horizontally. As the camera is upside down at the top of the cage, this switch flips the image the right way up.

-tl 10000   means operate in time lapse mode and take a picture every n milliseconds. In my case I don’t need rapid updates so I’m taking a picture every 10 seconds (or 10,000 milliseconds). Note: As mentioned above, the -tl switch is ignored if the -t 0 switch is omitted.

-w 800   means set the width of the picture to 800 pixels wide.

-h 600   means set the height of the picture to 600 pixels wide.

-o /var/www/immi.jpg   means write the output file to the /var/www directory and call it immi.jpg (Immi is the dogs name).

The ‘&’ allows the command to run in the background. If the ssh session that ran the command exits, then the command also exits, hence the use of the screen command.

Finally I added a really really basic web page into /var/www to load the image and refresh it every 10 seconds.

<head><meta http-equiv="refresh" content="10"; URL="></head>
<body><p>Immi cam. Poorly Immi :(</p>
<img src="immi.jpg">

The ‘meta http-equiv=”refresh” content=”10″; URL=”> line does the job of reloading the page every 10 seconds.

It isn’t pretty, but it does the job and only took an hour to setup.

And now I know how to do time lapse with the Pi cam, I don’t have an excuse for doing that next!