Chapter 27. check_filesystems.linux.sh

#!/bin/sh

df -Ph | grep -v ^Filesystem | awk '{print $5,$6}'| \
THRESHOLD=80 perl -na -F"%\s" -e '$percent = $F[0]; $filesystem = $F[1];
if ($percent > $ENV{THRESHOLD}) {
    chomp $filesystem;
    print "$ENV{HOSTNAME}:${filesystem} is at ${percent}%.  \n" or die "3";
}'