Monday, July 08, 2019

Custom Monitoring using SNMP Script for a specific service. - The script is written to avoid false alerts generated due to custom monitoring. 

This will trigger multiple SNMP monitoring attempts (3 times) before calling the failure.



a=0
while [ $a -lt 3 ]
do
   snmpwalk -v2c -c 'XXXXXsecretkeyXXXXXXX' | grep "customvalue" >> /dev/null
   if [ $? = 0 ]; then
        echo "80"
        exit
   else
        sleep 3
        a=`expr $a + 1`
   fi
        echo "0"
done
-