5 minutes collectd + facette setup

I recently added a fantastic graphing tool named facette to pkgsrc. Facette knows how to pull data sources from various backends, and among them, the famous collectd.

In this article, we will see how to setup both on NetBSD but keep in mind it should also work for any platform supported by pkgsrc.

First up, collectd installation. It can be done either with pkgin (binary installation) or pkgsrc (source installation):

  • with pkgin
$ sudo pkgin in collectd collectd-rrdtool
  • with pkgsrc
 $ cd /usr/pkgsrc/sysutils/collectd
 $ sudo make install clean
 $ cd ../collectd-rrdtool
 $ sudo make install clean

Tune up a minimal collectd configuration

Hostname    "myname"
BaseDir     "/var/db/collectd"
PIDFile     "/var/run/collectd.pid"
PluginDir   "/usr/pkg/lib/collectd"
LoadPlugin syslog
LoadPlugin cpu
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin rrdcached
LoadPlugin rrdtool
<Plugin rrdtool>
        DataDir "/var/db/collectd/rrd"
        CreateFilesAsync false
        CacheTimeout 120
        CacheFlush   900
        WritesPerSecond 50

Enable and start collectd

 # echo "collectd=YES" >> /etc/rc.conf
 # /etc/rc.d/collectd start

Wait a couple of minutes for collectd to actually collect some datas, you should see them appear in /var/db/collectd/rrd.

As I write these lines, facette is not yet available as a binary package, it will probably be available in the next pkgsrc release, so we’ll have to install it using pkgsrc

 $ cd /usr/pkgsrc/sysutils/facette
 $ sudo make install clean
 $ sudo -s
 # echo "facette=YES" >> /etc/rc.conf
 # /etc/rc.d/facette start

That’s right, no configuration, I’ve setup the package so it is working out-of-the-box with a basic collectd installation.

If everything went well, you should be admiring a facette console by connecting with your web browser to the port 12003