Anonymous Anonymous - 1 year ago
586 0

This bash script will check the diskspace for a particular drive. When the threshold is met an email will be send.


Bash script to check diskspace

# in this example we are going to check drive: /dev/vda1
DISKUSAGE=$(df -h /dev/vda1 | awk 'NR == 2{print $5}' | tr -d '%')
# above 80% disk usage
if (( $DISKUSAGE > 80 ))
mail -s "DISK USAGE server is high!" <<< "Current usage: $DISKUSAGE"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download