mirror of
https://github.com/techarkit/shell-scripting-tutorial.git
synced 2025-07-31 21:09:32 +00:00
Create diskspace.sh
This commit is contained in:
28
diskspace.sh
Normal file
28
diskspace.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#Purpose: Monitoring Disk Space Utilization and Send Email Alert
|
||||||
|
#Version:1.0
|
||||||
|
#Created Date: Wed Jun 6 22:38:01 IST 2018
|
||||||
|
#Modified Date:
|
||||||
|
#WebSite: https://arkit.co.in
|
||||||
|
#Author: Ankam Ravi Kumar
|
||||||
|
# START #
|
||||||
|
THRESHOULD=40
|
||||||
|
mailto="root"
|
||||||
|
HOSTNAME=$(hostname)
|
||||||
|
|
||||||
|
for path in `/bin/df -h | grep -vE 'Filesystem|tmpfs' | awk '{print $5}' |sed 's/%//g'`
|
||||||
|
do
|
||||||
|
if [ $path -ge $THRESHOULD ]; then
|
||||||
|
df -h | grep $path% >> /tmp/temp
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
VALUE=`cat /tmp/temp | wc -l`
|
||||||
|
if [ $VALUE -ge 1 ]; then
|
||||||
|
mail -s "$HOSTNAME Disk Usage is Critical" $mailto < /tmp/temp
|
||||||
|
fi
|
||||||
|
|
||||||
|
#rm -rf /tmp/temp
|
||||||
|
|
||||||
|
|
||||||
|
# END #
|
Reference in New Issue
Block a user