Disk space is the amount of data stored in a Disc Mount in Operating systems.Monitoring the disc space is important to avoid the issues to current running services.
HOSTNAME=`/usr/bin/hostname`
#Specify the mounts names below
Mount[0]=/devices
Mount[1]=/dev
Mount[2]=/temp
# Values which we need to get the alerts when mount reached to that level (%)
Threshold_value=40
Subject="Disk Space Monitoring alert"
ToList="admin@blog.com admin2@blog.com"
Sender="discgroup@blog.com"
Message="Your Custom Message"
for i in "${Mount[@]}"
do
Mount_value=`df -h $i | awk '{print$5}' | tail -1 | cut -d '%' -f 0-1`
if [ "$Mount_value" -ge "$Threshold_value" ]; then
echo $Message | /usr/bin/mailx -s "$Subject" -r "$Sender" "$ToList"
fi
done
- Disc_Space_Monitoring script.sh
HOSTNAME=`/usr/bin/hostname`
#Specify the mounts names below
Mount[0]=/devices
Mount[1]=/dev
Mount[2]=/temp
# Values which we need to get the alerts when mount reached to that level (%)
Threshold_value=40
Subject="Disk Space Monitoring alert"
ToList="admin@blog.com admin2@blog.com"
Sender="discgroup@blog.com"
Message="Your Custom Message"
for i in "${Mount[@]}"
do
Mount_value=`df -h $i | awk '{print$5}' | tail -1 | cut -d '%' -f 0-1`
if [ "$Mount_value" -ge "$Threshold_value" ]; then
echo $Message | /usr/bin/mailx -s "$Subject" -r "$Sender" "$ToList"
fi
done
- Enable the crontab utility and add the below configuration line
0,15,30,45,50 * * * * cd /data/Disc_Space_Monitoring script; ksh Disc_Space_Monitoring script.sh
>/dev/null 2>&1
Note: To know more about Crontab Please refer the link Crontab
Thank you very much for sharing keep writing more blogs
ReplyDeleteonline biztalk traning
microsoft biztalk training courses
biztalk online training hyderabad
biztalk online training india