🧩API
The agent's setup is adjustable using direct API invocations, facilitating interactive information retrieval and interaction.
Examples are demonstrated using localhost as the host name and the default port number 8282.
// 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.
{
"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
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
port*
Number
New port
Headers
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).
Refer to the Collection Level section for more details.
Path Parameters
limit*
Number
Limit number
Headers
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).
Refer to the Collection Level section for more details.
Path Parameters
limit*
Number
Limit number
Headers
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
api-token*
String
Datasentinel license key
Request Body
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.
{
"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.
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
api-token*
String
Datasentinel license key
Request Body
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
// 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
api-token*
String
Datasentinel license key
{
"host": "proxy-server",
"port": 45215,
"user": "",
"password": ""
}
DELETE
https://localhost:8282/api/proxy
Delete proxy
Headers
api-token*
String
Datasentinel License Key
Connections
Show Connections
GET
https://localhost:8282/api/connections
Display declared connections and their attributes
Headers
api-token*
String
Datasentinel license key
[
{
"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
api-token*
String
Datasentinel license key
{
"status": "OK"
}
Disable All
PATCH
https://localhost:8282/api/connections/disable
Deactivate all connections and disconnect them.
Headers
api-token*
String
Datasentinel license key
{
"status": "OK"
}
Connection
Add Connection
POST
https://localhost:8282/api/connections/{connection_name}
Create a new connection, establishing it, and Initiate monitoring
Path Parameters
connection_name*
String
Connection Identifier
Headers
api-token*
String
Datasentinel license key
Request Body
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
// 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
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"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
connection_name*
String
Connection Identifier
Headers
api-token*
String
Datasentinel license key
Request Body
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
DELETE
https://localhost:8282/api/connections/{connection_name}
Delete Connection
Path Parameters
connection_name*
String
Connection name
Headers
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
connection_name*
String
Connection name
Headers
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
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Connection disabled!"
}
Collection Level
🗃️Collection LevelThe Agent version 3.2, which was released in February 2023, introduces the Collection Level feature allowing you to choose the metrics to monitor.
Query samples
Enable
PATCH
https://localhost:8282/api/connections/{connection_name}/enable-samples
Activate query sample collection. Refer to the Collection Level section specifically dedicated to query samples for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Query samples enabled!"
}
Disable
PATCH
https://localhost:8282/api/connections/{connection_name}/disable-samples
Deactivate query sample collection. Refer to the Collection Level section specifically dedicated to query samples for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Query samples disabled!"
}
Lock Monitoring
Enable
PATCH
https://localhost:8282/api/connections/{connection_name}/enable-lock-monitoring
Enable Lock Monitoring. Refer to the Collection Level section specifically dedicated to lock monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Lock monitoring enabled!"
}
Disable
PATCH
https://localhost:8282/api/connections/{connection_name}/disable-lock-monitoring
Disable Lock Monitoring Refer to the Collection Level section specifically dedicated to lock monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Lock monitoring disabled!"
}
Delay
PATCH
https://localhost:8282/api/connections/{connection_name}/lock-monitoring-delay/{seconds}
Change Lock Monitoring Delay. Refer to the Collection Level section specifically dedicated to lock monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
seconds*
Number
Number of seconds
Headers
api-token*
String
Datasentinel license key
{
"status": "Lock monitoring delay updated to value 90s"
}
Table Monitoring
Enable
PATCH
https://localhost:8282/api/connections/{connection_name}/enable-table-monitoring
Activate Table Monitoring. Refer to the Collection Level section specifically dedicated to table monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Table monitoring enabled!"
}
Disable
PATCH
https://localhost:8282/api/connections/{connection_name}/disable-table-monitoring
Deactivate Table Monitoring. Refer to the Collection Level section specifically dedicated to table monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Table monitoring disabled!"
}
Query Monitoring
Enable
PATCH
https://localhost:8282/api/connections/{connection_name}/enable-query-monitoring
Activate Query Monitoring. Refer to the Collection Level section specifically dedicated to query monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Query monitoring enabled!"
}
Disable
PATCH
https://localhost:8282/api/connections/{connection_name}/disable-query-monitoring
Deactivate Query Monitoring. Refer to the Collection Level section specifically dedicated to query monitoring for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
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}
Change the value of Min Calls Refer to the Collection Level section specifically dedicated to query monitoring filters for detailed instructions.
Path Parameters
connection_name*
String
Connection name
min-calls
Number
Min calls
Headers
api-token*
String
Datasentinel license key
{
"status": "Query monitoring min calls updated to value 50"
}
Min Time
PATCH
https://localhost:8282/api/connections/{connection_name}/query-monitoring-min-time/{seconds}
Change the value of Min Time. Refer to the Collection Level section specifically dedicated to query monitoring filters for detailed instructions.
Path Parameters
connection_name*
String
Connection name
seconds
Number
Min time
Headers
api-token*
String
Datasentinel license key
{
"status": "Query monitoring min time updated to value 10s"
}
Query Optimize
Enable
PATCH
https://localhost:8282/api/connections/{connection_name}/enable-query-monitoring-optimize
Activate Query Monitoring Optimization. Refer to the Collection Level section specifically dedicated to query monitoring optimization for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Query monitoring optimize enabled!"
}
Disable
PATCH
https://localhost:8282/api/connections/{connection_name}/disable-query-monitoring-optimize
Deactivate Query Monitoring Optimization. Refer to the Collection Level section specifically dedicated to query monitoring optimization for detailed instructions.
Path Parameters
connection_name*
String
Connection name
Headers
api-token*
String
Datasentinel license key
{
"status": "Query monitoring optimize disabled!"
}
Last updated