Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Quota monitoring of hard disk utilization

Shulou Source: shulou.com Published: 2022-06-01 05:37:58 10月04日 Update

A small script used to monitor hard disk usage, used to monitor when hard disk usage exceeds a certain limit on the e-mail alarm.

#!/ bin/bash

ADMIN='localhost@localhost'

# set alert level 90% is default

ALERT=90

output=`df -H | grep -vE '^Filesystem| tmpfs| cdrom| used '| awk '{ print $5 " " $1 }'`

while :

do

#echo $output

usep=`echo $output | awk '{ print $1}' | cut -d'%' -f1`

partition=`echo $output | awk '{ print $2 }'`

if [ $usep -ge $ALERT ]; then

mail -s "Alert: Almost out of disk space "$partition $usep" on $(hostname) as on $(date)" $ADMIN

fi

done

Tags: Usage hard disk monitoring script mail alarm quota Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info Shulou Technology Microsoft macOS