Welcome, Guest
Username Password: Remember me

ShellScript to monitor available disk space on AIX
(1 viewing) (1) Guest
Shell Script
  • Page:
  • 1

TOPIC: ShellScript to monitor available disk space on AIX

ShellScript to monitor available disk space on AIX 1 year, 10 months ago #267

  • tpatil
  • OFFLINE
  • Junior Boarder
  • Posts: 27
  • Points: 5107
  • Karma: 0
  • Honor Medal 2009
 
#!/bin/ksh

# This script monitors available disk space.
# This script emails an alert when a locally mounted partition crosses a given threshold.
# Set your threshold percentage (do not include the % sign), email address, and excluded mount points, then add to crontab
# TPatil 03/12/10
#
# Add this to crontab -e for root
# Diskspace monitoring script
#0 6 * * 1-5 /bin/diskMonitor.sh >/dev/null 2>&1

THRESHOLD="90"
EMAIL="abc@abc.com"
# Excluded mount points *must* be pipe delimited
# "/proc|/export/home|Mounted" should always be included
EXCLUDE="/proc|/export/home|Mounted"
 
df -k | awk '{print $7"\t"$4}' |egrep -v "(${EXCLUDE})" | while read LINE; do
PERC=`echo $LINE |awk '{print $2}' |cut -d"%" -f1`
if [ $PERC -gt $THRESHOLD ]; then
echo "${PERC}% ALERT" | /usr/bin/mail -s "Disk Space Alert: ${LINE} used on `hostname`" $EMAIL
fi
done
 
 
  • Page:
  • 1
Time to create page: 0.65 seconds

     
    
Home Forum