Skip to content

NetSNMPd Client Configuration

This page was originally posted by the Observium Team, however with their documentation being updated I can no longer locate it. I have recreated it from a cached page, but focused only on Ubuntu (15.10 at time of writing).

First install Net-SNMP :

# aptitude install snmpd
Make sure the SNMPDOPTS line in /etc/default/snmpd looks like this

SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -p /var/run/snmpd.pid'

Info

Through experimenting I prefer the following line

SNMPDOPTS='-Lf /dev/null -u snmp -p /var/run/snmpd.pid'

This also disables logging and as such gets rid of annoying "features" like:

snmpd[4990]: Connection from UDP: 1.2.3.4

Replace the default /etc/snmp/snmpd.conf file with something like this, changing the community, location and contact fields.

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

#  Full view access
view   all         included   .1

#  system + hrSystem groups only
view   systemonly  included   .1.3.6.1.2.1.1
view   systemonly  included   .1.3.6.1.2.1.25.1

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

#  Default access to basic system info
#rocommunity public  default    -V systemonly

#  System contact and location
syslocation xxx xxxx Road, xxxxx
syscontact user@domain

#  Disk Monitoring
disk       /     10000
disk       /var  5%
includeAllDisks  10%

# Unacceptable 1-, 5-, and 15-minute load averages
load   12 10 5

# 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/cat /sys/devices/virtual/dmi/id/product_name
extend .1.3.6.1.4.1.2021.7890.3 vendor   /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
extend .1.3.6.1.4.1.2021.7890.4 serial   /bin/cat /sys/devices/virtual/dmi/id/product_serial

# This line allows Observium to collect an accurate uptime
extend uptime /bin/cat /proc/uptime

Get the observium 'distro' script from the scripts/ directory to identify your distribution via SNMP and copy it to /usr/bin/distro.

You should then be able to restart snmpd, # systemctl restart snmpd

And then add the device to your Observium installation!

On devices with a large routing table

You may encounter sloppy SNMP responsiveness and high host load with too many routes installed in combination with netsnmp. Also see this Debian bugreport of a few years back. The last post seems to fix this issue, so if you are running full table, add these lines to snmpd.conf as well:

view all included .1 80
view all excluded .1.3.6.1.2.1.4.21
view all excluded .1.3.6.1.2.1.4.24
view system included .iso.org.dod.internet.mgmt.mib-2.system

Last update: April 1, 2021