Skip to content

Commit c004a02

Browse files
author
Ankam Ravi Kumar
authored
Create diskspace.sh
1 parent 8d92e1e commit c004a02

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

diskspace.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
#Purpose: Monitoring Disk Space Utilization and Send Email Alert
3+
#Version:1.0
4+
#Created Date: Wed Jun 6 22:38:01 IST 2018
5+
#Modified Date:
6+
#WebSite: https://arkit.co.in
7+
#Author: Ankam Ravi Kumar
8+
# START #
9+
THRESHOULD=40
10+
mailto="root"
11+
HOSTNAME=$(hostname)
12+
13+
for path in `/bin/df -h | grep -vE 'Filesystem|tmpfs' | awk '{print $5}' |sed 's/%//g'`
14+
do
15+
if [ $path -ge $THRESHOULD ]; then
16+
df -h | grep $path% >> /tmp/temp
17+
fi
18+
done
19+
20+
VALUE=`cat /tmp/temp | wc -l`
21+
if [ $VALUE -ge 1 ]; then
22+
mail -s "$HOSTNAME Disk Usage is Critical" $mailto < /tmp/temp
23+
fi
24+
25+
#rm -rf /tmp/temp
26+
27+
28+
# END #

0 commit comments

Comments
 (0)