if statment issue on ext script

usa ims usaims at yahoo.com
Wed Sep 24 23:55:21 CEST 2014


The MSG still prints, here is what is printing. The server name is missing.

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

--------------------------------------------
On Wed, 9/24/14, Ribeiro, Glauber <glauber.ribeiro at experian.com> wrote:

 Subject: RE: if statment issue on ext script
 To: "usa ims" <usaims at yahoo.com>, "xymon at xymon.com" <xymon at xymon.com>
 Date: Wednesday, September 24, 2014, 4:49 PM
 
 Why all the
 "echo"s? :-) they don't seem to be adding
 anything to just having the variable there.
 
 But anyway, I think the
 problem is that your first double quote in the
 "HOST" line is ending your MSG string.
 
 g
 
 -----Original Message-----
 From: usa ims [mailto:usaims at yahoo.com]
 
 Sent: Wednesday, September 24, 2014
 14:55
 To: xymon at xymon.com
 Subject: if statment issue on ext script
 
 Hi,
 
 if statement not working in my ext script. Once
 the script is executed, the hostname is not showing
 up in the MSG statement -- do you see anything
 obvious? I needed to 'x' out the ipaddress so my
 boss 
 won't have a security panic
 attack.
 
 
 $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.misc.corp.local"`
 
 elif [[ `echo "$IP"` =~
 ^10.xxx.xxx.2[0-9] ]]; then
 HOST=`echo
 "server34.misc.corp.local"`
 
 elif [[ `echo "$IP"` =~
 ^10.xxx.xxx.3[0-9] ]]; then
 HOST=`echo
 "server35.misc.corp.local"`
 
 elif [[ `echo "$IP"` =~
 ^10.xxx.xxx.4[0-9] ]]; then
 HOST=`echo
 "server36.misc.corp.local"`
 
 elif [[ `echo "$IP"` =~
 ^10.xxx.xxx.5[0-9] ]]; then
 HOST=`echo
 "server37.misc.corp.local"`
 
 elif [[ `echo "$IP"` =~
 ^10.xxx.xxx.6[0-9] ]]; then
 HOST=`echo
 "server38.misc.corp.local"`
 
 elif [[ `echo "$IP"` =~
 ^10.xxx.xxx.7[0-9] ]]; then
 HOST=`echo
 "server39.misc.corp.local"`
 fi
 
 ####
 MSG="
 XYMON MESSAGE
 ------------------
 SERVER :
 "$HOST" ## printing blank here
 IPADDRESS : $IP  ## ipaddress is echoing
 fine.
 "
 
 $BB $BBDISP "status $HOSTNAME.$TESTNAME
 $COL
 $MSG"
 
 
 



More information about the Xymon mailing list