OpenWRT 21.02 SNMP Setup for LibreNMS

Setting up SNMP on OpenWRT is both a patience and exasperating experience...
Half-time you don't know why everything has to be so hard to do...
This post is a base on which to build SNMP data.

First of all install the required packages
  • snmpd
  • luci-app-snmpd
  • iwinfo
Next download the agents from LibreNMS:
https://github.com/librenms/librenms-agent/tree/master/snmp/Openwrt


copy all files to the openwrt device in /etc/librenms
assign the executable property with:
chown +x ./*


create the following file /usr/bin/distro
  • #!/bin/ash
    [ -f /etc/openwrt_release ] && source /etc/openwrt_release echo ${DISTRIB_ID} ${DISTRIB_RELEASE} ${DISTRIB_REVISION}
edit the file "/etc/librenms/wlInterfaces.txt"
NOTE: you need to get the interface name and SSID from "/etc/config/wireless", replace accordingly
  • radio0,WirelessLAN
  • radio1,WirelessLAN
  • wifinetXX,WirelessLAN123
edit the file "/etc/config/snmpd"
NOTE: you need to replace "replace_wlan_int" withe the interface name from "/etc/librenms/wlInterfaces.txt", replace for each configured SSID.

config exec
        option name     distro
        option prog     /usr/bin/distro
        option miboid   .1.3.6.1.4.1.2021.7890.1

config extend
        option name     interfaces
        option prog     "/bin/cat /etc/librenms/wlInterfaces.txt"

config extend
        option name     clients-"replace_wlan_int"
        option prog     "/etc/librenms/wlClients.sh "replace_wlan_int""
config extend
        option name     frequency-"replace_wlan_int"
        option prog     "/etc/librenms/wlFrequency.sh "replace_wlan_int""
config extend
        option name     rate-tx-"replace_wlan_int"-min
        option prog     "/etc/librenms/wlRate.sh "replace_wlan_int" tx min"
config extend
        option name     rate-tx-"replace_wlan_int"-avg
        option prog     "/etc/librenms/wlRate.sh "replace_wlan_int" tx avg"
config extend
        option name     rate-tx-"replace_wlan_int"-max
        option prog     "/etc/librenms/wlRate.sh "replace_wlan_int" tx max"
config extend
        option name     rate-rx-"replace_wlan_int"-min
        option prog     "/etc/librenms/wlRate.sh "replace_wlan_int" rx min"
config extend
        option name     rate-rx-"replace_wlan_int"-avg
        option prog     "/etc/librenms/wlRate.sh "replace_wlan_int" rx avg"
config extend
        option name     rate-rx-"replace_wlan_int"-max
        option prog     "/etc/librenms/wlRate.sh "replace_wlan_int" rx max"
config extend
        option name     noise-floor-"replace_wlan_int"
        option prog     "/etc/librenms/wlNoiseFloor.sh "replace_wlan_int""
config extend
        option name     snr-"replace_wlan_int"-min
        option prog     "/etc/librenms/wlSNR.sh "replace_wlan_int" min"
config extend
        option name     snr-"replace_wlan_int"-avg
        option prog     "/etc/librenms/wlSNR.sh "replace_wlan_int" avg"
config extend
        option name     snr-"replace_wlan_int"-max
        option prog     "/etc/librenms/wlSNR.sh "replace_wlan_int" max"

There are other changes like the SNMP community, security, version but hopefully this gets you up and running...

Note: Don't forget to add the files to the backed up list, so you can download a working backup setup.


Source: Snmp “extend” to OpenWrt Meraki MR33


Comments