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
  • Management
  • Status
  • Stop
  • Port Number
  • Table Monitoring Limit
  • Query Monitoring Limit
  • Upload Server
  • Set attributes
  • Show attributes
  • Test Upload
  • Proxy
  • Set attributes
  • Show attributes
  • Connections
  • Show Connections
  • Enable All
  • Disable All
  • Connection
  • Add Connection
  • Show Connection
  • Update Connection
  • Enable
  • Disable
  • Collection Level
  • Query samples
  • Enable
  • Disable
  • Lock Monitoring
  • Enable
  • Disable
  • Delay
  • Table Monitoring
  • Enable
  • Disable
  • Query Monitoring
  • Enable
  • Disable
  • Query Filters
  • Min Calls
  • Min Time
  • Query Optimize
  • Enable
  • Disable
  1. implementation
  2. Agent Usage

API

The agent's setup is adjustable using direct API invocations, facilitating interactive information retrieval and interaction.

Agent API can be reached at https://<<host_name>>:<<port_number>> host_name: Refers to the host where the agent is installed (or localhost if used locally). port_number: By default, the agent listens on port 8282, which can be updated as needed

Examples are demonstrated using localhost as the host name and the default port number 8282.

Certain operations necessitate a header token for transmission to the agent. This token aligns with the agent's license key and the platform it operates on.

// example
export TOKEN=<<datasentinel_token>> 
curl -k --header "api-token: $TOKEN" --request PUT   https://localhost:8282/api/agent/stop'

Management

Status

GET https://localhost:8282/api/agent/status

Show agent's status, version, and properties.

Output example
{
    "version": "3.4.1",
    "server": "pg-sales-3127",
    "port": 8282,
    "last_upload": "",
    "collection-rate": "low",
    "remove_proxy_os_env": false,
    "tables-monitoring-limit": 1000,
    "query-monitoring-limit": 30000,
    "sql-max-size": 256000,
    "start_time": "2023-08-22 14:52:12",
    "proxy": {
        "host": "",
        "port": 0,
        "user": "",
        "password": ""
    },
    "upload_server": {
        "host": "51.15.237.231",
        "port": 443
    },
    "connections": {
        "connections": 1,
        "running": 1,
        "not running": 0
    }
}

Stop

PUT https://localhost:8282/api/agent/stop

Stop the agent.

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
"status": "Agent stopped"
}

Port Number

PATCH https://localhost:8282/api/agent/port/{port}

Modify the port number that the agent listens on. The agent is stopped after the modification. Start it again to apply the new port configuration.

Path Parameters

Name
Type
Description

port*

Number

New port

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
"status": "Port changed successfully! The agent has been stopped. You need to restart it."
}

Table Monitoring Limit

PATCH https://localhost:8282/api/agent/tables-monitoring-limit/{limit}

The agent monitors table and index activities when the connection's table count remains below the specified limit (default: 1000).

Path Parameters

Name
Type
Description

limit*

Number

Limit number

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Tables monitoring limit successfully changed."
}

Query Monitoring Limit

PATCH https://localhost:8282/api/agent/query-monitoring-limit/{limit}

The agent monitors query activity by storing unique IDs in a daily cache. If the limit is exceeded, this automatically deactivates query monitoring (default: 30000).

Path Parameters

Name
Type
Description

limit*

Number

Limit number

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Query monitoring limit successfully changed."
}

Upload Server

The Upload Server refers to the server name of the platform where metrics are transmitted.

Set attributes

PUT https://localhost:8282/api/server

This is the server where metrics are sent

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Request Body

Name
Type
Description

host*

String

Server Name of the hosting platform

port*

Number

Platform Listening Port. By default, the platform operates on port 443.

{
    "status": "OK"
}

// Example
cat > body.json << EOF
{
  "host": "demo.datasentinel.io",
  "port": 443
}
EOF

export TOKEN=<<datasentinel_token>>
curl -k --header "api-token: $TOKEN" --header 'Content-Type: application/json' -X PUT https://localhost:8282/api/server -d @body.json

Show attributes

GET https://localhost:8282/api/server

Show server name and port details for the platform where metrics are sent.

Output example
{
    "host": "demo.datasentinel.io",
    "port": 443
}

Test Upload

POST https://localhost:8282/api/server/test-upload

The agent conducts a test to confirm whether the upload server, configured with the specified port, is accessible.

{
    "status": "OK"
}

Proxy

Under certain circumstances, an intermediary proxy server is required to establish a connection between the agent and the platform server.

