Database
The following provides the API for querying the agent information, parameter changes, and statistical data of the database monitoring project.
Viewing the database parameters
You can query the changes to parameters in the database.
GET https://api.whatap.io/open/api/json/db/database_params?oid
=[oid]&baseTime
=[baseTime]&comparisonTime
=[comparisonTime]
request
$ curl -L -w "\n" -H "x-whatap-token: {{PROJECT API TOKEN}}" -H "x-whatap-pcode: {{projectCode}}" "https://api.whatap.io/open/api/json/db/database_params?oid=376886006&baseTime=20230822&comparisonTime=20230810"
Request Field | Field Type | Description |
---|---|---|
oid | number · Required | Agent ID |
baseTime | string · Required | Reference time, yyyyMMdd format |
comparisontime | string · Required | Comparison time, yyyyMMdd format |
response
{
"unmatchedKeys": [
{
"key": "Innodb_buffer_pool_load_status(stat)",
"value": {
"baseTime": "Buffer pool(s) load completed at 230818 2:54:51",
"comparisonTime": "Buffer pool(s) load completed at 230810 6:05:50"
}
},
{
"key": "Max_used_connections_time(stat)",
"value": {
"baseTime": "2023-08-18 23:54:51",
"comparisonTime": "2023-08-10 06:05:51"
}
}
],
"baseTime": [
{
"key": "activate_all_roles_on_login",
"value": "OFF"
},
{
"key": "admin_address",
"value": ""
},
...
],
"comparisonTime": [
{
"key": "activate_all_roles_on_login",
"value": "OFF"
},
{
"key": "admin_address",
"value": ""
},
...
]
}
SQL statistics TopN
You can view the most used SQL statistical data.
GET https://api.whatap.io/open/api/json/db/statistics/sql?oids
=[oid]&period
=[day|week]&date
=[date]
request
$ curl -L -w "\n" -H "x-whatap-token: {{PROJECT API TOKEN}}" -H "x-whatap-pcode: {{projectCode}}" "https://api.whatap.io/open/api/json/db/statistics/sql?oids=757639646,-1162364681,506793303&period=day&date=20230825"
Request Field | Field Type | Value | Description | Defalut |
---|---|---|---|---|
oids | array · Required | - | Multiple agent IDs can be entered using comma (,) as a delimiter. | - |
period | string · Required | day , week | Inquiry time | - |
date | string · Required | yyyyMMdd format | Reference time | - |
topN | number | 1 ~ 1000 | Number of upper cases | 10 |
order | string | sql_execute_cnt sql_elapse sql_elapse_max | Sort by | sql_execute_cnt |
category | string | ALL DB HOST USER | If you select the category, USER , it responds with SQL statistical data on a user basis. | ALL |
nameInCategory | string | - | Enter it when selecting category . | - |
response
{
"records": [
{
"sql_execute_cnt": 33863,
"sql_elapse": 643,
"sqlHash": 1559625025,
"sql_elapse_max": 5,
"onames": "DBX-0-102-3306,DBX-0-162-3306",
"user": "kwlee",
"sql": "select /* WhaTap6D#5 */ * from information_schema.processlist\nwhere command<>'#'"
},
{
"sql_execute_cnt": 28387,
"sql_elapse": 0,
"sqlHash": -499643965,
"sql_elapse_max": 0,
"onames": "DBX-0-107-3306",
"user": "whatap",
"sql": "select id,user,host,db,command,time,state,info,time_ms,stage,max_stage,progress,\nmemory_used,max_memory_used,examined_rows,query_id,tid\nfrom information_schema.processlist\nwhere command<>'#' and command<>'#'"
},
...
],
"topN": 10,
"total": 129,
"retrievedStartTime": 1692921600000,
"retrievedEndTime": 1693007999000
}