[Xymon] Any docs on how to write tests?

Ralph Mitchell ralphmitchell at gmail.com
Fri Aug 19 23:29:56 CEST 2011


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

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

On Fri, Aug 19, 2011 at 5:17 PM, J. Bobby Lopez <jbl at jbldata.com> wrote:

> sounds like I'll be upgrading soon.  Thanks Henrik.
>
>
> On Fri, Aug 19, 2011 at 4:53 PM, J. Bobby Lopez <jbl at jbldata.com> 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 <henrik at hswn.dk> 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
>>> _______________________________________________
>>> Xymon mailing list
>>> Xymon at xymon.com
>>> http://lists.xymon.com/mailman/listinfo/xymon
>>>
>>
>>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20110819/ad401c35/attachment.html>


More information about the Xymon mailing list