Page MenuHomePhabricator

Allow SNMPd to be extended with custom scripts
Closed, ResolvedPublicFEATURE REQUEST


It would be great to be able to extend net-snmpd with custom "extend" scripts as described in the URL below. We're using this to enable monitoring of the WAN load balancing status via SNMP, but are now forced to patch the script used to generate the snmpd.conf file.

--- /usr/libexec/vyos/conf_mode/        2019-03-15 10:17:57.965554124 +0100
+++ /usr/libexec/vyos/conf_mode/ 2019-03-15 10:17:50.321361722 +0100
@@ -102,6 +102,9 @@
 smuxpeer .
 smuxsocket localhost

+# Enable monitoring of WAN Load Balance status
+extend wan-load-balance /config/scripts/
 # linkUp/Down configure the Event MIB tables to monitor
 # the ifTable for network interfaces being taken up or down
 # for making internal queries to retrieve any necessary information

The script we're using:



if [ -f "$WLB_OUT" ]; then
        /bin/grep -q '^  Status:  active$' "$WLB_OUT"
        if [ $? -eq 0 ]; then
                echo "OK - WAN Load balancing status - active"
                exit 0
                echo "WARNING - WAN Load balancing status - inactive"
                exit 1
        echo "UNKNOWN - WAN Load balancing not configured"
        exit 3

The status can then be checked for example like this:

$ snmpwalk -v2c -c public nsExtendOutput1
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."wan-load-balance" = STRING: OK - WAN Load balancing status - active
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."wan-load-balance" = STRING: OK - WAN Load balancing status - active
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."wan-load-balance" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendResult."wan-load-balance" = INTEGER: 0


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close

Event Timeline

johanf created this task.Mar 15 2019, 9:44 AM
KKUL added a subscriber: KKUL.Mar 15 2019, 10:02 AM

Hello, I'm interested in that feature request as well.
And additionally, we want to monitor VRRP status via SNMP, assuming it can be done by pretty much the same way.

pasik added a subscriber: pasik.Mar 17 2019, 3:01 PM
syncer assigned this task to hagbard.Apr 17 2019, 7:44 PM
syncer triaged this task as Wishlist priority.
hagbard changed the task status from Open to In progress.Jun 17 2019, 7:12 PM

so I suppose something like: "set service snmp script1 [name path]" would do it?

You need to upload your script to /config/user-data, once done you can configure it via 'set service snmp script-extensions extension-name <extensionname> script <script_name>'

Let me know if it works for you as expected, I think later on we can include script shipped with vyos, like you lb script.

hagbard changed the task status from In progress to Needs testing.Jul 15 2019, 6:42 PM
hagbard removed hagbard as the assignee of this task.Aug 1 2019, 8:16 PM
hagbard moved this task from In Progress to Backlog on the VyOS 1.2 Crux (VyOS 1.2.3) board.
hagbard added a subscriber: hagbard.
c-po moved this task from Finished to In Progress on the VyOS 1.3 Equuleus board.Aug 5 2019, 12:22 PM

Hello, this function works great, but I think it could be better if we can specify a custom OID for each custom script. For exemple, LibreNMS needs to have specific OID to make automatic OS/hardware detection working :
Thank you.

hagbard closed this task as Resolved.Sep 25 2019, 3:48 PM
hagbard moved this task from Needs Triage to Backlog on the VyOS 1.2 Crux (VyOS 1.2.4) board.