Checking the health metrics of Q Replication API

You can check the health of individual components such as capture, apply, and the network connectivity between source and target REST servers for Q Replication.

Before you begin

This task is done on the cluster host for the replication source. Ensure that you collect the following information before you run the API call:

  • The basic authorization token of the source on the cluster host.1
  • The hostname of the replication source database.
  • The external port number of the replication source database.2
You need this information to run the needed Replication REST API calls. For a cURL request, you need a basic authorization token.
1 You need to create a basic authorization token to run a cURL request. To create your token, run this command:
echo <source_db_username>:<source_db_password> | base64
2 You can retrieve the external port number of the replication source database by running the following command:
oc get svc | grep <db2_instance_id> | grep db2u-engn-svc | grep 50001 | sed 's/.*50001://' | sed 's/\/TCP.*//')

About this task

Check the health of Q Replication API components in detail. You can check the health of Capture (qrepCaptureState), MQ manager for Capture (qrepCaptureMqState), Apply (qrepApplyState), and MQ manager for Apply (qrepApplyMqState), and the network connectivity between source and target (qrepRemoteConnectivity) REST servers. The API call is run on the cluster host.

Procedure

  1. To run the Q Replication REST API in the command line, use the following command:
    curl --insecure -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic <your_authorization_token>' 'https://<source_hostname>:<source_rest_port>/dr/v1/health/metrics'
  2. To check the state of the Capture and Apply MQ managers, run this command:
    dspmq
  3. To check the connectivity between source and target REST API servers, run this command:
    openssl s_client -connect <remote_rest_hostname>:<remote_rest_port>

Results

The checking of capture, apply, source, and target connectivity is complete when all configured components are active. Active configured component states contain a "resultValue":"0" in the response body. When the component is not configured, the state of the component has a [] value. For a configured component, the "resultValue" of the component state can have a value from "0" to "5".

The following table lists the possible values for the "resultValue" key of a configured component.

resultValue Reason
0 Active
1 Inactive
2 Unknown
3 Inactive message queue (MQ) channel detected
4 Inactive send queue detected
5 Inactive receive queue detected
Note: Use these file paths to find log files for components that require troubleshooting.
  • The log files for Capture and Apply can be found in the /mnt/qrepdata/bludr/logs/replication.
  • The log file for REST API server can be found in /mnt/qrepdata/bludr/logs/server.
  • The log file for asnclp can be found in /mnt/qrepdata/bludr/logs/asnclp.

The following table lists the possible HTTP status codes and response messages for checking the overall health of capture, apply, source, and target connectivity by using the API call. It also includes sample code to show the response syntax. Wait for the API call to return with "resultValue" in the response code for all configured components. Examine the components with nonzero "resultValue" inside the replication container.

HTTP Status Code Reason Response Model
200 Details for replication The user request returns a successful health check of configured and unconfigured components (sample value):
{
  "qrepAsnmonState": [],
  "qrepCaptureState": [
    {
      "dbHost": "dr-source1.ibm.com",
      "dbPort": 31023,
      "dbName": "BLUDB",
      "resultValue": "0"
    }
  ],
  "qrepApplyState": [],
  "qrepCaptureMqState": [
    {
      "dbHost": " dr-source1.ibm.com",
      "dbPort": 31576,
      "dbName": "BLUDB",
      "resultValue": "4",
      "mqmName": "GJKZXETR_CQM"
    }
  ],
  "qrepApplyMqState": [],
  "qrepRemoteConnectivity": [
    {
      "host": " dr-source1.ibm.com",
      "port": "9444",
      "resultValue": "1"
    },
    {
      "host": " dr-source1.ibm.com",
      "port": "1414",
      "resultValue": "1"
    },
    {
      "host": " dr-source1.ibm.com",
      "port": "1415",
      "resultValue": "1"
    }
  ]
}
4xx Client request error The user request was not fulfilled due to malformed request syntax or other client issues:
{
  "errorCode": "string",
  "errorMessage": "string",
  "errorResolution": "string"
}
5xx Server error The user request appeared valid, but was not fulfilled due to an issue with the server:
{
  "errorCode": "string",
  "errorMessage": "string",
  "errorResolution": "string"
}

Example

The following example shows the command syntax for stopping a replication for a list of tables. See step 1.
curl --insecure -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic ZHNhZG06aFRjT3dTTjR1RFo0N1Ew' 'https://dr-source1.ibm.com:31023/dr/v1/health/metrics'