Script for Monitoring iCAP Systems (August 2010)

5
do
case "$TOK1" in
"") ;; # Ignore blank lines
System) # Check if System contact e-mail is set
if [[ "$TOK3" = "e-mail:" ]]
then
if [[ "$TOK4" = "Not" ]]
then
echo "WARNING: System contact e-mail is not set."
echo " Use icapmodify(1M) -c option to set."
let WARNINGS=$WARNINGS+1
fi
fi
;;
Exception) # Check for exceptions
if [[ "$TOK3" != "No" ]]
then
echo "ERROR: iCAP Complex is in an exception status:"
echo " $TOK3 $TOK4 $TOK5 $TOK6 $TOK7 $TOK8 $TOK9"
let ERRORS=$ERRORS+1
EXCEPTIONSTATE=Yes
else
EXCEPTIONSTATE=No
fi
;;
Local|Member) # Determine when list of exceptions has stopped
if [[ "$EXCEPTIONSTATE" = "Yes" ]]
then
EXCEPTIONSTATE=No
fi
;;
Number) # Check if TiCAP is being consumed
if [[ "$TOK5" = "temporary" && "$TOK7" != "0" ]]
then
echo "WARNING: Temporary Capacity is being consumed:"
echo " $TOK1 $TOK2 $TOK3 $TOK4 $TOK5 $TOK6 $TOK7 $TOK8 $TOK9"
let WARNINGS=$WARNINGS+1
fi
;;
Temporary) # Check TiCAP balance is negative
if [[ "$TOK4" = "(negative)" ]]
then
echo "ERROR: Negative temporary capacity balance:"
echo " $TOK1 $TOK2 $TOK3 $TOK4 $TOK5 $TOK6 $TOK7 $TOK8 $TOK9"
let ERRORS=$ERRORS+1
fi
;;
Projected) # Check if TiCAP is about to expire, or has already expired
case "$TOK5" in
N/A) ;; # Ignore
Expired)
echo "ERROR: Temporary capacity has expired."
let ERRORS=$ERRORS+1
;;
*)
echo "WARNING: Temporary Capacity is about to expire:"
echo " $TOK1 $TOK2 $TOK3 $TOK4 $TOK5 $TOK6 $TOK7 $TOK8 $TOK9"
let WARNINGS=$WARNINGS+1