Skip to content

Commit f302b60

Browse files
authored
Create server_monitor_resource.sh
1 parent e399523 commit f302b60

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server_monitor_resource.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
THRESHOLD=85
3+
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
4+
do
5+
echo $output
6+
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
7+
partition=$(echo $output | awk '{ print $2 }' )
8+
if [ $usep -ge $THRESHOLD ]; then
9+
echo "Running out of memory space \"$partition ($usep%)\" on $(hostname) as on $(date)" |
10+
mail -s "Alert: Almost out of disk space $usep%" [email protected]
11+
fi
12+
done

0 commit comments

Comments
 (0)