Monitoring OpenBSD using CollectD, InfluxDB and Grafana

In a “get pretty graphs” mood, I’m looking at what can be done regarding OpenBSD monitoring using the CollectD collector and Grafana dashboard renderer. OpenBSD 6.2-current provides InfluxDB and Grafana packages. A great stack for pretty reportings.

Host the data

System metrics will be stored in InfluxDB ; because it can be used as a Grafana source. The installation and configuration is straight-forward. The key thing is to enable the collectd protocol.

# pkg_add influxdb
# vi /etc/influxdb/influxdb.conf
  enabled = true
  bind-address = ":25826"
  database = "collectd"
  retention-policy = ""
  typesdb = "/usr/local/share/collectd"

# rcctl enable influxdb
# rcctl start influxdb

Note that this service works using UDP only. Unless I missed something, at the time of writing, there is no TCP nor TLS available options.

# netstat -na | grep 25826
udp 0 0 *.25826 *.*

Collect the data

I’m using CollectD as a metrics collector. Mostly because it knows about OpenBSD and is able to send its data remotely. In this case, to InfluxDB. Enable any required plugins. Don’t forget the network one so that data are send to InfluxDB.

# pkg_add collectd
# vi /etc/collectd.conf
<Plugin network>
  <Server "" "25826">
  ReportStats true

# rcctl enable collectd
# rcctl start collectd

Render the data

New in OpenBSD 6.2-current : Grafana is available as a binary package. This will enable pretty graphing using my prefered OS.

# pkg_add grafana
# vi /etc/grafana/config.ini

# rcctl enable grafana
# rcctl start grafana

Browse to http://localhost:3000/ and log in using the default credentials (admin:admin). Those can be changed this way and from the GUI.

In Grafana, add the InfluxDB source using the collectd database.

There are example dashboards available from Grafana’s website. Namely #554, #555 and #755. They will nearly work out-of-the-box and can be used as a base to create yours. They seem to be Linux-centric but here’s how they look, once slighty modified for OpenBSD.

I’ve created one from scratch to render default collect data from my OpenBSD servers. It looks like this :

Should you want to use it, I have made it available online here.

That’s All Folks!

Author: Joel Carnat

@work Technical Architect and SysAdmin ; @home OpenBSD and FOSS, Karate, Kobudō, Jōdō, Bodyweight workout, Photography & Music

13 thoughts on “Monitoring OpenBSD using CollectD, InfluxDB and Grafana”

  1. Hi,

    Thanks for sharing this post.
    I’ve a question about collectd – can you share your ‘collectd.conf’ file or tell us which plugins you have enabled as a minimum? Thanks!

    Best wishes,

    1. Hi,
      I’m using what’s in the default /usr/local/share/examples/collectd.conf.
      Nothing magical. Simply uncomment what you need.
      The plugins I used where: syslog, apache, cpu, curl, curl_json, df, disk, exec, interface, load, memory, network, mysql, pf, processes, swap, tcpconns, uptime, users

    1. Hi,
      it should still be valid. Nothing changed that much regarding Collectd I believe. Unfortunately, I’ve switched to using Telegraf, now that I could compile it. So my 6.4 doesn’t run this Collectd configuration. I won’t be able to check.
      You should check the data using `influx`. Then, depending on how much data you have, changing TimeRand and/or Interval may make things appear.

  2. Joel, just for the record, I see such a picture in my setup now, like:
    The data using is `influxdb`, if you are talking about data sources setup, changing TimeRang and/or Interval don’t change things up. And also, some digital values are displayed incorrectly (not true, e.g. memory, uptime, disk (storage), etc.)..

    Thank you once more.

  3. Hey, do you know if it’s compatible with Ubuntu?
    I tried to use your dashboard in my Grafana configuration, and I don’t have any data displayed. I get “no data points” and a red exclamation mark with a message “error parsing query”. However I do data if I use 554.

      1. Like other posters – I have an empty InfluxDB and N/A graphs on a standard 6.4 install.

        The installed collectd, influxdb and grafana all running. No data appears to be stored in InfluxDB. Grafana works but shows no data.

        collectd plugins are:
        # egrep ‘^LoadPlugin’ /etc/collectd.conf | sort
        LoadPlugin cpu
        LoadPlugin df
        LoadPlugin disk
        LoadPlugin dns
        LoadPlugin interface
        LoadPlugin load
        LoadPlugin memory
        LoadPlugin network
        LoadPlugin ntpd
        LoadPlugin processes
        LoadPlugin swap
        LoadPlugin syslog
        LoadPlugin unixsock
        LoadPlugin uptime
        LoadPlugin users

        How do you configure collectd to collect data to send to InfluxDB?

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.