exec .1.3.6.1.4.1.32473.8.1 gfgf /opt/gf.sh
Ah, right. I forgot that I wasn't in a Merlin forum. It's an ASUS AC68 running Merlin 380_60_beta2, but I think the answer is applicable to my other Merlin routers. I'm adding this line to /tmp/snmpd.conf:
I can add it and restart snmpd in a startup script, but I'd rather do it the right way, if there is such a thing.Code:exec .1.3.6.1.4.1.32473.8.1 gfgf /opt/gf.sh
Tomato router: snmpd.conf:
sh .1.3.6.1.4.1.32473.8.2 memfree /jffs/memfree.sh
Tomato router: memfree.sh:
cat /proc/meminfo | awk '/MemFree/ {free=$2} /MemTotal/ {total=$2} END {printf ("%2.2f\n", (free/total)*100)}'
Windows client:
c:\usr\bin\snmpwalk.exe -v 2c -c public 10.0.3.1 .1.3.6.1.4.1.32473.8.2
Result:
SNMPv2-SMI::enterprises.32473.8.2.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.32473.8.2.2.1 = STRING: "memfree"
SNMPv2-SMI::enterprises.32473.8.2.3.1 = STRING: "/jffs/memfree.sh"
SNMPv2-SMI::enterprises.32473.8.2.100.1 = INTEGER: 0
SNMPv2-SMI::enterprises.32473.8.2.102.1 = INTEGER: 0
SNMPv2-SMI::enterprises.32473.8.2.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.32473.8.2.2.1 = STRING: "gstats"
SNMPv2-SMI::enterprises.32473.8.2.3.1 = STRING: "/jffs/memfree.sh"
SNMPv2-SMI::enterprises.32473.8.2.100.1 = INTEGER: 0
SNMPv2-SMI::enterprises.32473.8.2.101.1 = STRING: "69.38"
SNMPv2-SMI::enterprises.32473.8.2.102.1 = INTEGER: 0
SNMPv2-SMI::enterprises.32473.8.2.103.1 = ""
Yep, that's the problem.Well at the risk of stating the obvious, your script is not producing any output (.101.1).
It's definitely running. I used logger to prove that memfree.sh starts and finishes.1) Is the script running at all?
Maybe, but it works if I run memfree.sh manually from a shell.2) If it is running perhaps the "cat ..." command is hanging/crashing.
Already tried that. I see the logger output in the log, but not the echo. However, it works from a shell.I suggest that you test for 2) by replacing the "cat ..." command with "echo 99.9" and see if that gives you any output.
memfree.sh:
#!/bin/sh
logger "### START ###"
echo xxxxx
logger "### END ###"
Invoked from the Windows client:
c:\usr\bin\snmpwalk.exe -v 2c -c public 10.0.3.1 .1.3.6.1.4.1.32473.8.2
Returns:
SNMPv2-SMI::enterprises.32473.8.2.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.32473.8.2.2.1 = STRING: "memfree"
SNMPv2-SMI::enterprises.32473.8.2.3.1 = STRING: "/jffs/memfree.sh"
SNMPv2-SMI::enterprises.32473.8.2.100.1 = INTEGER: 0
SNMPv2-SMI::enterprises.32473.8.2.102.1 = INTEGER: 0
And in the log:
Jul 24 19:59:27 unknown user.notice root: ### START ###
Jul 24 19:59:27 unknown user.notice root: ### END ###
Invoked from a shell on the router:
memfree.sh
Returns:
xxxxx
And in the log:
Jul 24 20:00:47 unknown user.notice root: ### START ###
Jul 24 20:00:47 unknown user.notice root: ### END ###
exec .1.3.6.1.4.1.32473.8.2 memfree /bin/sh /jffs/memfree.sh
Hmm. I can only think that it's a peculiarity of the version of snmpd on the router.
How about trying this in snmpd.conf instead. Although I can't imagine why it would make a difference.
Code:exec .1.3.6.1.4.1.32473.8.2 memfree /bin/sh /jffs/memfree.sh
Thread starter | Title | Forum | Replies | Date |
---|---|---|---|---|
S | Pro-sumer WiFi 6/6E routers with support for VLAN, VPN, SSH, and some custom firmware | Routers | 55 |
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!