Xymon Mailing List Archive search

if statment issue on ext script

list Usa Ims
Wed, 24 Sep 2014 12:54:44 -0700
Message-Id: <user-60c303d11cf0@xymon.invalid>

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"