Script required for disk alert (df -h )


Script required,
I have 20-30 machine RHEL/Solaris. need to write the script for df -h, if any machine df -h output above: 70 % then send the alert.
note: every server Email alert send the specific/different person.
I have the server list in 2 different files - one for rhel and another solaris.

cat $BASE/fsmonhostlinux |awk ‘{print $1}’`
provide server list.


script will run from other server , that machine have password less for all.


Hi Ritesh,

Run the below script in all server and change the email id according to yours


df -Ph | grep -v File | while read out

partuse=echo $out | awk '{print $5}' | cut -d'%' -f1
partdir=echo $out | awk '{print $6}'

     if [ $partuse -ge 70 ]
        echo "Partition $partdir Usage is more $partuse%" | mail -s "Disk Usage More"



hi @iamarunk1898 , thanks for reply,.

i want to run the the script from other server, from that server having password less connection(Normal user)

suppose i have server list in file_name.
and will check server list in “file_name” one by one.


Maybe this can help

awk ’ BEGIN {
“hostname” | getline host
recipient = “root”
threshold = “90%”
df = “/bin/df -k”
while ( ( df |getline line ) > 0 ) {
split(line,array," “)
if (array[5] > threshold && array[5] !~ /[a-zA-Z]/) {
email=”/usr/bin/mail "recipient
print "Filesystem " array[1] " hits the threshold " threshold ".Value: " array[5] | email