WBITT

We Bring In Tomorrows Technology

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

Script to genrate the Disk alert using SNMP

E-mail Print PDF
User Rating: / 5
PoorBest 
#!/bin/bash
#Date 18th-APR-2009
#Asim Abbas
#E-mail: This e-mail address is being protected from spambots. You need JavaScript enabled to view it
#ServerName=Dummy.com

#This script will collect  the value of remote server mounted disks using snmp OIDs and if the disk usage is above 85% it #will generate the e-mail for "critical" users or if load is less then 85 % more then 70% it will generate e-mail for average #user.



value=`snmpget -v1 -c public 192.168.1.1 dskPercent.1 | cut -d ' ' -f4`
value1=`snmpget -v1 -c public 192.168.1.1 dskPercent.2 | cut -d ' ' -f4`

echo $value

if [ "$value" -ge "85" ]; then
echo " The FS / partition   is  $value% " |mail -s " Critical Alert Cares-1 (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it ; echo " The FS / partition   is$value% " |mail -s  " Critical Alert Cares-1 (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it



elif [ "$value" -ge "70" ];then
echo " The FS / partition   is  $value% " |mail -s  " Warning Alert (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it ; echo " The FS / partition   is  $value% "|mail -s  " Critical Alert Cares-1 (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it
else
echo "Load is Normal "

fi

echo $value1

if [ "$value1" -ge "90" ]; then
echo " The FS /oracle partition   is  $value1% " |mail -s " Critical Alert Cares-1 (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it ; echo " The FS /oracle partition   is$value1% " |mail -s  " Critical Alert Cares-1 (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it

elif [ "$value1" -ge "85" ];then
echo " The FS /oracle partition   is  $value1% " |mail -s  " Warning Alert (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it ; echo " The FS /oracle partition   is  $value1% "|mail -s  " Critical Alert Cares-1 (Cacti)" This e-mail address is being protected from spambots. You need JavaScript enabled to view it
else
echo "Load is Normal "

fi
You are here How To / Tutorials Script to genrate the Disk alert using SNMP