#!/bin/bash
WARN_COUNT=$1
CRIT_COUNT=$2
SCRATCH_TMP=`/usr/openv/volmgr/bin/vmquery -b -pn Scratch_pool | wc -l`
SCRATCH_COUNT=$[$SCRATCH_TMP - 3]
if [ $SCRATCH_COUNT -lt $WARN_COUNT ];then
if [ $SCRATCH_COUNT -lt $CRIT_COUNT ];then
echo "Scratch count CRITICAL : availbale scratch tapes $SCRATCH_COUNT less then $CRIT_COUNT|scratch=$SCRATCH_COUNT;$WARN_COUNT;$CRIT_COUNT"
exit 2
else
echo "Scratch count WARNING : available scratch tapes $SCRATCH_COUNT less then $WARN_COUNT|scratch=$SCRATCH_COUNT;$WARN_COUNT;$CRIT_COUNT"
exit 1
fi
else
echo "Scratch count OK : available scratch tapes $SCRATCH_COUNT|scratch=$SCRATCH_COUNT;$WARN_COUNT;$CRIT_COUNT"
exit 0
fi
exit 3
Now our nice nagios installation will warn me when I need to do something , so I just need to wait for a mail to take action, instead of having to remember each morning to look at those mails. find the "Scratch pool" look at the tape count.