I have one simple bash script calls test_snmp, let's say:
#!/bin/bash
echo $1
I have snmpd.conf set as following:
rwcommunity public 127.0.0.1
extend .1.3.6.1.4.1.2021.53 /bin/bash /tmp/test_snmp
What I'd like to do is to run a snmpwalk command, something like:
snmpwalk -v2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.53 "PRINT SOMETHING"
from the output I see that
oid = iso.3.6.1.4.1.2021.53.3.1.1.9.47.98.105.110.47.98.97.115.104 = ""
, is the output of the script. But I'd like to pass that string "PRINT SOMETHING"
, as a $1
parameter for the script mentioned above and then get the string (in this case "PRINT SOMETHING"
) by using snmpget
command, something like:
snmpget -v2c -c public 127.0.0.1 iso.3.6.1.4.1.2021.53.3.1.1.9.47.98.105.110.47.98.97.115.104
It is only an example, I'm testing what options I have by running scripts via snmp, because if this works then I'll write another scripts to run remotely, but I have to run them with variables.
Does anyone know how to do it?
Thank you