Golden Gate monitoring in OEM

I have migrated several database to Exadata using Golden Gate and i really liked the Golden Gate tool. The only thing i never really understood is why there was not a simple Enterprise Manager plug-in to monitor the Golden Gate status. So i decided to create a small script that can be used as a ‘User Defined Metric’ in OEM. For monitoring purposes i am only interested in knowing if my process is abended (status stopped means that i have deliberately stopped it, so i don’t need to know that) and what the lag time is. So i have created that small script i called ogg_status.sh, which i placed in my $GG_HOME directory:

#!/bin/bash
# set -x
########################################
#
# Usage ./ogg_status.sh -n GG_PROCES_NAME -t status|lagtime
# Klaas-Jan Jongsma 2011
#
# v.01
#
########################################
#Function to get info all from GGSCI
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/db_1/lib
infoall() {
cd /u01/app/oracle/product/ogg
(
./ggsci << eof
info all
exit
eof
)}
########################################
# Commandline options:
while getopts n:t: opt
do
  case "$opt" in
    n) NAME="$OPTARG";;
    t) TYPE="$OPTARG";;
  esac
done
#########################################
# Check status of Golden Gate processes
status()
{
# infoall |grep "$NAME" | awk '{print $2}'
cSTATUS="`infoall |grep "$NAME" | awk '{print $2}'`"
if [ "${cSTATUS}" = "ABENDED" ]
  then
  echo "em_result=ABENDED"
  echo "em_message=Golden Gate process ${NAME} status: ${cSTATUS}"
else
    if [ "${cSTATUS}" = "STOPPED" ]
      then
      echo "em_result=STOPPED"
    else echo "em_result=RUNNING"
    fi
    unset cSTATUS
fi
}
#########################################
# Check lagtime of Golden Gate processes
lagtime()
{
cLAGTIME="`infoall | grep $NAME | awk '{print $4}'`"
# echo $cLAGTIME
cLAGTIME_HOURS=`echo $cLAGTIME | awk -F: '{print $1}'`
CLAGTIME_MINUTES=`echo $cLAGTIME | awk -F: '{print $2}'`
cLAGTIME_SECONDS=`echo $cLAGTIME | awk -F: '{print $3}'`
cLAGTIME_SEC_TOTAL=$(($cLAGTIME_HOURS*3600+$CLAGTIME_MINUTES*60+$cLAGTIME_SECONDS))
echo "em_result=${cLAGTIME_SEC_TOTAL}"
echo "em_message=Golden Gate process ${NAME} lagtime is: ${cLAGTIME} (${cLAGTIME_SEC_TOTAL} seconds), check Golden Gate infrastructure."
unset cLAGTIME cLAGTIME_HOURS CLAGTIME_MINUTES cLAGTIME_SECONDS cLAGTIME_SEC_TOTAL
}
#########################################
# MAIN
case "$TYPE" in
  status)
     status
     ;;
  lagtime)
     lagtime
     ;;
esac
# set +x

Now we have a script that tells something about our Golden Gate status we can create an UDM in OEM, we do this at the host target level. Now go to the top right corner and click on create, to make a new UDM:

If you want to create an UDM that monitors the lag of a process fill it in somewhat similar like below. It will create an UDM whenever the extract/datapump process gets a lag bigger then 5 seconds:

For monitoring the status of an extract or manager process create the following. It monitors if a process gets the status abended

We now have our UDM in place, next step would be to create a notification rule. For this go to your OEM preferences, this is located at the top right most place in your OEM screen. In the preferences screen click on rules (located under notifications):

This will brings in the notification rules window, add a new rule here and add you host as a target for the rule:

Next go the the metrics tab and add two metrics, one UDM String metric and UDM number metric. We need the string UDM to monitor process status, the number UDM is needed for lag monitoring:

Next check the critical severity status:

We are done on the Metrics tab, final step is to tell OEM to send us an e-mail. Go to the last tab, actions, do so and check ‘Send me an e-mail':

If you have OEM alerting set up properly, you will now get mail if process gets abended or if the lag gets bigger then 5 seconds.

About these ads

4 thoughts on “Golden Gate monitoring in OEM

  1. Nice work. Was looking for something like this and I’m going to try the OGG for mgr abended status. We get this sometimes and unfortunately there is no way to start it up automatically. This will cerntaily do the job. Thanks.

  2. Hi. very nice article.
    I have a doubt about the script ogg_status.sh.
    How can i test just the script ?

    I have two replicat groups where the status of the first is RUNNING but the second is ABEND.
    I execute ./ogg_status.sh but dont show nothing
    is there something else wrong ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s