Net-SNMP in OpenBSD

Last modified: Dec. 6, 2008

1 - Summary
2 - Net-SNMP installation
3 - Service configuration
4 - Snmpwalk example
5 - Service check

1 - Summary

This guide will show you how to install net-snmp in OpenBSD. This has been
tested in OpenBSD 4.3 and 4.4.

2 - Net-SNMP installation

Install the net-snmp package from an OpenBSD FTP mirror server.
# sudo export PKG_PATH=$rel/packages/$arch/
# sudo pkg_add net-snmp-*.tgz

3 - Service configuration

Find where the net-snmp daemon was installed to.
# pkg_info -L net-snmp-* | grep sbin

Edit /etc/rc.local so that net-snmp will start when the system starts up.
Somewhere in the file add the following.

  if [ -x /usr/local/sbin/snmpd ]; then
          echo -n ' snmpd';       /usr/local/sbin/snmpd -a -Lsd -Lf /dev/null -p /var/run/

# sudo vi /etc/rc.local

Find where the configuration file should be put.
# strings /usr/local/sbin/snmpd | grep snmpd.conf 

You can create your own configuration file. Here is a simple example.

  rocommunity public

# pkg_info -L net-snmp-* | grep snmpd.conf
# sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.example
# sudo vi /etc/snmp/snmpd.conf

Start the net-snmp service.
# sudo /usr/local/sbin/snmpd -a -Lsd -Lf /dev/null -p /var/run/
# sudo cat /var/run/

4 - Snmpwalk example

Run snmpwalk to view the SNMP tree. This example displays the system
# snmpwalk -c public -OQ -Os -Ov -v 2c localhost sysDescr.0 
OpenBSD 4.4 GENERIC#1021 i386

5 - Service check

Reboot your computer. Log in like normal and check to see that the net-snmp
service is running. That's it, now you have net-snmp running in OpenBSD.
# sudo shutdown -r now
# sudo ls -1 /var/run/
# sudo cat /var/run/

Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2018.