Hello,
I have a script which doesn't work, and I can't get to know why. Can you help me please ?
My script takes MIB values and put them in a tab. I want to take the third value, 10 times, and get an average of it.
My tab returns for example : 6202 0 17384 0
Here is the script :
Code:
#!/bin/bash
MIB=1.3.6.1.2.1.2.2.1.11
i=0
total=0
while [ $i -le 10 ]
do
tab=$(snmpwalk -v1 localhost -c public $MIB | cut -d' ' -f 4)
$total=$(($total + ${tab[2]}))
done
echo $(($total / 10))
I might well try to print only ${tab[2]}, but all I have is an empty line, though ${tab[*]} does print the full tab :
Can you help me debug it please ?