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!

7 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.

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.