Set attributes

POST https://localhost:8282/api/proxy

The following details pertain to the proxy server. Username and password are optional and can be excluded if not required.

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Request Body

Name
Type
Description

host*

String

Server Name of the hosting platform

port*

Number

Platform Listening Port. By default, the platform operates on port 443.

user

String

User name

password

String

Password

{
"status": "Proxy set"
}

// Example
cat > body.json << EOF
{
  "host": "proxy-server",
  "port": 12443,
  "user": "",
  "password": ""
}
EOF

export TOKEN=<<datasentinel_token>>
curl -k --header "api-token: $TOKEN" --header 'Content-Type: application/json' -X POST https://localhost:8282/api/proxy -d @body.json

Show attributes

GET https://localhost:8282/api/proxy

Proxy attributes

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Output example
{
    "host": "proxy-server",
    "port": 45215,
    "user": "",
    "password": ""
}

DELETE https://localhost:8282/api/proxy

Delete proxy

Headers

Name
Type
Description

api-token*

String

Datasentinel License Key

{
    "status": "OK"
}

Connections

Show Connections

GET https://localhost:8282/api/connections

Display declared connections and their attributes

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Output example
[
    {
        "name": ":9342",
        "host": "pg-sales-3127",
        "port": 9342,
        "user": "datasentinel",
        "password": "sentinel",
        "tags": "application=sales,environment=production,provider=amazon,datacenter=paris",
        "enabled": true,
        "connected": true,
        "collection-rate": "low",
        "samples": false,
        "lock-monitoring": true,
        "lock-monitoring-delay": 30,
        "table-monitoring": true,
        "query-monitoring": true,
        "query-monitoring-optimize": false,
        "query-monitoring-min-calls": 2,
        "query-monitoring-min-time": 1
    }
]

Enable All

PATCH https://localhost:8282/api/connections/enable

Enable all connections and initiate connection attempts for each of them only if they are not already established.

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Output example
{
    "status": "OK"
}

Disable All

PATCH https://localhost:8282/api/connections/disable

Deactivate all connections and disconnect them.

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Output example
{
    "status": "OK"
}

Connection

Add Connection

POST https://localhost:8282/api/connections/{connection_name}

Create a new connection, establishing it, and Initiate monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection Identifier

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Request Body

Name
Type
Description

host*

String

Hostname for connection

port*

Number

Indicate the port used for communication with the PostgreSQL cluster.

user*

String

PostgreSQL user used by Datasentinel for monitoring

password

String

User password

tags*

String

Tags linked with the instance. Tags should follow the format [key=value],.... Can be empty

{
  "status": "Connection created and connected!"
}

// Example
cat > body.json << EOF
{
    "host": "pg-sales-3127",
    "port": 9342,
    "user": "datasentinel",
    "password": "sentinel",
    "tags": "application=sales,environment=production,provider=amazon,datacenter=paris"
}
EOF

export TOKEN=<<datasentinel_token>>
curl -k --header "api-token: $TOKEN" --header 'Content-Type: application/json' --request POST 'https://localhost:8282/api/connections/sales_prod' -d @body.json

Show Connection

GET https://localhost:8282/api/connections/{connection_name}

Display Connection Attributes

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Output example
{
    "name": "sales-prod",
    "host": "pg-sales-3127",
    "port": 9342,
    "user": "datasentinel",
    "password": "sentinel",
    "tags": "application=sales,environment=production,provider=amazon,datacenter=paris",
    "enabled": true,
    "connected": true,
    "collection-rate": "low",
    "samples": false,
    "lock-monitoring": true,
    "lock-monitoring-delay": 30,
    "table-monitoring": true,
    "query-monitoring": true,
    "query-monitoring-optimize": false,
    "query-monitoring-min-calls": 2,
    "query-monitoring-min-time": 1
}

Update Connection

PUT https://localhost:8282/api/connections/{connection_name}

Update connection attributes

Path Parameters

Name
Type
Description

connection_name*

String

Connection Identifier

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Request Body

Name
Type
Description

host

String

Hostname for connection

port

Number

Indicate the port used for communication with the PostgreSQL cluster.

user

String

PostgreSQL user used by Datasentinel for monitoring

password

String

User password

tags

String

Tags linked with the instance. Tags should follow the format [key=value],.... Can be empty

{
  "status": "Connection updated!"
}

DELETE https://localhost:8282/api/connections/{connection_name}

