#!/bin/bash #ident "@(#)ACK-CL.sh Ver. 1.0 Tom Schmitt 2010" #----------------------------------------------------------------------- # Under GPL 2010 by Tom Schmitt dtschmitt@gmail.com 801.446.5645 #----------------------------------------------------------------------- # ACK-CL.sh #-------------------------------------------------------------------- # PURPOSE: This script runs the 'bb' command with an un-documented # option 'hobbitdack' to ACKnowledge an event from the # Command Line (CL). #-------------------------------------------------------------------- # PASSED VALUES: # $1 = ACKCODE (REQUIRED) - from Email alert message # $2 = DURATION in minutes (OPTIONAL) # $3 = MESSAGE TO STORE for display in Xymon (OPTIONAL) #-------------------------------------------------------------------- # 2/10/2010: # From mailing list from Ralph Mitchell (ralphmitchell@gmail.com) #-------------------------------------------------------------------- # Tested on Xymon 4.3.0-0.beta2. # NOTES: A similar script could be created to do the 'disable' # command from the Command Line. #-------------------------------------------------------------------- PGM=`basename $0` # This script's name SHOW=no # Display additions info (yes/no) # Location of ACK log ACKLOG=/var/log/xymon/acknowledge.log BB=/home/xymon/server/bin/bb # Location of the 'bb' program BBDISP=127.0.0.1 # BB Display IP DURATION=60 # Default is 60 minutes MESSAGE="Working on it" # Default ACK message if [ "$1" = "" ]; then echo -e "Usage: $PGM alertnum [duration-in-minutes] [\"text-message\"]" exit 1 else ACKCODE=$1 fi if [ "$2" != "" ]; then DURATION=$2 fi if [ "$3" != "" ]; then MESSAGE="$3" fi if [ "$SHOW" = "yes" ]; then echo -e " BB=$BB BBDISP=$BBDISP ACKCODE=$ACKCODE DURATION=$DURATION MESSAGE=\"$MESSAGE\" " fi # The command that does the work $BB $BBDISP "hobbitdack $ACKCODE $DURATION \"DURATION=$DURATION: $MESSAGE [$PGM]\"" # Show the last entry in the ACKnowledge LOG tail -1 $ACKLOG exit 0