Skip to main content

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 FieldField TypeDescription
oidnumber · RequiredAgent ID
baseTimestring · RequiredReference time, yyyyMMdd format
comparisontimestring · RequiredComparison 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 FieldField TypeValueDescriptionDefalut
oidsarray · Required-Multiple agent IDs can be entered using comma (,) as a delimiter.-
periodstring · Requiredday, weekInquiry time-
datestring · RequiredyyyyMMdd formatReference time-
topNnumber1 ~ 1000Number of upper cases10
orderstringsql_execute_cnt
sql_elapse
sql_elapse_max
Sort bysql_execute_cnt
categorystringALL
DB
HOST
USER
If you select the category, USER, it responds with SQL statistical data on a user basis.ALL
nameInCategorystring-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
}