Recognizing OpenWrt as an OS in Observium

Categories:

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):

[code lang=text]
# opkg update
# opkg install snmpd
[/code]

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:

[code lang=text]
# 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
[/code]

For our router:

[code lang=text]
snmpget -v2c -c public gw.gw01.chcgil01.iachieved.it sysDescr.0
.1.3.6.1.2.1.1.1.0 = STRING: Linux chcgil 4.14.131 #0 SMP Thu Jun 27 12:18:52 2019 armv7l
[/code]

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:

[code lang=text]
config system
option sysLocation 'office'
option sysContact 'bofh@example.com'
option sysName 'HeartOfGold'
# option sysServices 72
# option sysDescr 'adult playground'
# option sysObjectID '1.2.3.4'
[/code]

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:

[code lang=text]
config system
option sysLocation 'Chicago'
option sysContact 'admin@iachieved.it'
option sysName 'gw01.chcgil01'
option sysDescr 'OpenWrt'
[/code]

Restart snmpd:

[code lang=text]
# /etc/init.d/snmpd restart
[/code]

And check snmpget again:

[code lang=text]
# snmpget -v2c -c public gw.gw01.chcgil01.iachieved.it sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: OpenWrt
[/code]

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.

Leave a Reply

Your email address will not be published. Required fields are marked *