[Xymon] if statment issue on ext script

James Louis jglouisjr at gmail.com
Thu Sep 25 15:32:26 CEST 2014


Just for test purposes can you add a line like "TESTWORD=`echo myTestWord`"
in each if statement and then add a line to the msg like "TESTWORD :
$TESTWORD" and then run it again.

Thanks,
Jim

On Thu, Sep 25, 2014 at 8:20 AM, Simioni, Rodney <rsimion at transunion.com>
wrote:

>  Sorry about that.
>
> The issue is that $HOST is not printed in the output next to SERVER.
>
>
>
> $BBHOME/bin/bbhostgrep $TESTNAME | while read IP HOSTNAME OTHER; do
>
>   if do_fetch $HOSTNAME $IP | grep "$REGEX" > /dev/null ; then
>
>
>
>
>
> if [[ `echo "$IP"` =~ ^10.xxx.xxx.1[0-9] ]]; then
>
> HOST=`echo "server33.test.corp.local"`
>
>
>
> elif [[ `echo "$IP"` =~ ^10.xxx.xxx.2[0-9] ]]; then
>
> HOST=`echo "server34.test.corp.local"`
>
>
>
> elif [[ `echo "$IP"` =~ ^10.xxx.xxx.3[0-9] ]]; then
>
> HOST=`echo "server35.test.corp.local"`
>
>
>
> elif [[ `echo "$IP"` =~ ^10.xxx.xxx.4[0-9] ]]; then
>
> HOST=`echo "server36.test.corp.local"`
>
>
>
> elif [[ `echo "$IP"` =~ ^10.xxx.xxx.5[0-9] ]]; then
>
> HOST=`echo "server37.test.corp.local"`
>
>
>
> elif [[ `echo "$IP"` =~ ^10.xxx.xxx.6[0-9] ]]; then
>
> HOST=`echo "server38.test.corp.local"`
>
>
>
> elif [[ `echo "$IP"` =~ ^10.xxx.xxx.7[0-9] ]]; then
>
> HOST=`echo "server39.test.corp.local"`
>
> fi
>
>
>
> if [ $(echo "$X < 10" | bc) -ne 0 ]; then
>
>             COL=green
>
>             MSG="
>
>             BIG BROTHER MESSAGE
>
>             -------------------
>
>             DATACENTER : D1
>
>             SERVER : "$HOST"
>
>             STATE : Normal
>
>             STATUS : Green
>
>             TEST : TestProd EchoTest
>
>             RESPONSE SUCCEEDED : "$X" sec
>
>             IP : "$IP"
>
>             EVENT TIME : `date +"%c"`
>
>
>
>             "
>
>
>
>            $BB $BBDISP "status $HOSTNAME.$TESTNAME $COL
>
>            $MSG"
>
> #########################
>
> Here is the output – notice that server is empty:
>
>
>
> XYMON MESSAGE
>             -------------------
>             DATACENTER : D1
>             SERVER :
>             STATE : Normal
>             STATUS : Green
>             TEST : test
>             RESPONSE SUCCEEDED : .079411876 sec
>             IPADDRESS : 10.xxx.xxx.xxx
>             EVENT TIME : Wed 24 Sep 2014 05:48:21 PM EDT
>
>
>
>
>
>
>
> *From:* Xymon [mailto:xymon-bounces at xymon.com] *On Behalf Of *James Louis
> *Sent:* Thursday, September 25, 2014 9:06 AM
> *To:* usa ims
> *Cc:* xymon at xymon.com
> *Subject:* Re: [Xymon] if statment issue on ext script
>
>
>
>
>
> On Wed, Sep 24, 2014 at 4:55 PM, usa ims via Xymon <xymon at xymon.com>
> wrote:
>
> XYMON MESSAGE
>             -------------------
>             DATACENTER : D1
>             SERVER :
>             STATE : Normal
>             STATUS : Green
>             TEST : test
>             RESPONSE SUCCEEDED : .079411876 sec
>             IPADDRESS : 10.xxx.xxx.xxx
>             EVENT TIME : Wed 24 Sep 2014 05:48:21 PM EDT
>
>
>
> Why is there more to your MSG than what is in your script?
>
> Jim
>
>
>
> --
>
>
>
>
>
>
> *     Jim Louis        \\\\||////        \ ~ ~  /        | @ @ |*
>
> *--oOo---(_)---oOo--*
>
> "If a free society cannot help the many who are poor, it cannot save the
> few who are rich." ~ John Kennedy
>



-- 






*     Jim Louis       \\\\||////       \ ~ ~  /       | @ @ |*


*--oOo---(_)---oOo--*

"If a free society cannot help the many who are poor, it cannot save the
few who are rich." ~ John Kennedy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20140925/266f847a/attachment.html>


More information about the Xymon mailing list