Recognizing OpenWrt as an OS in Observium
Observium is a great application for monitoring network equipment, regardless of type (e.g., routers, switches, firewalls, etc.) What makes it so powerful is due in large part to the amount of information exposed by SNMP for network gear and its ability to intelligently parse the returned data and display it.
This intelligence can only go so far, however, when a given piece of gear has either an incomplete implementation of SNMP or the values returned aren’t indicative of the equipment. Take, for example, OpenWrt. It is, in a word, an awesome piece of software, capable of turning a $250 Linksys home router into a participant in an OSPF area. Pretty nift.
Due to its open nature there are a number of SNMP options for OpenWrt:
Only one of these will give you a suitable view in Observium, and that is the
snmpd package. Let’s install it (note that I’m using the OpenWrt shell vs. LUCI):
# opkg update # opkg install snmpd
Unfortunately if you add your device now Observium will recognize it as a generic Linux machine. That’s due to the fact that, by default, the OpenWrt
snmpd package will not return suitable information in the
sysDescr OID for Observium’s OS detection routines.
For reference, here is what you can expect Observium to display with
snmpd not configured properly:
Let’s take a look directly at the
sysDescr OID with
snmpget, which is available by installing
snmp on your Observium host (if you’re using a Debian variant). There is a little dance to be done to get
snmpget to work properly:
# apt-get install snmp snmp-mibs-downloader # printf "[snmp]\nmibs +ALL\n" > /etc/snmp/snmp.conf # download-mibs # snmpget -v2c -c public <HOSTNAME> sysDescr.0
For our router:
snmpget -v2c -c public gw.gw01.chcgil01.iachieved.it sysDescr.0 .188.8.131.52.184.108.40.206.0 = STRING: Linux chcgil 4.14.131 #0 SMP Thu Jun 27 12:18:52 2019 armv7l
sysDescr as is will cause Observium to detect the router as a basic Linux OS. We want more. Here’s how to do it! Go to the
/etc/config/snmpd file in OpenWrt and find this block:
config system option sysLocation 'office' option sysContact 'email@example.com' option sysName 'HeartOfGold' # option sysServices 72 # option sysDescr 'adult playground' # option sysObjectID '220.127.116.11'
sysLocation can be set to a locale name and Observium will automatically map it properly. Since this router is in Chicago we’ll put Chicago there. Likewise,
sysName will be changed to
gw01.chcgil01 as this router is Gateway #1 in Chicago Site #1. What we’re particularly interested in changing here is
sysDescr. Uncomment the line and change it to
OpenWrt. Here’s what our final
config system block looks like:
config system option sysLocation 'Chicago' option sysContact 'firstname.lastname@example.org' option sysName 'gw01.chcgil01' option sysDescr 'OpenWrt'
# /etc/init.d/snmpd restart
# snmpget -v2c -c public gw.gw01.chcgil01.iachieved.it sysDescr.0 SNMPv2-MIB::sysDescr.0 = STRING: OpenWrt
Perfect. Add the device to Observium and watch it fill in the rest.
Notice that the Tux logo has been replaced with the OpenWrt logo as Observium correctly identifies this device as running OpenWrt.