Oracle Database

Monitor Goldengate 26ai using REST API read&learn gg

Photo by Edi Libedinsky on Unsplash

RestAPI endpoints provide powerful ways to monitor your oracle goldengate 26ai deployments. This blog details practical examples for monitoring deployments . Assuming one already has learnt about the “set debug on” option in my previous blog. It exposes the Restapi being called behind the scene when using adminclient . To get a 360° health view of goldengate deployment i would use a set of 2 commands , “info all” and “info distpath all”

Info all

This command gives information about 3 things , services , extract and replicats . Sample below. We will break this into 3 parts

> info all
Program     Status      Group       Type                   Lag at Chkpt       Time Since Chkpt

ADMINSRVR   RUNNING
DISTSRVR    RUNNING
PMSRVR      RUNNING
RECVSRVR    RUNNING
EXTRACT     RUNNING     ESRC1       INTEGRATED                  00:00:02           00:00:09
REPLICAT    RUNNING     RTRG1       INTEGRATED                  00:00:00           00:00:02

Services

#GET /services/v2/installation/services?deployment=MYGG

>curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9200/services/v2/installation/services?deployment=MYGG" | \
jq -r '.response.services[] | "\(.serviceName) \t \(.status) \t \(.listeners[0].port)"'

adminsrvr        running         9201
distsrvr         running         9202
pmsrvr           running         9204
recvsrvr         running         9203

Extract

#/services/v2/extracts?threads=none

curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9201/services/v2/extracts?threads=none" \
| jq '.response.items[] | {name, status}'

{
  "name": "ESRC1",
  "status": "running"
}

#GET /services/v2/extracts/ESRC1
>curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.cisco.com:9201/services/v2/extracts/ESRC1" \
| jq '.response | {type, status}'

{
  "type": "Integrated",
  "status": "running"
}

#GET /services/v2/extracts/ESRC1/info/status
>curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9201/services/v2/extracts/ESRC1/info/status" \
| jq '.response | {lag, sinceLagReported}'

{
  "lag": 3,
  "sinceLagReported": 9
}

#lag = Lag at Chkpt (in seconds)
#sinceLagReported = Time Since Chkpt(in seconds)

Combination of above 3 api calls will give a similar output like below, you just have to print it in pretty format.
EXTRACT RUNNING ESRC0 INTEGRATED 00:00:02 00:00:09

Replicat

#GET /services/v2/replicats?threads=none
>curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9201/services/v2/replicats?threads=none" \
| jq '.response.items[] | {name, status}'

{
  "name": "RTRG1",
  "status": "running"
}

curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9201/services/v2/replicats/RTRG1" \
| jq '.response | {type: .mode.type, parallel: .mode.parallel, status: .status}'

{
  "type": "integrated",
  "parallel": false,
  "status": "running"
}

>curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9201/services/v2/replicats/RTRG1/info/status" \
| jq '.response | {lag , sinceLagReported}'

{
  "lag": 0,
  "sinceLagReported": 2
}

#lag = Lag at Chkpt (in seconds)
#sinceLagReported = Time Since Chkpt(in seconds)

Combination of above api calls printed in pretty format will give output similar to below
REPLICAT RUNNING RTRG1 INTEGRATED 00:00:00 00:00:02

info distpath all

“info distpath all” gives the status of distribution paths from the source database . Note the port number here is 9402 . This is the port of distribution service. Distribution service as discussed in previous blogs is responsible for shipping the source trail files to the target host. A network connectivity break will render the status as “killed” causing extract backlog

# GET /services/v2/sources

>curl -s -u "admin:pass123" \
-H 'Content-Type: application/json' -H 'Accept: application/json' \
"http://myhost1.example.com:9202/services/v2/sources" \
| jq '.response.items[] | {name, status}'

{
  "name": "dtrg1",
  "status": "running"
}

This blog gives you a set of apis to quickly get a scan of your goldengate 26ai deployments . Just with a combination of “info all” and “info distpath all” you will be able to see the health of your deployments. RESTAPI calls gives the administrator power to write centralized scripts to monitor goldengate deployments without having to physically login to the database host.

Leave a Reply