technical skills grow

Responsive Ads Here

Wednesday, August 11, 2021

checkDiskSpace.sh

 #!/bin/bash

EMAIL="italerts@skymetweather.com" "rajish.nair@skymetweather.com" "abhay.pandey@skymetweather.com" "saurabh.chauhan@skymetweather.com"
CRITICAL_SPACE=90
USED_SPACE=`df -kh  | head -2 | tail -1 | awk '{print $5}' | sed 's/\%//'`
if [ $USED_SPACE -ge $CRITICAL_SPACE ]
then
 /root/it/skymet_mail_sender.sh "Monitoring Alert: Disk Space Critical: $USED_SPACE in `hostname`" $EMAIL < /dev/null
else
 echo "Space has still not reached $CRITICAL_SPACE in `hostname`"
fi

USED_INODE=`df -ih  | head -2 | tail -1 | awk '{print $5}' | sed 's/\%//'`
if [ $USED_INODE -ge $CRITICAL_SPACE ]
then
 /root/it/skymet_mail_sender.sh "Monitoring Alert: INODE Critical: $USED_INODE in `hostname`" $EMAIL < /dev/null
else
 echo "Inode has still not reached $CRITICAL_INODE in `hostname`"
fi
~                                                                                                                                      
~                                    

No comments:

Post a Comment

Powered by Blogger.

Labels

Contact Form

Name

Email *

Message *

Search This Blog

Blog Archive

Ad Code

Responsive Advertisement

Recent Posts