Xymon Mailing List Archive search

variable for test script in bb-hosts?

3 messages in this thread

list Kolbjørn Barmen · Wed, 31 May 2006 00:15:52 +0200 (CEST) ·
I have a small challenge at hand.. I have a test that involves checking
information about a host on some certain web source, however, depending on
the host the "base" URL of the source is different. So I'm podinger if
it is possible to this in bb-hosts, kind of like how the http test works
with cont=bla:http://blabla;bla 

I picture something like mytest;key=val and then being able to pick up
${key} with value "val" from the test script.

The alternative is to have a new test for each "val", and several quite
identical test scripts.

-- 
Kolbjørn Barmen
UNINETT Driftsenter
list Henrik Størner · Wed, 31 May 2006 10:45:34 +0200 ·
quoted from Kolbjørn Barmen
On Wed, May 31, 2006 at 12:15:52AM +0200, Kolbjørn Barmen wrote:
I picture something like mytest;key=val and then being able to pick up
${key} with value "val" from the test script.
Since your test script is a custom script, there is no problem in doing
that. Use something like this in your script:

#!/bin/sh
$BBHOME/bin/bbhostgrep --no-extras "mytest*" | \
while read L
do
    set $L
    IP=$1; shift
    MACHINE=$1; shift
    shift
    TESTSPEC=$1

    OPTVAL=`echo "$TESTSPEC" | cut -d';' -f2`
    echo "Testing machine $MACHINE with option $OPTVAL"
done


Regards,
Henrik
list Kolbjørn Barmen · Wed, 31 May 2006 16:33:08 +0200 (CEST) ·
quoted from Henrik Størner
On Wed, 31 May 2006, Henrik Stoerner wrote:
On Wed, May 31, 2006 at 12:15:52AM +0200, Kolbjørn Barmen wrote:
I picture something like mytest;key=val and then being able to pick up
${key} with value "val" from the test script.
Since your test script is a custom script, there is no problem in doing
that. Use something like this in your script:

#!/bin/sh
$BBHOME/bin/bbhostgrep --no-extras "mytest*" | \
while read L
do
    set $L
    IP=$1; shift
    MACHINE=$1; shift
    shift
    TESTSPEC=$1

    OPTVAL=`echo "$TESTSPEC" | cut -d';' -f2`
    echo "Testing machine $MACHINE with option $OPTVAL"
done
Ah, ofcourse - bbhostgrep - how obvious, silly me :)

-- 
Kolbjørn Barmen
UNINETT Driftsenter