[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SOLUTION: TS - blackberry small web page for ACK



In order to use:  rename and make executable -  ACK-CL.txt to ACK-CL.sh.

                mv ACK-CL.txt ACK-CL.sh

                chmod +x ACK-CL.sh

I cannot send a '.sh' file as it will be removed automatically from the
Email.

 

I'm running 4.3.0-0.beta2 on CentOS 5.x.

 

Ralph Mitchell has found an un-documented option in 'bb' to allow you to
use a command line script

to ACKnowledge an alert.

I have placed it into a short shell script.  The comments make it easy
to understand what is going on.

Hope this helps others as it has me.

 

Hope this option is included in the releases to come.

We need to have the 'man bb' page updated.

 

Thanks Ralph!

 

Thanks,

 

Tom Schmitt

Senior IT Staff - R&D

Salt Lake City, UT  84116

Phone (801) 594-3030

Cell      (801) 231-7230

eFax    (413) 480-6873

D.Tom.Schmitt (at) L-3Com.com

           \\\\||////

             \ ~  ~ /  

             | @  @ |   

--oOo---(_)---oOo--

 

From: Schmitt, D Tom @ CSW-SLC 
Sent: Wednesday, February 03, 2010 11:28 AM
To: hobbit (at) hswn.dk
Subject: TS - blackberry small web page for ACK

 

I have an urgent requirement to be able to create a small web page for
display on the blackberry.

 

OK SOLUTION (if I can get it to work):

I tried to use bb-ack.cgi but the documentation is not straight forward.

I see that it has "Ack" as a hidden value for ACTION.

FORM METHOD=GET and ACTION="&SCRIPT_NAME"

What does script name get set to on a correct run?

 

BETTER SOLUTION:

I can create a simple small web page and pass the link to the blackberry
to the person on-call.

But I need to have a command line equivalent to the bb-ack.cgi to ACK
the outage and supply the following variables.

                Same items on the bb-ack.cgi man page:

                                bb-ack.cgi

ACTION=action

NUMBER=acknum

DELAY=validity

MESSAGE=text

                I have not found the correct command.

 

I can DISABLE/ENABLE the device easily from 'bb' but I need to make an
easy way to acknowledge 

the event from a smart phone (blackberry).

 

Thanks,

 

Tom Schmitt

Senior IT Staff - R&D

Salt Lake City, UT  84116

Phone (801) 594-3030

Cell      (801) 231-7230

eFax    (413) 480-6873

D.Tom.Schmitt (at) L-3Com.com

           \\\\||////

             \ ~  ~ /  

             | @  @ |   

--oOo---(_)---oOo--

 

#!/bin/bash
#ident "@(#)ACK-CL.sh Ver. 1.0 Tom Schmitt 2010"
#-----------------------------------------------------------------------
# Under GPL 2010 by Tom Schmitt   dtschmitt (at) 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 (at) 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