HCM Global Test Example

The following script checks the free disk space of the file systems used by SA. This script runs on the core servers specified by the hosts option of the run_all_probes.sh command:

# Check for freespace percentage on Opsware SA filesystems

# Read in our libraries, standard variable settings, and parse

# the command line.

/opt/opsware/oi_util/lib/global_probe_preamble.sh

MAX_PERCENTAGE=80

for filesystem in /opt/opsware /var/opt/opsware \

/var/log/opsware; do

#  The leading and trailing spaces in the following printf

#  are to improve readability.

printf " Checking $filesystem: "

percent_free=`df -k $filesystem 2> /dev/null | \

grep -v Filesystem | \

awk '{print $5}' | \

sed 's/%//'`

if [ $percent_free -ge $MAX_PERCENTAGE ] ; then

echo "FAILURE (percent freespace > $MAX_PERCENTAGE)"

exit_code=1

else

echo "SUCCESS"

exit_code=0

fi

done

exit $exit_code