Sunday, August 16, 2015

Script to check disk and inode usage alert in linux


#!/bin/bash
/bin/df -h  > diskusage.txt
grep '98%\|99%\|100%' diskusage.txt > /dev/null
if [[ $? = 0 ]]
then
mail -s " Server Disk Status" mailid < diskusage.txt
fi
echo "INODE USAGE" > inodeusage.txt
/bin/df -ih >> inodeusage.txt
grep '98%\|99%\|100%' inodeusage.txt > /dev/null
if [[ $? = 0 ]]
then
mail -s " Server Disk Inode Status" mailid < inodeusage.txt
fi

No comments:

Post a Comment