if statment issue on ext script

usa ims usaims at yahoo.com
Wed Sep 24 21:54:44 CEST 2014


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