Note that there are some explanatory texts on larger screens.

plurals
  1. POshell script for Net-snmp (get/walk) is not efficient
    text
    copied!<pre><code>#!/bin/bash for i in `seq 1 3000` do index=`snmpget -v 2c -c public -Oqv localhost 1.3.6.1.4.1.21067.4.1.1.1.$i` done for i in `seq 1 3000` do upload=`snmpget -v 2c -c public -Oqv localhost 1.3.6.1.4.1.21067.4.1.1.10.$i` done for i in `seq 1 3000` do download=`snmpget -v 2c -c public -Oqv localhost 1.3.6.1.4.1.21067.4.1.1.11.$i` done </code></pre> <p>(ubuntu-12.04) above is my shell script....with every execution of snmpget command it returns an integer and stores value in above three variables... the problem is the data table is of 9000 values. so with this script it is giving too much time consuption and bettelnake.</p> <p>can any one suggest me some simple "SNMPWALK"(or anything else) used script with that I can store all this data in to a single array[9000] or with three parse,in three different arrays with index of 1 to 3000.so I can decrease time as much as possible. </p> <p>for example : snmpwalk -v 2c -c public -Oqv localhost 1.3.6.1.4.1.21067 gives all the values,but I dont know how to store all these in a array with different index. ..................................................................</p> <p>see I have tried below : but giving me errors...</p> <pre><code>cat script.sh #!/bin/sh OUTPUT1=$(snmpbulkwalk -Oqv -c public -v 2c localhost 1.3.6.1.2.1.2.2.1.1 2&gt; /dev/null) i=1 for LINE in ${OUTPUT1} ; do OUTPUT1[$i]=$LINE; i=`expr $i + 1` done sh script.sh j4.sh: 6: j4.sh: OUTPUT1[1]=1: not found j4.sh: 6: j4.sh: OUTPUT1[2]=2: not found </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload