script for get OS level space warning on linux

#!/bin/bash
mntlist=”/orahome /oraredo1 /oraarch1 /ora01 /oradump01 /”
for ml in $mntlist
do
echo $ml
usedSpc=$(df -h $ml | awk ‘{print $5}’ | grep -v capacity | cut -d “%” -f1 -)
BOX=$(uname -a | awk ‘{print $2}’)
#
case $usedSpc in
[0-9])
arcStat=”relax, lots of disk space: $usedSpc”
;;
[1-7][0-9])
arcStat=”disk space okay: $usedSpc”
;;
[8][0-9])
arcStat=”space getting low: $usedSpc”
;;
[9][0-9])
arcStat=”warning, running out of space: $usedSpc”
echo $arcStat $ml | mailx -s “space on: $BOX” dba@gmail.com
;;
[1][0][0])
arcStat=”update resume, no space left: $usedSpc”
echo $arcStat $ml | mailx -s “space on: $BOX” dba@gmail.com
;;
*)
arcStat=”huh?: $usedSpc”
esac
#
BOX=$(uname -a | awk ‘{print $2}’)
echo $arcStat
#
done
#
exit 0
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.