Wednesday, February 13, 2019

Monitor Cluster Time Synchronization

# check_time_sync.ksh
# This script checks clock synchronization between all nodes of the cluster
#
#
. ~oracle/.database_profile
. ~oracle/.cluster_profile
cluhost=`hostname`
export CLUHOST=`echo $cluhost |awk -F. '{print $1}'`
export PRODDIR=~oracle/prod/
LogDate=`date +%Y%m%d.%H%M%S`
CLULOG=/tmp/cluvfy_clocksync_$LogDate.log

export CLULOG CLUERR ERREMAIL

$ORACLE_HOME/bin/cluvfy comp clocksync -n all > $CLULOG
CLUERR=`grep 'Verification of Clock Synchronization across the cluster nodes was successful.' $CLULOG | wc -l`

if [  "${CLUERR}" -eq 0  ] ; then
  mail -s "${CLUHOST}"': Alarm: Clock Synchronization check failed between nodes of the cluster' $ERREMAIL < $CLULOG
else
 CLUERR=`grep 'PRVF-5413' $CLULOG | wc -l`
 if [ "${CLUERR}" -gt 0 ] ; then
    mail -s "${CLUHOST}"': Alarm: Clock Synchronization check failed between nodes of the cluster' $ERREMAIL < $CLULOG
 fi
fi


rm -f $CLULOG

No comments:

Post a Comment