Hello Oracle Golden Gate – Super simple Golden Gate monitor shellscript

We are setting up a test site for oracle golden gate. I missed a extract process that was abended so I wrote this little script to send me an email once one ore more process in Golden Gate show status of anbended – or better when ‘grep ABENDED’ returns anything.

Nothing shocking really – it’s just grep.

#!/usr/bin/ksh

# constants
# -------------------------------------------------------------------------
GOLDENGATE_HOME=/ora/product/goldengate/112101
ORACLE_HOME=/ora/product/db/11203
MAILTO=remivisser@domain.com


# no more editting pas this point
# -------------------------------------------------------------------------
LD_LIBRARY_PATH=${ORACLE_HOME}/lib
export LD_LIBRARY_PATH

# for some utter reason you need to cd to Golden Gate home or else i got
# Could not load program /ora/product/goldengate/112101/ggsci:
#         Dependent module libgglog.a could not be loaded.
# Could not load module libgglog.a.
# System error: No such file or directory

cd ${GOLDENGATE_HOME}

# start golden gate with eof and execute 'info all' and 
golden_gate_infoall=`${GOLDENGATE_HOME}/ggsci << EOF
info all
EOF`

# grep for ABENDED string
golden_gate_infoall=`echo $golden_gate_infoall | grep ABENDED`


if [[ "" = ${golden_gate_infoall} ]] ;
then
  exit 0
else
  # found 'ABENDED' - send email
  echo $golden_gate_infoall | mailx -s "One or more Golden Gate process abended at $(hostname)" ${MAILTO}
  exit 2
fi
# set permission
$ chmod u+x ggscs-status.sh

# execute the script
$ ggscs-status.sh

# query the exit code
$ echo $?
0

Example email

                                                                                                                                                                                                                                                               
Date: Tue, 27 Aug 2013 15:57:22 +0200
From: Oracle dba account <oracle@domain.com>
To: remivisser@domain.com
Subject: One or more Golden Gate process abended at ********

Oracle GoldenGate Command Interpreter for Oracle Version 11.2.1.0.6_03 16934271 17084347 AIX 5L, ppc, 64bit (optimized), Oracle 11g on Jul 12 2013 12:27:04 Copyright (C) 1995, 2013, Oracle and/or its affiliates. All rights reserved. GGSCI (********) 1> Program Status Group Lag at Chkpt Time Since Chkpt MANAGER RUNNING EXTRACT RUNNING {EXTRACT_NAME} 00:00:00 00:00:01 EXTRACT RUNNING {POMP_NAME} 00:00:00 00:00:06 GGSCI (********) 2>

Check every thirty minutes (1800 seconds) the ad hoc (uat/non-production) way:
Below solution is ok for testing.

$ cat ggscs-status-1800.sh
#!/usr/bin/ksh

while true
do
  ~/ggscs-status.sh
  sleep 1800
done

$ nohup ggscs-status-1800.sh &
[1]     21430350
$ Sending output to nohup.out

5 thoughts on “Hello Oracle Golden Gate – Super simple Golden Gate monitor shellscript

  1. Mani Morla says:

    hi,

    I scheduled your script and ran but its not giving notifying.let me confirm with my script with below if i did wrong

    #!/sbin/sh
    
    # constants
    # -------------------------------------------------------------------------
    GOLDENGATE_HOME=/usr3/apl/ogg/ogg11
    ORACLE_HOME=/usr3/apl/ora11202/product/11.2.0
    MAILTO=mani.morla@atos.net
    
    # no more editting pas this point
    # -------------------------------------------------------------------------
    LD_LIBRARY_PATH=${ORACLE_HOME}/lib
    export LD_LIBRARY_PATH
    
    
    cd ${GOLDENGATE_HOME}
    
    # start golden gate with eof and execute 'info all' and 
    golden_gate_infoall=`${GOLDENGATE_HOME}/ggsci << EOF
    info all
    EOF`
    
    # grep for ABENDED string
    golden_gate_infoall=`echo $golden_gate_info all | grep STOPPED`
    
    
    if [[ "" = ${golden_gate_infoall} ]] ;
    then
      exit 0
    else
      # found 'ABENDED' - send email
      echo $golden_gate_infoall | mailx -s "One or more Golden Gate process abended at $(hostname)" ${MAILTO}
      exit 2
    fi
    

    Thanks in advance

    1. remivisser says:

      Hi man,
      Did you test if you can actually email from the system? Ie if the email daemon is started. And/or routing to your (remote) email address is not blocked.

      So did you test if you get an email from c\ommdn below:

      echo "Email test message" | mailx -s "Email test subject" mani.morla@atos.net
      
  2. Mani Morla says:

    Hi

    Thanks for your prompt reply i will check and update you

  3. Mani Morla says:

    I did not receive any email notification from my system with specified command.

    I guess Email daemon not started ,How can i check whether daemon was started or not

    Help me on this

    Thanks
    Mani

  4. Phani says:

    How to get the output of info in a good format to mail ?

Leave a Reply

Helpful? - leave your note below so I can brag

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>