Home > HP-UX, Linux > Monitor disk usage on HP-UX

Monitor disk usage on HP-UX

If you don’t have a fancy monitoring system, put a script in a cronjob like the one below and it will email you if you are below your thresholds.

#!/bin/sh

# These limits are for AVAIL column in MBs from bdf output
# warn = 80MB, low = 50MB
warn=80000
low=50000

email=user@domain.com

# Excluding /home since it really isnt being used; always put / last in filesystems
filesystems=”/stand /var /usr /tmp /opt /”

for fs in $filesystems
do
size=`bdf $fs|grep $fs|awk ‘{ print $4; }’`
if [ $size -le $low ]
then
mailx -s “URGENT: Low disk space for $fs, ($size)MB left” $email < /dev/null
break
fi
if [ $size -le $warn ]
then
mailx -s "WARNING: Low disk space for $fs ($size)MB left" $email < /dev/null
fi
done

Categories: HP-UX, Linux
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: