#!/bin/bash
# FileName: disk_space_report.sh
# Author: shuhui

########## Define Variables Start ##########

# Trigger Value
PERCENT='80'
# Disk Device[Example: sda1  sda1|sda2]
DISK_DEV='xvda1'
# E-mail Address
MAIL_ADDR='shuhui@vqiu.cn'
# E-mail Title Contents
MAIL_TITLE="Disk Check Warning [ ${HOSTNAME} ]"

########## Define Variables End ##########

for Get_Disk_Per in $(df -Th|egrep "(${DISK_DEV})"|awk '{print $6}'|cut -f1 -d'%')
do
    if [[ ${Get_Disk_Per} -ge ${PERCENT} ]]
    then
        echo "${DISK_DEV} usage over ${Get_Disk_Per}%."|mail -s "${MAIL_TITLE}" ${MAIL_ADDR}

    fi
done
