Tuesday, 26 May 2020

Crontab- Disk Threshold Alert

#### Disk Alert #################

Crontab Details :

#0,15,30,45 * * * * /u04/MasterDB/scripts/DR_check/diskalert_threshold.sh


Script Output:


oracle@test02:~> cat /u04/MasterDB/scripts/disk_threshod.sh

# Shell script to monitor or watch the disk space

# set admin email so that you can get email

ADMIN="varun.yadav@abc.com"

# set alert level 90% is default

ALERT=90

df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;

do

  #echo $output

  usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1  )

  partition=$(echo $output | awk '{ print $2 }' )

  if [ $usep -ge $ALERT ]; then

  i  echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(date)" |

     mail -s " Alert: Almost out of disk space" $usep $ADMIN

  fi

done

oracle@test02:~>

No comments:

Post a Comment