skip to content

Sometimes (like when the power goes off) Xymon/Hobbit/BB raises lots of tickets. Under normal circumstances, these are useful but can get a bit overwhelming in bulk. We have a very simple script to reject such tickets when the status has gone back to green.

# A quick and dirty script to reject green hobbit tickets

export XYMONHOST= # Your hobbitd host goes here
export RTUSER= # Your RT user ID goes here
export RTPASSWD= # Your RT password goes here

rt list "(Subject like 'Hobbit') AND (Status='new')" | while read TICKET ; do
 ID=`echo $TICKET | awk ' { print $1 ; } ' | sed s/://`
 TEST=`echo $TICKET | awk ' { print $4 ; } '`
 HOST=`echo $TEST | sed s/:.*//`
 TEST=`echo $TEST | sed s/.*://`
 STATUS=`bbcmd bb $XYMONHOST "query ${HOST}.${TEST}" 2>/dev/null | awk ' { print $1 ; } '`
 if [ $STATUS  = green ] ; then
  echo Rejecting ticket $ID because test $TEST on $HOST is now green
  rt edit ticket/$ID set Status=rejected
  echo Ticket $ID: $TEST on $HOST is $STATUS, leaving unchanged

Thanks go to EDF for providing the impetus for this script.

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.