While researching DHCP problems, I noticed someone was discussing monitoring DHCP from SNMP. That left me wondering what the Raspberri Pi MIB looks like, so I decided to install SNMP and find out.
If you are not familiar with SNMP, it is an extensive monitoring protocol. I once used it heavily to monitor network performance across hundreds of routers. To best make use of SNMP, you need a SNMP Console such as SNMPc. SNMPc is rather spendy these days, but there are free SNMP consoles as well – they just take more work (from what I’ve seen) to get running.
For my purposes, I don’t need an SNMP console. I will just use a utility called SNMPWALK which will dump out the entire MIB in a semi-formatted fashion.
RPI does not come with SNMP installed. To install it:
sudo apt-get update sudo apt-get install snmpd sudo apt-get install snmp
To get it running, you will need to modify the /etc/snmp/snmpd.conf file:
First, I commented out this line:
and below the line ‘#agentAddress udp:161,udp6:[::1]:161′ I added:
then below this line:
rocommunity public localhost
rocommunity public 18.104.22.168/24
Finally, restart the service:
service snmpd restart
Verify the service has started:
ps -A | grep snmpd
If the service did not start, you can check \var\log\syslog for error messages.
You can also run tcpdump to monitor SNMP packets on the RPI to verify they are being received and respond to:
tcpdump -i eth0 “udp and (src port 161 or 162)”
On the RPI, you can walk the MIB using this command:
snmpwalk -Os -c public -v 1 localhost
Unfortunately, no MIBs appear to be installed to properly interpret the OIDs so you mainly get gibberish, but it is a good test to verify snmpd itself is working.
These instructions will fix the snmp client so that it extracts the english names for the OIDs:
Here is the system section of RPI’s MIB:
ysDescr.0 = STRING: Linux nsdude 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l sysObjectID.0 = OID: netSnmpAgentOIDs.10 sysUpTimeInstance = Timeticks: (33662) 0:05:36.62 sysContact.0 = STRING: Me <email@example.com> sysName.0 = STRING: nsdude sysLocation.0 = STRING: Sitting on the Dock of the Bay sysServices.0 = INTEGER: 72 sysORLastChange.0 = Timeticks: (6) 0:00:00.06 sysORID.1 = OID: snmpFrameworkMIBCompliance sysORID.2 = OID: snmpMPDCompliance sysORID.3 = OID: usmMIBCompliance sysORID.4 = OID: snmpMIB sysORID.5 = OID: tcpMIB sysORID.6 = OID: ip sysORID.7 = OID: udpMIB sysORID.8 = OID: vacmBasicGroup sysORDescr.1 = STRING: The SNMP Management Architecture MIB. sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching. sysORDescr.3 = STRING: The management information definitions for the SNMP User-based Security Model. sysORDescr.4 = STRING: The MIB module for SNMPv2 entities sysORDescr.5 = STRING: The MIB module for managing TCP implementations sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations sysORDescr.7 = STRING: The MIB module for managing UDP implementations sysORDescr.8 = STRING: View-based Access Control Model for SNMP. sysORUpTime.1 = Timeticks: (4) 0:00:00.04 sysORUpTime.2 = Timeticks: (5) 0:00:00.05 sysORUpTime.3 = Timeticks: (5) 0:00:00.05 sysORUpTime.4 = Timeticks: (6) 0:00:00.06 sysORUpTime.5 = Timeticks: (6) 0:00:00.06 sysORUpTime.6 = Timeticks: (6) 0:00:00.06 sysORUpTime.7 = Timeticks: (6) 0:00:00.06 sysORUpTime.8 = Timeticks: (6) 0:00:00.06
To see information about RPI disks:
snmpwalk -Os -c public -v 1 nsdude UCD-SNMP-MIB::dskTablecd /
Information about CPU usage (load average):
snmpwalk -Os -c public -v 1 nsdude UCD-SNMP-MIB::laTable