Skip to content

OpenBSD Configuration

Distro

Install wget or curl command and install the distro script as described here: Distro script.

SNMPd

SNMPd limitation

Note, OpenBSD includes a snmpd daemon by default, which provides basic information in SNMP and some sensors. It does not allow extending SNMP with hardware/vendor information, accurate time, or distro information. We recommend using the net-snmp package instead.

This must be placed in /etc/snmpd.conf and will provide the required parameters for Observium. This example uses version 2c SNMP authentication.

Community string

Remember to replace community_string with your unique community string.

# Default listens on all addresses for SNMPv3 only; "listen on" overrides this
# See snmpd.conf(5) for more options (tcp, alternative ports, trap listener)
#listen on 192.0.2.1                    # SNMPv3 on one specific address
#listen on 0.0.0.0 snmpv2c snmpv3       # All IPv4 addresses, both v2c + v3
#listen on :: snmpv2c snmpv3            # All IPv6 addresses, both v2c + v3
#listen on 127.0.0.1 snmpv2c            # IPv4 localhost only, v2c
listen on 0.0.0.0 snmpv2c

# Define a RO community if you use SNMPv2c (there is no default)
read-only community community_string

# At least one user must be defined to use SNMPv3
#user "user1" auth hmac-sha1 authkey "password123" enc aes enckey "321drowssap"
#user "user2" auth hmac-sha256 authkey "password456" enc aes enckey "654drowssap"

# Send traps from snmpd(8) to one or more receivers
#trap receiver nms.localdomain.local community PAV9kpE02gDPvAi source-address 192.0.2.1

# Adjust the local system information
system contact "Contact Person <your@email.address>"
system location "Rack/Room/Building, Street, City, Country [GPSX,Y]"

# Required by some management software
system services 74

Check config and enable service:

    /etc/rc.d/snmpd configtest

    echo "snmpd_flags=" >> /etc/rc.conf.local

    /etc/rc.d/snmpd start

NET-SNMP

If you previously enabled the default OpenBSD snmpd, disable it first:

    /etc/rc.d/snmpd stop

Comment out or remove snmpd flags from /etc/rc.conf.local:

    sed -i -e 's/snmpd_flags/#snmpd_flags/' /etc/rc.conf.local

Install and configure

    pkg_add net-snmp

Now configure the daemon and start it. The configuration is mostly the same as for Linux, except for hardware and uptime extensions.

#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161

#  Full view access
view   all         included   .1

#  Default access to full view
rocommunity community_string  default    -V all

#  System contact and location
syslocation Rack/Room/Building, Street, City, Country [GPSX,Y]
syscontact Contact Person <your@email.address>

#  Disk Monitoring
includeAllDisks  10%

# This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro   /usr/local/bin/distro

# This lines allows Observium to detect hardware, vendor and serial
extend .1.3.6.1.4.1.2021.7890.2 hardware /sbin/sysctl -n hw.product
extend .1.3.6.1.4.1.2021.7890.3 vendor   /sbin/sysctl -n hw.vendor
extend .1.3.6.1.4.1.2021.7890.4 serial   /sbin/sysctl -n hw.serialno

# This line allows Observium to collect an accurate uptime
extend boottime /sbin/sysctl -n kern.boottime

Check and start daemon:

    /etc/rc.d/netsnmpd start
    rcctl enable netsnmpd

Accurate Uptime

The pre-existing uptime values available via Net-SNMP are either inaccurate or will wrap after 1.5 years. To work around this, we check for an entry in net-snmp's extend table for a custom boottime value.

Add this to /etc/snmp/snmpd.conf of the device being monitored and restart snmpd:

extend boottime /sbin/sysctl -n kern.boottime

FreeBSD

Install Observium

FreeBSD installation

Note, we recommend using Ubuntu/Debian Linux operating system for main Observium installations. Use FreeBSD installations at your own risk, as we do not support them.

You can find instructions for installing Observium on FreeBSD here.

Distro

Install wget or curl command and install the distro script as described here: Distro script.

NET-SNMP

FreeBSD comes with its own SNMP server bsnmpd, but the more common net-snmp package is better supported and offers some extension features we will use.

Install and configure

    pkg install net-snmp

Create the file /usr/local/etc/snmpd.conf with this content:

#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161

#  Full view access
view   all         included   .1

#  Default access to full view
rocommunity community_string  default    -V all

#  System contact and location
syslocation Rack/Room/Building, Street, City, Country [GPSX,Y]
syscontact Contact Person <your@email.address>

#  Disk Monitoring
includeAllDisks  10%

# http://oid-info.com/get/1.3.6.1.2.1.1.7
sysServices     72

# This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro     /usr/local/bin/distro

# This lines allows Observium to detect hardware, vendor and serial
extend .1.3.6.1.4.1.2021.7890.2 hardware   /bin/kenv smbios.planar.product
extend .1.3.6.1.4.1.2021.7890.3 vendor     /bin/kenv smbios.planar.maker
extend .1.3.6.1.4.1.2021.7890.4 serial     /bin/kenv smbios.planar.serial

Enable and start net-snmpd

    sysrc snmpd_enable=YES
    echo 'snmpd_conffile="/usr/local/etc/snmpd.conf"' >/etc/rc.conf.d/snmpd
    service snmpd start

Raspberry Pi

For a Raspberry Pi running FreeBSD, follow the FreeBSD section above but in /usr/local/etc/snmpd.conf replace the four extend lines with these three instead:

(There is no useful "vendor" information to be gathered from the device itself)

extend          .1.3.6.1.4.1.2021.7890.1 distro     /usr/local/sbin/distro
extend          .1.3.6.1.4.1.2021.7890.2 hardware   /sbin/sysctl -n hw.fdt.model
extend          .1.3.6.1.4.1.2021.7890.4 serial     /sbin/sysctl -n hw.fdt.serial-number