β¨οΈCLI
The agent offers a CLI for conveniently modifying attributes and connections.
Prerequisites
Enable the execution of the CLI
Using an alias
alias datasentinel='DATASENTINEL_PATH=<<INSTALL_DIRECTORY>>/datasentinel;LD_LIBRARY_PATH=$DATASENTINEL_PATH/lib/ $DATASENTINEL_PATH/datasentinel'Using environment variables
export DATASENTINEL_PATH="<<INSTALL_DIRECTORY>>/datasentinel"
export LD_LIBRARY_PATH=$DATASENTINEL_PATH/lib:$LD_LIBRARY_PATH
export PATH=$DATASENTINEL_PATH:$PATHAgent Management
Show Commands
Simply enter the datasentinel command.
datasentinelCopyright 2023 (c) Datasentinel- All rights reserved www.datasentinel.io
================================================================================
Agent:
- start agent
- stop agent
- status agent
- show metrics
Show internal agent metrics and cache activity
- set port <port number>
- set collection-rate <low|high>
low: The sessions collection is done every 10 seconds
high: The sessions collection is done every second (Default value)
If the datasentinel extension is not installed, the collection-rate is automatically adjusted to low value
- set tables-monitoring-limit (default 1000)
The agent monitors the activity of tables and indexes if the number of tables in the connection is less than the defined limit
- set query-monitoring-limit (default 10000)
The agent tracks query activity, storing unique IDs in a daily cache. Exceeding limit triggers automatic deactivation of query monitoring.
Connections: when the connections are disabled, the agent is disconnected.
- enable all
- disable all
Connection:
- add connection <name> -f <json file>
- update connection <name> -f <json file>
json example: {
"host": "hostname",
"port": 4587,
"user": "username",
"password": "value",
"tags": "key=value,key=value,..."
}
- update connection <name> samples <on|off> (default off)
Collect and send sample queries, with literal values if present
- update connection <name> lock-monitoring <on|off> (default on)
Scan blocking sessions (longer than lock-monitoring-delay) and send blocking reports
- update connection <name> lock-monitoring-delay <seconds> (default 30)
Minimum number of seconds before triggering a blocking scenario
- update connection <name> table-monitoring <on|off> (default on)
Monitor the activity of tables and indexes (The number of tables must be lower than the maximum limit set at the agent level (default 1000)
- update connection <name> query-monitoring <on|off> (default on)
Monitor pg_stat_statements query activity
- update connection <name> query-monitoring-optimize <on|off> (default on)
Group similar pg_stat_statements queries
- update connection <name> query-monitoring-min-calls <calls> (default 2)
- update connection <name> query-monitoring-min-time <seconds> (default 1)
Retrieve pg_stat_statements queries executed n times (calls) or with total execution time exceeding specified seconds
- update connection <name> test-query-monitoring-optimize
Test and optimize pg_stat_statements query contents with previous parameters, display results
- delete connection <name>
- enable connection <name>
- disable connection <name>
- show connections
- show connection <name>
Dump connection in JSON format:
- dump connection <name>
Upload server:
- set server <host> <port>
- show server
- test server
Token:
- set token <value>
- show token
Proxy:
- set proxy -f <json file>
json example: {
"host": "hostname",
"port": 4587,
"user": "username (optional)",
"password": "value (optional)"
}
- delete proxy
- show proxyStatus
Start
Stop
Change Port Number
By default, the agent is configured to listen on port 8282, enabling API or CLI calls to be made.
Change Table Monitoring Limit
Parameter:
The limit number. The agent tracks the activity of tables and indexes if the connectionβs table count is below the set limit (default 1000).
Change Query monitoring Limit
Since agent version 3.2
Parameter:
The limit number. The agent tracks query activity, storing unique IDs in a daily cache. Exceeding limit triggers automatic deactivation of query monitoring. (default 30000)
Upload Server
The Upload Server refers to the server name of the platform where metrics are transmitted.
Set
Change the server where metrics are sent
Show
Show the platform server where metrics are sent
Test
Token
Set
Configure the authentication token used to access the platform. This should only be done during initialization. The agent subsequently retrieves updated tokens from the platform.
Show
After testing the token on the platform's upload server, the validity date of the token is provided.
Proxy
Under certain circumstances, an intermediary proxy server is required to establish a connection between the agent and the platform server.
Set
create a json file with proxy settings and update the agent
Show
Delete
Connections
Show
Enable All
Disable All
Connection
Add
Create a JSON file with connection settings
Show
Parameter
The connection name
Dump
Dump connection properties in JSON format
Parameter
The connection name
Delete
Parameter
The connection name
Enable
Activate the connection and initiate connection attempts in order to start monitoring
Parameter
The connection name
Disable
Parameter
The connection name
Update
Parameter
The connection name
Collection Level
The Agent Version 3.2 introduces the Collection Level feature, which was released in February 2023 and allows you to choose the metrics to monitor.
Query Samples
Parameter
The connection name
Lock Monitoring
Parameter
The connection name
Lock Monitoring Delay
Parameters
The connection name Seconds
Table Monitoring
Parameter
The connection name
Query Monitoring
Parameter
The connection name
Query Monitoring Optimize
Parameter
The connection name
Query Monitoring Min Calls
Parameters
The connection name Minimum number of calls registered in pg_stat_statements
Query Monitoring Min Time
Parameter
The connection name Minimum total execution time (seconds)
Internals
Since Agent Version 3.2
Show Metrics
Displays internal metrics and caches for debugging purposes
Test Query Monitoring Optimization
The Query Optimize feature fetches queries from pg_stat_statements, filtered by minimum calls or minimum total execution time, groups similar queries, and shows the optimization gain at each level.
Parameter
The connection name
Last updated