Wednesday, October 21, 2009

Script to monitor a Filesystem on AIX


# This script checks if the /siebel filesystem reaches 2 GB of free space
# And then delete the old logs except those of today

warninglimit=2097152    # This number is in KB, it's equal to 2 GB,
                        # KB is used to avoid floating point numbers

filesystems="/siebel"   # List of filesystems to be monitored, separated by
                        # blank spaces

for fs in $filesystems  # Loop on the list of filesystems above
        size=`df -k $fs|grep $fs|awk '{ print $3; }'`   # Extract size of
                                                        # Filesystem in KB
        if [ $size -le $warninglimit ]  # If fs size is less than warning lim.
                echo "WARNING: Low disk space for $fs ($size)"
                # Add what to delete here

1 comment:

Mohammed Hewedy said...

very handy script, thanks.