Shells Script to Monitor Golden Gate processes are stopped or abended
Shells Script to Monitor Golden Gate processes are stopped or abended
#!/bin/ksh
#---------------------------------------------------------------#
# Script to check the Statistics in the Golden Gate #
#---------------------------------------------------------------#
# Annadakant Mishra (qa853)
# Feb 2018
set -x
#---------------------------------------------------------------#
# Function to check on Statistics on GG running #
#---------------------------------------------------------------#
HOST=`hostname`
ORACLE_BASE=/u02/app/oracle; export ORACLE_BASE
export GG_HOME=/u02/app/oracle/product/11.1.1.0.27
export ORACLE_LOG=/u02/app/oracle/local/logs
PATH=$PATH:$HOME/bin:/bin:/usr/bin:/usr/local/bin:$GG_HOME; export PATH
ACTIVE_GG_NODE=`hostname`
#MAIL_ADDRESS=
#MAIL_ADDRESS=qa853@gmail.com
SCRIPT_BASE=/u02/app/oracle/local/scripts/ggMon
LogFile=/u02/app/oracle/local/logs/GoldenGate_LagMon.log
#Create check file
CHKDT=`date "+%Y%m%d"`
touch $ORACLE_LOG/GGmon_$CHKDT.chk
if [[ $ACTIVE_GG_NODE = "" ]]; then
echo "GG not running on Server"
CHECK=A
else
echo "GG Running on server :${ACTIVE_GG_NODE}"
CHECK=S
if [[ $ACTIVE_GG_NODE = `hostname` ]]; then
cd $GG_HOME
./ggsci > $ORACLE_LOG/ggsci_lag_status.txt<<EOF
info *
lag *
stats * reportrate HR
EOF
./ggsci > $ORACLE_LOG/ggsci_process_status.txt<<EOF
info all
send *,status
EOF
else
ssh $ACTIVE_GG_NODE 'ksh -s' < ${SCRIPT_BASE}/second_node_lag_check.sh >> $LogFile
scp -p oracle@$ACTIVE_GG_NODE:$ORACLE_LOG/ggsci_lag_status.txt $ORACLE_LOG
fi
fi
grep -w 'RUNNING\|Sequence #:\|RBA:' $ORACLE_LOG/ggsci_process_status.txt 1>>/dev/null 2>>/dev/null
if [ $? -eq 0 ]
then
grep -w 'RUNNING\|Sequence #:\|RBA:' $ORACLE_LOG/ggsci_process_status.txt | while read line
do
proc_name=`echo $line | awk -F" " '{print $2}'`
proc_stat=`echo $line | awk -F" " '{print $3}'`
sequence_no=`echo $line | awk -F" " '{print $11}'`
rba_no=`echo $line | awk -F" " '{print $12}'`
if [ $proc_name == "ROMAH04T" ] || [ $proc_name == "ROMAH02T" ]
then
echo "Legacy system is shutdown"
else
MONSTR=`echo "$proc_name|$proc_stat|$sequence_no|$rba_no"`
COUNTER=`cat $ORACLE_LOG/GGmon_$CHKDT.chk | grep $MONSTR | wc -l`
if [ $COUNTER -ge 1 ]
then
echo " ---------------- No action ---------------- "
else
/u02/app/oracle/local/scripts/ggMon/create_ticket8.sh `echo $proc_name` `echo $proc_stat`
echo "$proc_name|$proc_stat|$sequence_no|$rba_no" >> $ORACLE_LOG/GGmon_$CHKDT.chk
fi
fi
done
fi
#mailx -s "Teradata GoldenGate Statistics from $HOST" $MAIL_ADDRESS < $ORACLE_LOG/ggsci_lag_status.txt
#!/bin/ksh
#---------------------------------------------------------------#
# Script to check the Statistics in the Golden Gate #
#---------------------------------------------------------------#
# Annadakant Mishra (qa853)
# Feb 2018
set -x
#---------------------------------------------------------------#
# Function to check on Statistics on GG running #
#---------------------------------------------------------------#
HOST=`hostname`
ORACLE_BASE=/u02/app/oracle; export ORACLE_BASE
export GG_HOME=/u02/app/oracle/product/11.1.1.0.27
export ORACLE_LOG=/u02/app/oracle/local/logs
PATH=$PATH:$HOME/bin:/bin:/usr/bin:/usr/local/bin:$GG_HOME; export PATH
ACTIVE_GG_NODE=`hostname`
#MAIL_ADDRESS=
#MAIL_ADDRESS=qa853@gmail.com
SCRIPT_BASE=/u02/app/oracle/local/scripts/ggMon
LogFile=/u02/app/oracle/local/logs/GoldenGate_LagMon.log
#Create check file
CHKDT=`date "+%Y%m%d"`
touch $ORACLE_LOG/GGmon_$CHKDT.chk
if [[ $ACTIVE_GG_NODE = "" ]]; then
echo "GG not running on Server"
CHECK=A
else
echo "GG Running on server :${ACTIVE_GG_NODE}"
CHECK=S
if [[ $ACTIVE_GG_NODE = `hostname` ]]; then
cd $GG_HOME
./ggsci > $ORACLE_LOG/ggsci_lag_status.txt<<EOF
info *
lag *
stats * reportrate HR
EOF
./ggsci > $ORACLE_LOG/ggsci_process_status.txt<<EOF
info all
send *,status
EOF
else
ssh $ACTIVE_GG_NODE 'ksh -s' < ${SCRIPT_BASE}/second_node_lag_check.sh >> $LogFile
scp -p oracle@$ACTIVE_GG_NODE:$ORACLE_LOG/ggsci_lag_status.txt $ORACLE_LOG
fi
fi
grep -w 'RUNNING\|Sequence #:\|RBA:' $ORACLE_LOG/ggsci_process_status.txt 1>>/dev/null 2>>/dev/null
if [ $? -eq 0 ]
then
grep -w 'RUNNING\|Sequence #:\|RBA:' $ORACLE_LOG/ggsci_process_status.txt | while read line
do
proc_name=`echo $line | awk -F" " '{print $2}'`
proc_stat=`echo $line | awk -F" " '{print $3}'`
sequence_no=`echo $line | awk -F" " '{print $11}'`
rba_no=`echo $line | awk -F" " '{print $12}'`
if [ $proc_name == "ROMAH04T" ] || [ $proc_name == "ROMAH02T" ]
then
echo "Legacy system is shutdown"
else
MONSTR=`echo "$proc_name|$proc_stat|$sequence_no|$rba_no"`
COUNTER=`cat $ORACLE_LOG/GGmon_$CHKDT.chk | grep $MONSTR | wc -l`
if [ $COUNTER -ge 1 ]
then
echo " ---------------- No action ---------------- "
else
/u02/app/oracle/local/scripts/ggMon/create_ticket8.sh `echo $proc_name` `echo $proc_stat`
echo "$proc_name|$proc_stat|$sequence_no|$rba_no" >> $ORACLE_LOG/GGmon_$CHKDT.chk
fi
fi
done
fi
#mailx -s "Teradata GoldenGate Statistics from $HOST" $MAIL_ADDRESS < $ORACLE_LOG/ggsci_lag_status.txt
Comments
Post a Comment