oracle_gg_monitoring_scripts

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
oracle_gg_monitoring_scripts [2019/07/01 13:21] – created andonovjoracle_gg_monitoring_scripts [2019/10/18 20:04] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====Overview==== +Monitoring with scripts is based on collecting data and sending mails :) At least in my case. 
-The script is relatively simple consisting of:+Because of that there are couple things which I configured already:
  
-  * Get data from the GGSCI console 
-  * Send mail using mailx(mail), if needed 
  
- +  [[oracle_gg_monitoring_status Golden Gate Status]] 
-===Script=== +  - [[oracle_golden_gate_table_crosscheck Table crosscheck ]]
-<sxh bash> +
-#!/bin/bash +
-EMAIL_LIST="email1,email2,email3" +
- +
- +
-OIFS=$IFS +
-IFS=" +
-+
-NIFS=$IFS +
- +
-function status { +
-OUTPUT=`$GG_HOME/ggsci << EOF +
-info all +
-exit +
-EOF` +
-+
- +
-function alert { +
-for line in $OUTPUT +
-do +
-GNAME=$(echo "${line}" | awk -F" " '{print $3}'+
-GSTAT=$(echo "${line}" awk -F" " '{print $2}') +
-GTYPE=$(echo "${line}" | awk -F" " '{print $1}'+
-if [[ $(echo "${line}"|egrep 'STOP|ABEND' >/dev/null;echo $?) = 0 ]] +
-then +
-case $GTYPE in +
-"MANAGER"+
-echo "" | mailx -s "${HOSTNAME} - GoldenGate ${GTYPE} ${GSTAT}" $NOTIFY $EMAIL_LIST -- smtp="private_smprt_server_if_such_exists" -f "[email protected]"  +
- ;; +
-"EXTRACT"|"REPLICAT"+
-echo "" | mailx -s "${HOSTNAME} - GoldenGate ${GTYPE} ${GNAME} ${GSTAT}" $EMAIL_LIST -- smtp="private_smprt_server_if_such_exists" -f "[email protected]"  +
- ;; +
-esac +
-fi +
-done +
-+
- +
-export GG_HOME=GG_HOME_PATH; +
-export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 +
-export LD_LIBRARY_PATH=$ORACLE_HOME/lib +
-export ORACLE_SID=SID_NAME +
-status +
-alert +
-</sxh> +
- +
- +
- +
-===Crontab=== +
-We can schedule this script to run every 1 hour to see how it goes :) +
- +
-<sxh bash> +
-0 * * * * /bin/sh /home/oracle/run_goldenGate_check.sh > /dev/null +
-</sxh> +
- +
- +
-**P.S.** This script will produce a message ONLY when something is STOPPED or ABENDED. NOT IF IT IS WORKING FINE.+
  • oracle_gg_monitoring_scripts.1561987285.txt.gz
  • Last modified: 2019/10/18 20:04
  • (external edit)