Delete Connection

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
  "status": "Connection deleted!"
}

Enable

PATCH https://localhost:8282/api/connections/{connection_name}/enable

Activate the connection and initiate connection attempts in order to start monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Connection enabled!"
}

Disable

PATCH https://localhost:8282/api/connections/{connection_name}/disable

Disable the connection and perform a disconnection

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Connection disabled!"
}

Collection Level

The Agent version 3.2, which was released in February 2023, introduces the Collection Level feature allowing you to choose the metrics to monitor.

Collection Level settings are displayed within the connection properties.

Query samples

Enable

PATCH https://localhost:8282/api/connections/{connection_name}/enable-samples

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
  "status": "Query samples enabled!"
}

Disable

PATCH https://localhost:8282/api/connections/{connection_name}/disable-samples

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
  "status": "Query samples disabled!"
}

Lock Monitoring

Enable

PATCH https://localhost:8282/api/connections/{connection_name}/enable-lock-monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
  "status": "Lock monitoring enabled!"
}

Disable

PATCH https://localhost:8282/api/connections/{connection_name}/disable-lock-monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
  "status": "Lock monitoring disabled!"
}

Delay

PATCH https://localhost:8282/api/connections/{connection_name}/lock-monitoring-delay/{seconds}

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

seconds*

Number

Number of seconds

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Output example
{
  "status": "Lock monitoring delay updated to value 90s"
}

Table Monitoring

Enable

PATCH https://localhost:8282/api/connections/{connection_name}/enable-table-monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Table monitoring enabled!"
}

Disable

PATCH https://localhost:8282/api/connections/{connection_name}/disable-table-monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Table monitoring disabled!"
}

Query Monitoring

Enable

PATCH https://localhost:8282/api/connections/{connection_name}/enable-query-monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Query monitoring enabled!"
}

Disable

PATCH https://localhost:8282/api/connections/{connection_name}/disable-query-monitoring

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Query monitoring disabled!"
}

Query Filters

Min Calls

PATCH https://localhost:8282/api/connections/{connection_name}/query-monitoring-min-calls/{min-calls}

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

min-calls

Number

Min calls

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Example output
{
  "status": "Query monitoring min calls updated to value 50"
}

Min Time

PATCH https://localhost:8282/api/connections/{connection_name}/query-monitoring-min-time/{seconds}

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

seconds

Number

Min time

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

Example output
{
  "status": "Query monitoring min time updated to value 10s"
}

Query Optimize

Enable

PATCH https://localhost:8282/api/connections/{connection_name}/enable-query-monitoring-optimize

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Query monitoring optimize enabled!"
}

Disable

PATCH https://localhost:8282/api/connections/{connection_name}/disable-query-monitoring-optimize

Path Parameters

Name
Type
Description

connection_name*

String

Connection name

Headers

Name
Type
Description

api-token*

String

Datasentinel license key

{
    "status": "Query monitoring optimize disabled!"
}

PreviousCLINextCollection Level

Last updated 1 year ago

Refer to the section for more details.

Refer to the section for more details.

Activate query sample collection. Refer to the section specifically dedicated to query samples for detailed instructions.

Deactivate query sample collection. Refer to the section specifically dedicated to query samples for detailed instructions.

Enable Lock Monitoring. Refer to the section specifically dedicated to lock monitoring for detailed instructions.

Disable Lock Monitoring Refer to the section specifically dedicated to lock monitoring for detailed instructions.

Change Lock Monitoring Delay. Refer to the section specifically dedicated to lock monitoring for detailed instructions.

Activate Table Monitoring. Refer to the section specifically dedicated to table monitoring for detailed instructions.

Deactivate Table Monitoring. Refer to the section specifically dedicated to table monitoring for detailed instructions.

Activate Query Monitoring. Refer to the section specifically dedicated to query monitoring for detailed instructions.

Deactivate Query Monitoring. Refer to the section specifically dedicated to query monitoring for detailed instructions.

Change the value of Min Calls Refer to the section specifically dedicated to query monitoring filters for detailed instructions.

Change the value of Min Time. Refer to the section specifically dedicated to query monitoring filters for detailed instructions.

Activate Query Monitoring Optimization. Refer to the section specifically dedicated to query monitoring optimization for detailed instructions.

Deactivate Query Monitoring Optimization. Refer to the section specifically dedicated to query monitoring optimization for detailed instructions.

🧩
Collection Level
Collection Level
🗃️Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level
Collection Level