Monitor AIX filesystems V2

I updated this script a while back and made it a lot easier to maintain. It now checks for usage on all mounted filesystems, except for those listed in the $SKIPFS variable.

#!/usr/bin/ksh
#
# This script reports filesystem usages for
# all mounted filesystems.
#
# Filesystems can be excluded by editing the
# SKIPFS variable e.g. SKIPFS='/proc|/test|/home'
 
MAIL=/usr/bin/mail
RCPT='your@email.com'
USAGE=80
HOSTNAME=`hostname`
SKIPFS='/proc|/test'
 
set -A fs `df -k | grep -vE $SKIPFS | awk '{ print $4 }' | awk 'NR!=1' | sed 's/%//'`
set -A fn `df -k | grep -vE $SKIPFS | awk '{ print $7 }' | awk 'NR!=1'`
 
count=0
while (( $count < ${#fs[*]} )); do
        fssize=${fs[$count]}
        if
                [ $fssize -ge $USAGE ]; then
                echo "${fn[$count]} on $HOSTNAME is at ${fssize}%" | $MAIL -s "WARNING on $HOSTNAME" $RCPT
        fi
        let count="count + 1"
done
 
exit

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.