#!/bin/ksh
# check  file system usage

PATH=/bin:/usr/bin:$HOME/bin

## define the warning threshold (percentage of diskspace used)
warning_threshold=75
critical_threshold=90

# get the desired df line
df_line=$(df /home | tail +2 | head -1)
# remove anything after '%', also remove '%'
a=${df_line%\%*}
# keep the last token
val=${a##* }

# echo " val is $val"

if (( $val > $critical_threshold ))
then
        # echo "WARNING: $(hostname) disk space usage is now ${val}%"
	crm_alarm -n 2 "disk space too low (${val}%)"
elif (( $val > $warning_threshold ))
then

	# echo "Warning: $(hostname) disk space usage is now ${val}%"
	crm_alarm -n 3 "disk space getting low (${val}%)"
fi
