Xymon Mailing List Archive search

Any docs on how to write tests?

6 messages in this thread

list J. Bobby Lopez · Fri, 19 Aug 2011 15:31:55 -0400 ·
Looking for a way to write tests that check a URL, and return fail/pass
depending on the content.

I could easily use curl to do this, but I'm looking for information on how
to integrate the curl command line into xymon as a test.

So far as I can see, the bb-services file only accepts test definitions by
port, but I may be missing something.

Thanks in advance!

-Bobby
list Henrik Størner · Fri, 19 Aug 2011 22:28:55 +0200 ·
quoted from J. Bobby Lopez
On 19-08-2011 21:31, J. Bobby Lopez wrote:
Looking for a way to write tests that check a URL, and return fail/pass
depending on the content.

I could easily use curl to do this, but I'm looking for information on
how to integrate the curl command line into xymon as a test.
Re-inventing the wheel, eh ?

Try reading up on the "cont" style test (see the hosts.cfg(5) man-page).


Regards,
Henrik
list J. Bobby Lopez · Fri, 19 Aug 2011 16:53:00 -0400 ·
I have some systems running Xymon 4.2.3, I'm guessing the 'cont' attribute,
along with hosts.cfg are not available in that version?
quoted from Henrik Størner


On Fri, Aug 19, 2011 at 4:28 PM, Henrik Størner <user-ce4a2c883f75@xymon.invalid> wrote:
On 19-08-2011 21:31, J. Bobby Lopez wrote:
Looking for a way to write tests that check a URL, and return fail/pass
depending on the content.

I could easily use curl to do this, but I'm looking for information on
how to integrate the curl command line into xymon as a test.
Re-inventing the wheel, eh ?

Try reading up on the "cont" style test (see the hosts.cfg(5) man-page).


Regards,
Henrik

list J. Bobby Lopez · Fri, 19 Aug 2011 17:17:05 -0400 ·
sounds like I'll be upgrading soon.  Thanks Henrik.
quoted from J. Bobby Lopez

On Fri, Aug 19, 2011 at 4:53 PM, J. Bobby Lopez <user-cf5303e672c8@xymon.invalid> wrote:
I have some systems running Xymon 4.2.3, I'm guessing the 'cont' attribute,
along with hosts.cfg are not available in that version?


On Fri, Aug 19, 2011 at 4:28 PM, Henrik Størner <user-ce4a2c883f75@xymon.invalid> wrote:
On 19-08-2011 21:31, J. Bobby Lopez wrote:
Looking for a way to write tests that check a URL, and return fail/pass
depending on the content.

I could easily use curl to do this, but I'm looking for information on
how to integrate the curl command line into xymon as a test.
Re-inventing the wheel, eh ?

Try reading up on the "cont" style test (see the hosts.cfg(5) man-page).


Regards,
Henrik

list Ralph Mitchell · Fri, 19 Aug 2011 17:29:56 -0400 ·
It's not too hard to script url tests.  Below is one I wrote to check an RSA
key server appliance.  You can have xymon kick it off for you by adding
something like this to server/etc/hobbitlaunch.cfg:

 [keysrv]
ENVFILE /home/xymon/server/etc/xymonserver.cfg
NEEDS xymond
CMD /home/xymon/server/ext/rkmsrv.sh
LOGFILE $XYMONSERVERLOGS/rkmsrv.log
INTERVAL 5m

Obviously you can do substantially more complicated things than would be
possible in the regular "cont" check.

Ralph Mitchell
=========================================================
#!/bin/sh

# set -x

TESTHOST=rkm.example.com
TESTMSG='Get Key Successful'
OUTFILE=$BBTMP/rkm.html

rm -f $OUTFILE
TIME=`curl -s -S -L -m 30 -w '%{time_total}' \
  --cacert $BBHOME/trusted_cas.pem \
  -o $OUTFILE \
  "https://
$TESTHOST/rkmawa/healthCheck.do?keyclass=xymon&rootca=/root/CA/demoCA/trusted_cas.
pem&client=/root/CA/demoCA/certs/xymon.p12"`

STATUS=`grep -c 'Get Key Successful' $BBTMP/rkm.html`
if [ "$STATUS" -eq "1" ]; then
  COLOR=green
  MESSAGE="Found <b>$TESTMSG</b>.  Key server looks OK"
else
  COLOR=red
  MESSAGE="Failed to find <b>$TESTMSG</b>.  Key server may be in trouble"
fi

MESSAGE="$MESSAGE

<pre>
`cat $BBTMP/rkm.html`
</pre>
<p>
Query: $TIME secs"

# `cat $BBTMP/rkm.html | sed -e 's/:/%3A/g'`
MACHINE=`echo $TESTHOST | sed -e 's/\./\,/g'`
$BB $BBDISP "status $MACHINE.keysrv $COLOR `date`

$MESSAGE"
exit 0
quoted from J. Bobby Lopez

==========================================

On Fri, Aug 19, 2011 at 5:17 PM, J. Bobby Lopez <user-cf5303e672c8@xymon.invalid> wrote:
sounds like I'll be upgrading soon.  Thanks Henrik.


On Fri, Aug 19, 2011 at 4:53 PM, J. Bobby Lopez <user-cf5303e672c8@xymon.invalid> wrote:
I have some systems running Xymon 4.2.3, I'm guessing the 'cont'
attribute, along with hosts.cfg are not available in that version?


On Fri, Aug 19, 2011 at 4:28 PM, Henrik Størner <user-ce4a2c883f75@xymon.invalid> wrote:
On 19-08-2011 21:31, J. Bobby Lopez wrote:
Looking for a way to write tests that check a URL, and return fail/pass
depending on the content.

I could easily use curl to do this, but I'm looking for information on
how to integrate the curl command line into xymon as a test.
Re-inventing the wheel, eh ?

Try reading up on the "cont" style test (see the hosts.cfg(5) man-page).


Regards,
Henrik

list Henrik Størner · Sat, 20 Aug 2011 17:31:54 +0200 ·
quoted from J. Bobby Lopez
On 19-08-2011 22:53, J. Bobby Lopez wrote:
I have some systems running Xymon 4.2.3, I'm guessing the 'cont'
attribute, along with hosts.cfg are not available in that version?
content-checks have been in Xymon / Hobbit / bbgen since version 2.0 
(released in early 2003).


Regards,
Henrik