Need send a alert comparing two values of disk space for all partition It should check for SIZE and USED values and compare values makesure not more than 80%
Filesystem Size Used Avail Mounted
/dev/sda1 9,9G 3,3G 6,1G /
none 17G 213k 17G /dev
none 17G 0 17G /dev/shm
none 17G 103k 17G /var/run
none 17G 0 17G /var/lock
none 9,9G 3,3G 6,1G /var/lib/ureadahead/debugfs
/dev/sda2 64G 17G 48G /usr/local
/dev/md0 147G 43G 105G /mnt
/dev/sde1 400G 203G 198G /mnt/usbdisk
eg: /dev/sda1 used space is 3,3GB should not reach 80%, if reaches then it should send mail.
Here's an awk script I wrote years ago to do this very thing. Just put it in cron to run at a specified schedule.
#!/bin/sh
/bin/df | \
/usr/bin/awk '{if($5 ~ "%" && $6 !~ "proc") {used=$5} else {used=""}; \
sub(/%/, "", used); \
if(used > 80) print $6 " is at " used"%"}' |\
mail -s "Disk usage over limit" user@domain.com