Datasentinel Docs
Visit our websiteBlogRelease Notes
  • 👋Welcome
  • 🆓Free Trial
  • 📣Release Notes
  • Getting started
    • Architecture
    • Installation
      • 🌐Platform
      • 🕶️Agent
    • PostgreSQL clusters
      • 🔌Extensions
        • 🔌pg_stat_statements
        • 🔌pg_store_plans
        • 🔌system_stats
        • 🔌pg_buffercache
      • 🕶️Monitoring User
      • ➕Adding Connection
    • FAQs
      • ❓Platform FAQ
      • ❓Agent FAQ
  • Features
    • Key Features
      • 📊Session History
      • 📊Top Queries
      • 📂Top Tables
      • 🔓Lock Explorer
      • 📈Cluster & System Metrics
      • ⌚Live360
      • 📰Reporting
      • 🔔Alerting
        • Settings
        • Templates
        • Silences
        • Manager
    • Other Features
      • 📡Agentless Monitoring
      • 🛡️Role Based Access
      • 🔂Changed Parameters
    • Tips & Hints
      • 🖥️User Interface
      • 🏷️Tags
      • 🔀Metric Correlation
      • 👁️‍🗨️Consolidated View
      • ❗Graphical Annotations
      • ☁️Predefined Providers
      • ❓Wait Event Description
      • ®️Read Replicas
      • 👁️‍🗨️Agentless & System Metrics
      • ☑️Simplified pg_instance Display
  • implementation
    • Platform Usage
      • ⚙️Configuration
        • 🔑License
        • 📓LDAP
        • ✉️SMTP
        • 📋Audit
        • 👨‍🏭Users & Roles
      • 🧩API
        • 🔗Access Token
        • 🧩Connection API
        • 🧩Role API
        • 🧩User API
        • 🧩Reporting API
        • 🧩Workload API
        • 🧩Alerting API
      • 🛠️Tooling
    • Agent Usage
      • 📣Release Notes
      • ⌨️CLI
      • 🧩API
      • 🗃️Collection Level
      • 🔬Internals
    • Upgrade
      • 🔄Platform
      • 🔄Agent
    • Troubleshooting
      • 🩺Error message: “502 Bad Gateway”
      • 🩺The UI is not displaying any metrics for my new instance.
      • 🩺UI dashboard is encountering loading errors
      • 🩺InfluxDB
  • Support
    • How to Contact Us
  • GitHub Toolkit
Powered by GitBook
On this page
  • Instance Alerting
  • Status
  • Enable
  • Disable
  • Problems
  • Customized Alerts
  • Create
  1. implementation
  2. Platform Usage
  3. API

Alerting API

PreviousWorkload APINextTooling

Last updated 1 year ago

For more details, please refer to the Alerting feature.

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

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

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

Name
Type
Description

pg-instance*

String

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

Headers

Name
Type
Description

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

Name
Type
Description

pg-instance*

String

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

Headers

Name
Type
Description

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

Name
Type
Description

pg-instance*

String

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

Headers

Name
Type
Description

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

Name
Type
Description

pg-instance*

String

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

Headers

Name
Type
Description

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

Name
Type
Description

pg-instance*

String

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

Headers

Name
Type
Description

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

🧩
🧩
🔔Alerting
🔗Access Token
GitHub