"extendfix" script still gets triggered by snmpwalk and snmpget

Florian Mader <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello collective wisdom of the Net-SNMP users,
I'm not sure if I have encountered a bug in snmpd or just misunderstood the concept of "extendfix".

I'm looking to implement a 'push-button' command invocation, as stated in the documentation for "extend" [1] and the manpage of snmpd.conf [2].

My corresponding entry in the snmpd.conf looks like this:
extendfix test /usr/bin/sudo /home/pi/test_GPIO_Toggle_LEDs.py

(The script toggles GPIO pins between HIGH and LOW on my Raspberry Pi.
Right now I'm just switching LEDs on and off, but the goal is to control
remote hardware over SNMP for a home automation project.)

I confirmed with snmpwalk that "nsExtendRunType" is set to "run-on-set(2)":
snmpwalk -v2c -c testing 127.0.0.1 nsExtensions
NET-SNMP-EXTEND-MIB::nsExtendNumEntries.0 = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendCommand."testFix" = STRING: /usr/bin/sudo
NET-SNMP-EXTEND-MIB::nsExtendArgs."testFix" = STRING: /home/pi/test_GPIO_Toggle_LEDs.py
NET-SNMP-EXTEND-MIB::nsExtendInput."testFix" = STRING:
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."testFix" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendExecType."testFix" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."testFix" = INTEGER: run-on-set(2)
NET-SNMP-EXTEND-MIB::nsExtendStorage."testFix" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStatus."testFix" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendOutLine."testFix".1 = STRING: Sie haben den LED Status gewechselt.

If I understood the documentation correctly, with the use of "extendfix" instead of plain "extend" my script should only get triggered
if I send an snmpset that sets "run-command (3)" in "nsExtendRunType" like in the command below:
snmpset -v2c -c writesecret localhost 'NET-SNMP-EXTEND-MIB::nsExtendRunType."testFix"' i 3

This works as expected.

My problem is that the snmpwalk command used above also triggers the script execution.
I think I located the problem, it's that a simple snmpget on "nsExtendOutline" also triggers the script execution:
snmpget -v2c -c testing localhost 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."testFix".1'


This is a very unexpected behavior for me, because it defys the purpose of a "push-button" if it activates just by looking at it ;)
And, at least to my understanding, it does exactly what it's NOT supposed to do. It executes on a snmpget read.

So right now I'm not sure if this is really a bug in "extendfix", or if I'm missing one of the finer details of configuring it right.
I would be very glad if you could show me an error in my usage, or confirm that this is really a bug.

If we can resolve this issue, I think it should at least lead to a clearer description of the "extendfix" behavior in the documentation.

Best Regards,
Florian Mader

P.S.:
I was also thinking about implementing my "push-button" with a dummy-variable that I can set "1" or "0",
and a trap command that executes the script when the dummy-variable changes value.
But extendfix seemed (at the time) like it fitted my needs exactly.... :(

[1]  http://net-snmp.sourceforge.net/docs/mibs/NET-SNMP-EXTEND-MIB.txt
[2]  http://www.net-snmp.org/docs/man/snmpd.conf.html

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.