Scripts para Monitorar o Goldengate

####################################################################################################
#script       :moncolor.sh
#função       :Evidencia lags, abends e stops, também mostra hora do ultimo checkpoint
#Dependencias : gerainfoacs1.sh e gerainfoacs.sh
#autor        :Alexandre Pires
#data criação :22/01/2014
#OBSERVAÇÂO   :Dever ser criado no Home do Goldengate esse script chama os dependentes
#How To       : sh moncolor.sh
####################################################################################################
while true
do
echo "================================================================="
echo "INSTANCIA -->" $ORACLE_SID
DATABKP=`date +%Y%m%d%H%M%S`
date
echo "================================================================="
echo "                     ULTIMOS CHECKPOINTS "
echo "================================================================="
sh gerainfoacs1.sh > gerainfoacs.txt
awk ' {     if ($1 == "REPLICAT" ) printf("%s ", $2" hora de ultimo checkpoint -->")
       else if ($3 == "RBA" ){print $2;}
}' gerainfoacs.txt
echo "================================================================="
echo "INFO ALL -- "
echo "PROCESSO   STATUS NOME      LAG          CHECKPOINT"
echo "================================================================="
sh gerainfoacs.sh > gerainfoacs.txt
awk '
{  if ($5>"00:05:00" && $2 == "RUNNING" )  {system("tput sgr0 ~/"); system("tput bold ~/"); system("tput setaf 3 ~/");  print $0 "<- CHKPOINT!"; system("tput sgr0~/");}
else if ($4>="00:05:00" && $2 == "RUNNING" )  {system("tput sgr0 ~/"); system("tput bold ~/"); system("tput setaf 3 ~/");  print $0 "<- LAG ALTO!"; system("tput sgr0 ~/");}
else if ($4<"00:05:00"  && $2 == "RUNNING" )  {system("tput setaf 9 ~/"); print $0 ; system("tput sgr0 ~/");}
else if ($2 == "ABENDED" ){system("tput bold ~/")system("tput setaf 1 ~/");  print $0 "<- " $2; system("tput sgr0 ~/")}
else if ($2 == "STOPPED" ){system("tput bold ~/")system("tput setaf 1 ~/");  print $0 "<- " $2; system("tput sgr0 ~/")}
else system("tput sgr0 ~/");
}' gerainfoacs.txt
echo "================================================================="
sleep 10
done
####################################################################################################

####################################################################################################
#script       :gerainfoacs1.sh
#função       :mostra status de todas as filas detalhadas
#Dependencias :não depende de outros scripts
#autor        :Alexandre Pires
#data criação :22/01/2014
#OBSERVAÇÂO   :Dever ser criado no Home do Goldengate
#How To       : é chamado pelo moncolor.sh
####################################################################################################
./ggsci << EOF
info *
exit
EOF
####################################################################################################
####################################################################################################
#script       :gerainfoacs.sh
#função       :mostra status de todas filas resumido
#autor        :Alexandre Pires
#Dependencias :não depende de outros scripts
#data criação :22/01/2014
#OBSERVAÇÂO   :Dever ser criado no Home do Goldengate
#How To       : é chamado pelo moncolor.sh
####################################################################################################
./ggsci << EOF
info all
exit
EOF
####################################################################################################

##############versão com nawk do solaris

####################################################################################################
#script       :moncolor.sh
#função       :Evidencia lags, abends e stops, também mostra hora do ultimo checkpoint
#Dependencias : gerainfoacs1.sh e gerainfoacs.sh
#autor        :Alexandre Pires
#data criação :22/01/2014
#OBSERVAÇÂO   :Dever ser criado no Home do Goldengate esse script chama os dependentes
#How To       : sh moncolor.sh
#Versão para SOLARIS
####################################################################################################
while true
do
echo "================================================================="
echo "INSTANCIA -->" $ORACLE_SID
DATABKP=`date +%H:%M`
date
echo "================================================================="
echo "                     ULTIMOS CHECKPOINTS "
echo "================================================================="
sh gerainfoacs1.sh > gerainfoacs.txt
nawk -v DTHORA=$DATABKP '{ if ($1 == "REPLICAT" ) printf( "%s", $2" -->")
                                     else if ($3 == "RBA" )
                                                  if (substr($2,1,5) == DTHORA) {system("tput sgr0 ~/"); print substr($2,1,8)}
                                                  else if ($3 == "RBA" ) {system("tput bold ~/");print substr($2,1,8) " LAG NO CHECKPOINT!" DTHORA}
                               }' gerainfoacs.txt
echo "================================================================="
echo "INFO ALL -- "
echo "PROCESSO   STATUS  NOME        LAG          CHECKPOINT"
echo "================================================================="
sh gerainfoacs.sh > gerainfoacs.txt
nawk '
{  if ($5>"00:05:00" && $2 == "RUNNING" )  {system("tput sgr0 ~/"); system("tput bold ~/"); system("tput setaf 3 ~/");  print $0 "<- CHKPOINT!"; system                 ("tput sgr0~/");}
else if ($4>="00:05:00" && $2 == "RUNNING" )  {system("tput sgr0 ~/"); system("tput bold ~/"); system("tput setaf 3 ~/");  print $0 "<- LAG ALTO!"; sy                 stem("tput sgr0 ~/");}
else if ($4<"00:05:00"  && $2 == "RUNNING" )  {system("tput setaf 9 ~/"); print $0 ; system("tput sgr0 ~/");}
else if ($2 == "ABENDED" ){system("tput bold ~/")system("tput setaf 1 ~/");  print $0 "<- " $2; system("tput sgr0 ~/")}
else if ($2 == "STOPPED" ){system("tput bold ~/")system("tput setaf 1 ~/");  print $0 "<- " $2; system("tput sgr0 ~/")}
else system("tput sgr0 ~/");
}' gerainfoacs.txt
echo "================================================================="
sleep 10
done

Sobre Alexandre Pires

ORACLE OCS Goldengate Specialist, OCE RAC 10g R2, OCP 12C, 11g, 10g , 9i e 8i - Mais de 25 anos de experiência na área de TI. Participei de projetos na G&P alocado na TOK STOK, EDINFOR alocado na TV CIDADE "NET", 3CON Alocado no PÃO DE AÇUCAR, DISCOVER alocado na VIVO, BANCO IBI e TIVIT, SPC BRASIL, UOLDIVEO alocado no CARREFOUR e atualmente na ORACLE ACS atendendo os seguintes projetos: VIVO, CLARO, TIM, CIELO, CAIXA SEGUROS, MAPFRE, PORTO SEGURO, SULAMERICA, BRADESCO SEGUROS, BANCO BRADESCO, BASA, SANTANDER, CNJ, TSE, ELETROPAULO, EDP, SKY, NATURA, ODEBRESHT, NISSEI, SICREDI, CELEPAR, TAM, TIVIT, IBM, SMILES, CELEPAR, SERPRO,OKI,BANCO PAN, etc
Esse post foi publicado em ORACLE 11gR2. Bookmark o link permanente.

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s