#!/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
(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.
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.
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. ..................................................................
see I have tried below : but giving me errors...
cat script.sh
#!/bin/sh
OUTPUT1=$(snmpbulkwalk -Oqv -c public -v 2c localhost 1.3.6.1.2.1.2.2.1.1 2> /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