Trying to create custom MIB for OpenWRT

Hello,

We are trying to use a custom MIB on about 75 OpenWRT routers to count the number of connected WiFi clients. But it doesn’t seem like adding a graph on a custom MIB is easy or straightforward based on our reading of the documentation. Is there an easy way to do this? The following is what we have written to our devices:

In the device’s /etc/snmp/snmpd.conf:

exec 1.3.6.1.3.19811018.80 station-count /etc/snmp/station-count

The script itself:

#!/bin/sh
iw dev wlan0-1 station dump | grep -i Station | wc -l

This script simply outputs how many clients are connected to the device’s WiFi interface as a number.

Would it be possible to get LibreNMS to graph this data? Thank you for your time.

I’m assuming the device doesn’t just output that value natively in snmp then?

You have a couple of options.

  1. Install check_mk + munin scripts from our librenms-agent repo and alter your script above to output in the format munin would expect.

  2. Add support natively using includes/polling/wifi.inc.php to call the OID you’ve created above. This would be the slightly easier option as you only need to return the number of clients and the script takes care of the rest.

That’s correct, there is no native station-count value.

  1. when you say to install check_mk + munin scripts, is that all done server-side or is any of that supposed to be done on the client? I’m not super familiar.

  2. How does one add support natively? Is there a guide for that somwhere?

Thank you for your time!

  1. This is all client side, nothing is needed on the LibreNMS side.

  2. https://github.com/librenms/librenms/blob/master/includes/polling/wifi.inc.php#L58 No docs exist but that section is basically what you want (clients I’m assuming this is).

I think this can easily be added. I found these resources:
Example extend for snmpd: https://trello.com/c/lPRy0J5V/11-publishing-of-monitoring-data-on-pittmeshnet
Some more OIDs available: http://glr81.free.fr/pages/openwrt-snmp-oid.htm

I’ve of course tried the example with stations and it works. I can get the info to Librenms. As far as I can see, You need to re-write some of the example scripts as OpenWrt, now uses “iw” so the commands are a bit different. The only thing needed now is probably to define a new OS Type in Librenms, “openwrt” in this case and add the possible OID using the Wireless Sensors examples. Writing a documentation on to set it up would be a nice move.

I sure hope tough that “iw” will work the same for all chipsets.