SNMPd
Install package:
apt-get update; apt-get install snmpd
Edit config file: /etc/snmp/snmpd.conf
At top of file, comment out localhost and uncommon all hosts:
# Listen for connections from the local system only
#agentAddress udp:127.0.0.1:161
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161
In the middle of the file, comment out default community strings and add your own
Also allow the network address(s) you want snmp to respond to
# rocommunity public default -V systemonly
# rocommunity6 public default -V systemonly
rocommunity ChangeMe 172.17.0.0/24
Restart Service:
sudo service snmpd restart
Extra Step: Setup Custom SNMP test
Install snmp-mibs-downloader:
Add non-free to end of entries in /etc/apt/sources.list (if not already there):
deb http://ftp.us.debian.org/debian/ stretch main non-free
deb-src http://ftp.us.debian.org/debian/ stretch main non-free
Then install:
apt-get update
apt-get install snmp-mibs-downloader
Install the mibs now:
sudo download-mibs
Update /etc/snmp/snmp.conf:
Change mibs : to #mibs : per the comment at the top of the file
Create script for what you want to monitor:
For example, create a script like this:
vim /usr/sbin/1minloadavg.sh
#!/bin/bash
awk '{print $1}' /proc/loadavg
Update /etc/snmp/snmpd.conf file to extend SNMP:
extend 1minloadavg /usr/sbin/1minloadavg.sh
or
extend updates /bin/cat /usr/local/bin/updates/NumUpdates.txt
Restart Service:
sudo service snmpd restart
Find your OID:
Walk the mibs, you can find your entry by it's proximity to the default hello world ones: