tags:

views:

7

answers:

0

Hello,

We have a Suse Linux 11 server with network bonding which we named DBSERVER.

With the following script running on another similar machine named CLIENTMACHINE, we observe no errors when pointing the script toward DBSERVER:

(begin script)

 #!/bin/bash

 # parameter: IP address 

 if [ ${#*} != 1 ]
 then
  echo "Need one parameter: IP address"
  exit 1
 fi

 echo "Please monitor log with command tail -f /root/bin/report_ping_${1}.txt"

 echo "Script began at `date +'%Y-%m-%d %T'`" >> /root/bin/report_ping_${1}.txt

 while [ 1 ]
 do
  RESULT=`ping -c 1 "${1}" | grep transmitted`
  #echo "RESULT is ${RESULT}"

  PERCENTAGE_LOST=`echo $RESULT | awk '{ print $6 }'`
  #echo "PERCENTAGE_LOST is ${PERCENTAGE_LOST}"

  NUMBER_LOST=${PERCENTAGE_LOST:0:${#PERCENTAGE_LOST}-1}
  #echo "NUMBER_LOST is ${NUMBER_LOST}"

  if [ "${NUMBER_LOST}" != "0" ]
  then
   echo "${PERCENTAGE_LOST} lost for ${1} at `date +'%Y-%m-%d %T'`" >> /root/bin/report_ping_${1}.txt
  fi
 done

(end script)

However if we use the same script pointing from DBSERVER to CLIENTMACHINE, we observe errors in the log.

Any suggestions on what to check for?

Thanks in advance,

Bert