Monitor OpenBSD using Collectd and Facette

Imil wrote as nice 5 minutes collectd + facette setup article using NetBSD. After a quick look in the ports, I saw it was possible to monitor OpenBSD using Collectd and Facette too. Hang tight, it only takes seconds to achieve.

Grab the metrics using Collectd

# pkg_add collectd-rrdtool collectd-mysql

# vi /etc/collectd.conf
(...)
BaseDir "/var/collectd"
PIDFile "/var/collectd/collectd.pid"
TypesDB "/usr/local/share/collectd/types.db"

# rcctl enable collectd
# rcctl start collectd

Render the metrics using Facette

# pkg_add facette

# vi /etc/facette/facette.json
{
  "bind": "127.0.0.1:12003",
(...)

# vi /etc/facette/providers/collectd.json
{
  "connector": {
    "type": "rrd",
    "path": "/var/collectd/rrd",
    "pattern": "(?P<source>[^/]+)/(?P<metric>.+).rrd"
  },
(...)

# rcctl enable facette
# rcctl start facette

Wait a few minutes and browse the GUI.

6 thoughts on “Monitor OpenBSD using Collectd and Facette”

  1. I end up with a rrd data dir called /var/collectd/rrd/Not Set containing all my .rrd files and plugin directories.
    My collectd.conf looks like:
    BaseDir “/var/collectd”
    PIDFile “/var/collectd/collectd.pid”
    #PluginDir “${exec_prefix}/lib/collectd”
    PluginDir “/usr/local/lib/collectd”
    TypesDB “/usr/local/share/collectd/types.db”
    Why is “Not Set” being created?

  2. bash-4.4# pwd
    /var/collectd/rrd/Not Set
    ls -la
    total 68
    drwxr-xr-x 17 root _collectd 512 Mar 4 00:38 .
    drwxr-xr-x 3 root _collectd 512 Mar 4 00:38 ..
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 collectd-cache
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 collectd-write_queue
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 cpu-0
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 disk-cd0
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 disk-wd0
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 interface-em0
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 interface-fxp0
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 load
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 memory
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 ping
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 processes
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 processes-name
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 swap
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 uptime
    drwxr-xr-x 2 root _collectd 512 Mar 4 00:38 users

  3. It seems the package has been compiled to expect /var/lib which did not exist in OpenBSD 6.2.
    mkdir /var/lib then reinstall collectd and voila, the “Not Set/” problem goes away.
    Now Facette can see Origins, Sources and Metrics even without me adjusting the paths in /etc/facette/providers/collectd.json.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.