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.
#!/bin/bash # 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 else echo Ticket $ID: $TEST on $HOST is $STATUS, leaving unchanged fi done
Thanks go to EDF for providing the impetus for this script.