#!/bin/sh
MAIL_ADDRESS="adminsys@domain.tld"
HOST=`hostname`
LIMIT=85
COUNT=0
df -Ph | awk '{ print $5 " used for " $6 " (" $3 "/" $4 ")" }' | while read LINE;
do
#drop the first line of the df output command
COUNT=`expr ${COUNT} + 1`;
if [ ${COUNT} -eq 1 ]
then
continue;
fi
USED=`echo ${LINE} | awk '{print $1}' | sed -e 's/%//'`;
HOST=`hostname`;
if [ "${USED}" -ge "${LIMIT}" ]
then
echo "${LINE}" | mail -s "Disk Usage Alert on ${HOST}" ${MAIL_ADDRESS};
fi
done;
exit 0;
Tags
Infos