๐ŸงฉAlerting API

For more details, please refer to the Alerting feature.

๐Ÿ””pageAlerting

To use the Alerting API, it's necessary to generate an access token.

๐Ÿ”—pageAccess Token

A comprehensive toolkit, with practical usage examples, is accessible on GitHub.

This toolkit comes pre-installed as a default component within the on-premises platform, located at /datasentinel/soft/datasentinel_toolkit.

Instance Alerting

Status

GET https://<<platform-server>>/ds-api/alerting/{pg-instance}/status

Display Instance Alerting Status

Path Parameters

NameTypeDescription

pg-instance*

String

Instance name in Datasentinel: <<server_name>>@<<pg_name>>

Headers

NameTypeDescription

user-token*

String

Generated Access Token

Response

Example
{
    "enabled": true,
    "reason": ""
}
// If not enabled, the reason is displayed
{
    "enabled": false,
    "reason": "The reason why the alerting is disabled"
}

If instance alerting is inactive, the reason field clarifies the cause. Several possibilities exist:

  • Global alerting is turned off on the Datasentinel platform.

  • An instance-specific silence is in effect.

  • A silence is active, covering the instance through its filters.

  • No corresponding alerting rule has been identified.

Enable

PATCH https://<<platform-server>>/ds-api/alerting/{pg-instance}/enable

Enable Instance Alerting

Path Parameters

NameTypeDescription

pg-instance*

String

Instance name in Datasentinel: <<server_name>>@<<pg_name>>

Headers

NameTypeDescription

user-token*

String

Generated Access Token

Response

Example
{
    "enabled": true,
    "reason": ""
}

Enabling instance alerting might not yield any impact under specific conditions.

Several reasons could contribute to this:

  • Global alerting is turned off on the Datasentinel platform.

  • A silence is active, covering the instance through its filters.

  • No corresponding alerting rule has been identified.

Disable

PATCH https://<<platform-server>>/ds-api/alerting/{pg-instance}/disable

Disable Instance Alerting

Path Parameters

NameTypeDescription

pg-instance*

String

Instance name in Datasentinel: <<server_name>>@<<pg_name>>

Headers

NameTypeDescription

user-token*

String

Generated Access Token

Response

{
    "enabled": false,
    "reason": "A silence has been created for the instance"
}

Problems

GET https://<<platform-server>>/ds-api/alerting/{pg-instance}/problems

Display Instance Problems

Path Parameters

NameTypeDescription

pg-instance*

String

Instance name in Datasentinel: <<server_name>>@<<pg_name>>

Headers

NameTypeDescription

user-token*

String

Generated Access Token

Response

Example
[
    {
        "id": "6d2f5754994556408ecdebc8587c1ccc",
        "event_time": "2022-10-04 16:19:08",
        "notification_type": "PROBLEM",
        "pg_instance": "server@crm-production",
        "check_name": "wal_files",
        "check_state": "WARNING",
        "message": "WAL files: 43 [>=40 - WARNING]",
        "email": true,
        "webhook": false,
        "script": false,
        "start_time": "2022-10-04 16:10:08",
        "server": "server"
    },
    {
        "id": "832c4eb26dd29450259290432194ff81",
        "event_time": "2022-10-04 12:21:10",
        "notification_type": "PROBLEM",
        "pg_instance": "server@crm-production",
        "check_name": "memory_usage",
        "check_state": "CRITICAL",
        "message": "Memory usage: 95% used (1730MB/1835MB) [>=95% - CRITICAL]",
        "email": true,
        "webhook": false,
        "script": false,
        "start_time": "2022-10-04 12:04:06",
        "server": "server"
    },
    {
        "id": "e644076a863f25fc66a0cae682b1b629",
        "event_time": "2022-10-05 10:19:27",
        "notification_type": "PROBLEM",
        "pg_instance": "server@crm-production",
        "check_name": "custom",
        "check_state": "CRITICAL",
        "message": "Custom alert: Daily backup failed : No disk space",
        "email": true,
        "webhook": false,
        "script": false,
        "start_time": "2022-10-05 10:19:27",
        "server": "server"
    },
.../...
]

Customized Alerts

Create

POST https://<<platform-server>>/ds-api/alerting/{pg-instance}/problems

Create Custom Instance Problem

Path Parameters

NameTypeDescription

pg-instance*

String

Instance name in Datasentinel: <<server_name>>@<<pg_name>>

Headers

NameTypeDescription

user-token*

String

Generated Access Token

Response

Example
{
    "id": "e644076a863f25fc66a0cae682b1b629",
    "event_time": "2022-10-05 10:19:27",
    "notification_type": "PROBLEM",
    "pg_instance": "server@crm-production",
    "check_name": "custom",
    "check_state": "CRITICAL",
    "message": "Custom alert: Daily backup failed : No disk space",
    "email": true,
    "webhook": false,
    "script": false,
    "start_time": "2022-10-05 10:19:27",
    "server": "server"
}
Example
cat > body.json << EOF
{
    "message" : "Daily backup failed : No disk space"
}
EOF
export TOKEN=<<user_token>>
curl -k --header "user-token: $TOKEN" --header 'Content-Type: application/json' --request POST 'https://<<platform-server>>/ds-api/alerting/<<pg-instance>>/problems' -d @body.json

Last updated