Fabric … Simple #GoldenGate Administration over SSH
For awhile now, I’ve been looking at different approaches for automating some of my GoldenGate monitor tasks. Yes, there are tools out there that provide a wide variety of ways for interaction and monitoring of Oracle GoldenGate. However, the problem with Oracle GoldenGate is that you have at least two parts of the equation when interacting or monitoring an environment, i.e. source and target. If you are so lucky to have a multi-master configuration, then you have to deal with multiple target sites. In the end, making administration and knowing what is going on a bit of a time-consuming process.
I’ve looked at different tools to try and solve this problem; mostly in Perl since I write a lot of that from time to time. Trying to get Perl to do network commands like SSH was time consuming and cumbersome when scripting it. This is when I started to look at Python. Initially I wasn’t sold on Python, but after spending some time to get familiar with the language, I actually like it; but it still was missing the SSH functionality I wanted, until recently.
As I was browsing the inter-web over the last week or so, I came across a blog post that compared deployment tools such as Chef, Puppet, Ansible, Fabric and a few others. The website provided pros and cons for each of the deployment options they were reviewing. Take a look and see what you may like to use for deployment options in your environments.
Out of the tools the website talked about, Fabric peaked my attention because it was a Python-based tool for streamlining SSH application deployments. I was thinking, if I could deploy applications with Fabric, then I should be able to do some basic monitoring with it as well; sending me down the path of solving basic Oracle GoldenGate monitoring from a single command line. Yea sounds like a good plan!
After spending some time, figuring out how to install Fabric and what exactly is a “fabfile”, I wrote my first monitoring script for Fabric!
What exactly does this monitoring script look like? Below is the monitoring script, also known as a “fabfile”. This script is written in Python syntax and sets up the environment and what functions should be called.
from fabric.api import * env.hosts = [ 'fred.acme.com', 'wilma.acme.com' ] env.user = "oracle" env.password = [ do not place in clear text ] def info_all(): with cd("$OGG_HOME"): run("echo info all | ./ggsci") def ggstatus(): info_all()
The environment that is going to be monitored are my test servers that I use for many of my tests (Fred and Wilma). Then I’m telling Fabric to use the “oracle” userid and password to login to each server. In this environment I have all my oracle passwords set the same so I only have to provide it once. After the environment is set, I define the functions that I want to perform. The first function is the info_all() function which is logging into GGSCI and providing me the output of the info all command. The second function is just a generic function that calls the first function.
With the “fabfile” created, I can now run a single command to access both servers (Fred & Wilma) and check on the status of the Oracle GoldenGate processes running on these servers. The command that I run is:
$ fab ggstatus -f ./fab_gg.py
This command is executing the Fabric executable “fab” followed by the function in the “fabfile” I want to execute. Then the “-f ./fab_gg.py” is the “fabfile” that I want to use during the execution. Upon execution, I will spool output on my STDOUT providing me the status of each Oracle GoldenGate environment for each server I’ve requested.
AMAC02P37LYG3QC:python bobby.l.curtis$ fab ggstatus -f ./fab_gg.py [fred.acme.com] Executing task 'ggstatus' [fred.acme.com] run: echo info all | ./ggsci [fred.acme.com] out: The Oracle base has been set to /u01/app/oracle [fred.acme.com] out: ==================================== [fred.acme.com] out: ORACLE_SID=src12c [fred.acme.com] out: ORACLE_BASE=/u01/app/oracle [fred.acme.com] out: ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1 [fred.acme.com] out: OGG_HOME=/u01/app/oracle/product/12.2.0/oggcore_1 [fred.acme.com] out: JAVA_HOME=/home/oracle/Downloads/jdk1.8.0_71 [fred.acme.com] out: OGGSTUDIO_HOME=/u01/app/oracle/product/oggstudio/oggstudio [fred.acme.com] out: OGGSTUDIO_HOME1=/u01/app/oracle/product/oggstudio/12.2.1.1.0/oggstudio [fred.acme.com] out: ==================================== [fred.acme.com] out: [fred.acme.com] out: Oracle GoldenGate Command Interpreter for Oracle [fred.acme.com] out: Version 12.2.0.1.0 OGGCORE_12.2.0.1.0_PLATFORMS_151101.1925.2_FBO [fred.acme.com] out: Linux, x64, 64bit (optimized), Oracle 12c on Nov 11 2015 03:53:23 [fred.acme.com] out: Operating system character set identified as UTF-8. [fred.acme.com] out: [fred.acme.com] out: Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved. [fred.acme.com] out: [fred.acme.com] out: [fred.acme.com] out: [fred.acme.com] out: GGSCI (fred.acme.com) 1> [fred.acme.com] out: Program Status Group Lag at Chkpt Time Since Chkpt [fred.acme.com] out: [fred.acme.com] out: MANAGER RUNNING [fred.acme.com] out: JAGENT RUNNING [fred.acme.com] out: EXTRACT RUNNING EGG12C 00:00:09 00:00:02 [fred.acme.com] out: Description 'Integrated Extract' [fred.acme.com] out: EXTRACT RUNNING PGG12C 00:00:00 00:00:02 [fred.acme.com] out: Description 'Data Pump' [fred.acme.com] out: [fred.acme.com] out: [fred.acme.com] out: GGSCI (fred.acme.com) 2> [wilma.acme.com] Executing task 'ggstatus' [wilma.acme.com] run: echo info all | ./ggsci [wilma.acme.com] out: The Oracle base has been set to /opt/app/oracle [wilma.acme.com] out: ==================================== [wilma.acme.com] out: ORACLE_SID=rmt12c [wilma.acme.com] out: ORACLE_BASE=/opt/app/oracle [wilma.acme.com] out: ORACLE_HOME=/opt/app/oracle/product/12.1.0.2/dbhome_1 [wilma.acme.com] out: OGG_HOME=/opt/app/oracle/product/12.2.0.0/oggcore_1 [wilma.acme.com] out: JAVA_HOME=/home/oracle/Downloads/jdk1.8.0_71 [wilma.acme.com] out: ODI_HOME=/opt/app/oracle/product/12.2.1.1.0/odi_home1 [wilma.acme.com] out: ==================================== [wilma.acme.com] out: [wilma.acme.com] out: Oracle GoldenGate Command Interpreter for Oracle [wilma.acme.com] out: Version 12.2.0.1.0 OGGCORE_12.2.0.1.0_PLATFORMS_151101.1925.2_FBO [wilma.acme.com] out: Linux, x64, 64bit (optimized), Oracle 12c on Nov 11 2015 03:53:23 [wilma.acme.com] out: Operating system character set identified as UTF-8. [wilma.acme.com] out: [wilma.acme.com] out: Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved. [wilma.acme.com] out: [wilma.acme.com] out: [wilma.acme.com] out: [wilma.acme.com] out: GGSCI (wilma.acme.com) 1> [wilma.acme.com] out: Program Status Group Lag at Chkpt Time Since Chkpt [wilma.acme.com] out: [wilma.acme.com] out: MANAGER RUNNING [wilma.acme.com] out: JAGENT RUNNING [wilma.acme.com] out: REPLICAT RUNNING RGG12C 00:00:00 00:00:03 [wilma.acme.com] out: [wilma.acme.com] out: [wilma.acme.com] out: GGSCI (wilma.acme.com) 2> Done. Disconnecting from wilma.acme.com... done. Disconnecting from fred.acme.com... done.
As you can tell, I get a scrolling output of both servers showing that the servers were logged into and changed directories to the $OGG_HOME. Then executed and “info all” command against GGSCI with the returning output. This makes for a quick and easy way to get the current status of all Oracle GoldenGate processes in an environment.
With this being an introduction to Fabric, I’m looking forward to seeing what else I can do with it. I’ll keep everyone posted on additional things I do may do with it. But for now, I encourage you to take a look at it and see if you can simplify some of your administration tasks with it.
Enjoy!!
about.me: http://about.me/dbasolved
Current Oracle Certs
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
Can you be more specific about the content of your enticle? After reading it, I still have some doubts. Hope you can help me. https://accounts.binance.com/register?ref=P9L9FQKY
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.com/de-CH/register-person?ref=UM6SMJM3
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.com/uk-UA/register?ref=W0BCQMF1
procainamide, flecainide toxicity in adults, 1 2 mEq kg of sodium bicarbonate has been administered by repeated direct IV i priligy over the counter usa
order cheap cytotec price cialis voltaren geeli Brokers who genuinely want to serve or who are unable toconvince clients not to name them as beneficiaries shoulddisclose the situation to their firms and ask whether anotherbroker can take charge of the account, said Curtis Carlson, alawyer in Miami, who represents both investors and brokers