How to pass variables for a script via SNMP by using snmpget?
<p>I have one simple bash script calls test_snmp, let's say:</p>

<pre><code>#!/bin/bash
 echo $1
</code></pre>

<p>I have snmpd.conf set as following:</p>

<pre><code>rwcommunity public 127.0.0.1
extend .1.3.6.1.4.1.2021.53 /bin/bash /tmp/test_snmp
</code></pre>

<p>What I'd like to do is to run a snmpwalk command, something like:</p>

<pre><code>snmpwalk -v2c -c public 127.0.0.1 .1.3.6.1.4.1.2021.53 "PRINT SOMETHING"
</code></pre>

<p>from the output I see that
<code>oid = iso.3.6.1.4.1.2021.53.3.1.1.9.47.98.105.110.47.98.97.115.104 = ""</code>, is the output of the script. But I'd like to pass that string <code>"PRINT SOMETHING"</code>, as a <code>$1</code> parameter for the script mentioned above and then get the string (in this case <code>"PRINT SOMETHING"</code>) by using <code>snmpget</code> command, something like:</p>

<pre><code>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
</code></pre>

<p>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.</p>

<p>Does anyone know how to do it?</p>

<p>Thank you</p>