OpenBSD rc.d(8) Health Check

Monitoring check plugin for OpenBSD's rc.d(8) to be used by Icinga, Nagios and the like.

This check is querying the general service health and is going critical for crashed services. It is not there for specific service monitoring, but furthermore to be alert when something managed by rc.d(8) has failed. Think about it as another safe guard to monitor those services you might forget otherwise.


Trivial OpenBSD rc.d monitoring for failed and rogue services

  -h Print this help
  -v Be verbose, print debug output
  -b Become method to execute rcctl(8) as root (default doas)

As the script need to execute some privileged rcctl commands, it has a -b flag to run those commands prefixed with a become command, defaulting to doas. However, this can be changed to anything else, e.g., sudo or something totally different. When setting -b '' (empty string), no become command will be prefixed, expecting that the check command will be run by the root user.

When using doas as the become command, a doas.conf entry is necessary:

permit nopass _icinga as root cmd /usr/sbin/rcctl args ls failed
permit nopass _icinga as root cmd /usr/sbin/rcctl args ls rogue


The check should only work on OpenBSD. Unfortunately, both FreeBSD's and NetBSD's rc.d(8) differ too much and they don't contain rcctl(8).

Icinga 2 Integration

The icinag2_check_command.conf file contains a CheckCommand for Icinga 2. After being included, it can be used by a Service object like the following:

apply Service "rc.d services" {
  import "generic-service"

  check_command = "openbsd_rcd"

  assign where host.vars.os == "OpenBSD"