Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This page describes the APIs that can be used to retrieve and update StandbyMP Configurations.

Configuration(s) Listing API

Purpose:

Returns existing Configuration(s) and related settings, such as Automated Standby Update, Standby Update Delay, Email and Slack settings, Observer, etc.

API:

GET /api/configurations

to get information about all the Configurations

GET /api/configurations/{configurationId}

to get information about the specific one

Request body:

None.

Curl example:

curl -k -u admin:admin https://localhost:4433/api/configurations/1

Successful response body:

 JSON
{
    "Status": 200,
    "Result": {
        "ConfigurationId": 1,
        "ConfigurationType": "PostgreSQL",
        "ConfigurationName": "PG1",
        "PrimaryAgentManagerId": "2w3l87blxgy2k",
        "PrimaryAgent": {
            "AgentManagerConfig": {
                "NatsAddress": "controlcenter",
                "NatsPort": 5533,
                "HostAddress": "postgresql1",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.27.0.3"
                ],
                "ServiceUser": "postgres",
                "AgentManagerId": "2w3l87blxgy2k",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890,
                "EnableDebugServer": true
            },
            "UserScript": "",
            "SpecificData": {
                "Port": 5432,
                "BinaryDirectory": "/usr/lib/postgresql/9.6/bin"
            }
        },
        "StandbyAgentManagerId": "2ig8qsjfi1c3r",
        "StandbyAgent": {
            "AgentManagerConfig": {
                "NatsAddress": "controlcenter",
                "NatsPort": 5533,
                "HostAddress": "postgresql2",
                "OS": "linux",
                "DefaultBackupDir": "/usr/local/dbvisit/multiplatform/backup",
                "IPAddresses": [
                    "172.27.0.4"
                ],
                "ServiceUser": "postgres",
                "AgentManagerId": "2ig8qsjfi1c3r",
                "FileTransferListenAddress": "",
                "FileTransferListenPort": 7890,
                "EnableDebugServer": true
            },
            "UserScript": "",
            "SpecificData": {
                "Port": 5432,
                "BinaryDirectory": "/usr/lib/postgresql/9.6/bin"
            }
        },
        "Settings": {
            "ApplicationDelayMinutes": 0,
            "StandbyModeConfig": {
                "UndoFilePath": "",
                "Enabled": false
            },
            "AutoSyncConfig": {
                "Enabled": false,
                "IntervalSeconds": 0,
                "BackupType": ""
            },
            "NotifierConfig": {
                "To": null
            },
            "ObserverConfigurationSettings": {
                "Enabled": false,
                "NotificationOnly": false,
                "CheckIntervalSeconds": 0,
                "MaxFailCount": 0,
                "SendEmail": false,
                "SendSlack": false,
                "HeartbeatEnabled": false,
                "HeartbeatHour": 0,
                "HeartbeatMinute": 0,
                "Rule": ""
            }
        },
        "HasFailedOver": false,
        "Disabled": false,
        "LicenseKey": "4jo70-qwp4l-7gplh-g1eji-yln5f-1gbil-1wzwk"
    }
}

Edit Configuration API

Purpose:

Allows updating Configuration parameters and settings, such as Automated Standby Update, Standby Update Delay, Email and Slack settings, Observer, etc.

Warning: This API allows to change all the Configuration parameters. Please be careful while using.

Parameters in the request body override only the corresponding parameters in Configuration.

API:

PUT /api/configurations/{configurationId}

to bulk update parameters,

PUT /api/configurations/{configurationId}/Settings/AutomatedStandbyUpdate/Enabled

to update 1 parameter

Request body:

{
    "Settings": {
        "AutomatedStandbyUpdate": {
            "Enabled": false
        }
    }
}

Curl example:

curl -k -u admin:admin -X PUT -d '{"Settings": {"AutomatedStandbyUpdate": {"Enabled": false}}}' https://localhost:4433/api/configurations/1

OR

curl -k -u admin:admin -X PUT -d 'false' https://localhost:4433/api/configurations/1/Settings/AutomatedStandbyUpdate/Enabled

Successful response body:

{
  "Status": 200,
  "Result": {}
}

Configuration(s) API Usage Examples

For getting comprehensive JSON output results, while using API, we parse all outputs with “jq” which can be easily installed by for example as root:

yum install jq

In all below examples we use authentication method via “-u” for authentication method via cookie, check the /wiki/spaces/DSMP/pages/3432415233 page

Configuration Details

To list all configurations keys and values information run:

curl -sku admin:admin https://localhost:4433/api/configurations | jq

List specific value for any key for all configurations:

curl -sku admin:admin https://localhost:4433/api/configurations | jq \
'.Result[].PrimaryAgentManagerId, .Result[].ConfigurationName'

To see specific value for specific key for specific configuration (In this example called MEGA):

curl -sku admin:admin https://localhost:4433/api/configurations | jq \
'.Result[] | select(.ConfigurationName=="MEGA") | .Settings.AutomatedStandbyUpdate.Enabled'

Another example of listing all configurations and names with automated standby update disabled:

curl -sku admin:admin https://localhost:4433/api/configurations | jq \
'.Result[] | select(.Settings.AutomatedStandbyUpdate.Enabled==false) | .ConfigurationName'
  • No labels