Kristijan.org

I’m back!

Posted by Kristijan on Sunday, December 21st, 2008

How could I stay away? From the shear number of e-mails flooding my inbox daily for updates to my infamous blog, I couldn’t keep the fans in the dark no more!
*cough*
Back to reality…I’m not reviving my old blog, but starting a new one. I’ve been working as a systems administrator for about 4 years now, [...]

continue reading

Monitor AIX filesystems V2

Posted by Kristijan on Wednesday, September 30th, 2009

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

Posted in: Shell Scripting.

Leave a Reply