Xymon Mailing List Archive search

Highlights of the 4.3.0 version

list Charles Jones
Wed, 25 Jul 2007 12:55:42 -0700
Message-Id: <user-9f715e65065d@xymon.invalid>

All the new features sound great. It also sounds like nearly everyone has additional features they would like to see...do you use any sort of tool for tracking feature requests?

P.S. I might as well throw in my own feature request ;-)
* Content check should correctly follow 302 (redirects).  I currently have to use a custom-made script that uses curl in order to do content checks.  In fact, I will include it in case anyone wants to use it:

#!/bin/bash
# contchk.sh written by Charles Jones (user-02bccbb1bbb5@xymon.invalid) 6/6/2007
# This script is designed to perform a content check on a URL and report the
# status to a Hobbit server.
#
# This script was created because Hobbits built-in content check functionality
# does not follow 302 redirects.
#
# The script parses out a "contchk" tag in the bb-hosts file. The proper
# syntax is: contchk;URL;REFERRER;CHECKSTRING
#
# Note that CHECKSTRING cannot contain spaces so you must use regular
# expression metacharacters, so use something like string.with.spaces
BBHTAG=contchk     # Name of the tag in bb-hosts
COLUMN=cont        # Column display name in Hobbit
CURL=/usr/bin/curl # Location of curl binary
CURLOPTS="--connect-timeout 30 -m 30 -s -L -b cookiejar" # Curl options
# Note: using grep because bbhostgrep fails on long lines
grep $BBHTAG $BBHOME/etc/bb-hosts | while read L
   do
      set $L    # To get one line of output from bbhostgrep
      HOSTIP="$1"
      MACHINEDOTS="$2"
      MACHINE=`echo $2 | $SED -e's/\./,/g'`
      CHECKURL=`echo $4 | awk -F";" '{print $2}'`    # Parse out the check URL
      REFERRER=`echo $4 | awk -F";" '{print $3}'`    # Parse out the referrer string
      if [ "" != "$REFERRER" ];
         then
           REFERRER="-e $REFERRER"
      fi
      CHECKSTRING=`echo $4 | awk -F";" '{print $4}'` # Parse out the check string
      $CURL $CURLOPTS $REFERRER $CHECKURL |grep -q "$CHECKSTRING"
      status=$? # Save greps return status
      if [ 0 -eq $status ]; then # grep returns 0 if it found something
        COLOR=green
        MSG="String <b>\"$CHECKSTRING\"</b> was found in <a href=$CHECKURL>$CHECKURL</a>"
        $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` Content Check OK
        ${MSG}
        "
      else # grep didn't find anything
        COLOR=red
        MSG="String <b>\"$CHECKSTRING\"</b> was NOT FOUND in <a href=$CHECKURL>$CHECKURL</a>"
        $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` Content Check FAILED
        ${MSG}
        "
      fi
   done
exit 0