After switching my NAS box to Ubuntu Server I decided I wanted a way of monitoring the system remotely from a browser. Previously I had used MRTG but being short on time wanted something more “plug and play”. The box only has 512MB memory so resource usage is important.

The solution I chose is a combination of Collectd, Lighttpd and Collectd Graph Panel. Collectd has low resource usage out of the box and with a few tweaks can be even better. Separating data collection and graph generation means I can easily change the frontend in the future if required.

How to install and configure:

sudo apt-get install collectd
sudo service collectd start

sudo apt-get install lighttpd php5-cgi php5
sudo service lighttpd start

Enable cgi and php in Lighttpd:

sudo lighty-enable-mod fastcgi fastcgi-php
sudo service lighttpd force-reload

Install Collectd Graph Panel:

cd /var/www/
git clone https://github.com/pommi/CGP.git

Graphs should now be available at http://hostname/CGP/

To reduce CPU usage on the server you may want to enable client side rendering:

sudo nano /var/www/CGP/conf/config.php

Find the line:

$CONFIG['graph_type'] = 'png';

and change it to:

$CONFIG['graph_type'] = 'canvas';

This gives nice mouse scrollable/zoomable graphs but doesn’t work so well on mobile devices. Also there are other useful options there like page autorefresh and graph size you can configure.

Collectd has many plugins available. The configuration file is /etc/collectd/collectd.conf Enabling caching in the rrdtool plugin will reduce cpu and disk usage, at a cost of memory (and data will be slightly delayed): `

DataDir "/var/lib/collectd/rrd" CacheTimeout 300 CacheFlush 900

` Restart collectd after editing collectd.conf:

sudo service collectd restart

The final result:

CGP screenshot