MXQL Open API
The following explains how to view the MXQL data by using the open API.
For more information about MXQL, see the following.
MXQL open API types
You can use MXQL as follows.
- How to write MXQL queries to retrieve data
- As in the following, the method how to retrieve data by the predefined MXQL query list provided by the SaaS service
Therefore, the API path used in each case differs.
How to use MXQL | API |
---|---|
In case of writing the MXQL queries | MXQL text API |
In case of using the predefined MXQL query list provided by the SaaS service (see the following) | MXQL path API |
Calling the MXQL open API
The content included in the header upon open API call is as follows:
Type | Key | Set value | Remarks |
---|---|---|---|
Header | x-whatap-token | API Token {{PROJECT API TOKEN}} | Project API Token: Select a project > Management > Project Management > Api Token |
x-whatap-pcode | Project code {{projectCode}} | Project code: Select Project > Management > Project management > Project code |
Constraints of the MXQL open API
You can search up to 31 days in a single request.
MXQL text API
The following image is an example of the MXQL execution result.
POST https://api.whatap.io/open/api/flush/mxql/text
curl --location 'https://api.whatap.io/open/api/flush/mxql/text' \
-H 'x-whatap-token: {{PROJECT API TOKEN}}' \
-H 'x-whatap-pcode: {{projectCode}}' \
-H 'Content-Type: application/json' \
-d '{
"stime": 1639016640000,
"etime": 1639016940000,
"mql": "CATEGORY app_counter\nOID [ $oidFirst, $oidSecond ]\nTAGLOAD\nSELECT\nINJECT sortByOidDesc",
"limit": 2,
"pageKey": "mxql",
"inject": {
"sortByOidDesc": "ORDER {key : [oid], sort :[desc]}"
},
"param": {
"$oidFirst": "1499132250",
"$oidSecond": "1670734023"
}
}'
Key | Value |
---|---|
stime | Data lookup start time |
etime | Data lookup end time |
mql | Written MXQL query |
limit | Maximum data query count |
pageKey | The string MXQL's fixed value |
inject | Optional See the following e.g. { "default": "ORDER {key : [oid], sort : [desc] }"} |
param | Optional See the following e.g. { "$oidFirst": "520111224", "$oidSecond": "1031483086" } |
stime
, etime
, $oidFirst
, and $oidSecond
in the request statements must be applied as the time and oid values for the user environment.
-
In case of no queried data
ResponseBody Example 1[]
-
In case of any queried data
ResponseBody Example 2[
{
"time": 1639016640000,
"pcode": 101,
"pname": "Virtual",
"okind": -1085056726,
"onode": 334634079,
"oname": "22136-8075",
"okindName": "ote-virtual-1",
"onodeName": "node-1",
"host_ip": "192.168.1.57",
"container": "ote-8075.service",
"pid": 22206,
"type": "java",
"containerKey": 1876424218,
"tx_count": 58,
"tx_error": 0,
"tx_time": 1643.9138,
"apdex_satisfied": 41,
"apdex_tolerated": 16,
"apdex_total": 58,
"tx_dbc_time": 13.655172,
"tx_sql_time": 222.15517,
"tx_httpc_time": 717.4138,
"sql_count": 129,
"sql_error": 0,
"sql_time": 101.387596,
"sql_fetch_count": 37621,
"sql_fetch_time": 4.5187527E-4,
"httpc_count": 41,
"httpc_error": 0,
"httpc_time": 1073.4878,
"active_tx_count": 20,
"active_tx_0": 19,
"active_tx_3": 1,
"active_tx_8": 0,
"tps": 13.833333,
"resp_time": 1628,
"arrival_rate": 12.6,
"pack_dropped": 110,
"metering": 4,
"_clock_delta_": 180,
"oid": 1670734023
},
{
"time": 1639016640000,
"pcode": 101,
"pname": "Virtual",
"okind": -933992004,
"onode": 1693789385,
"oname": "22134-8074",
"okindName": "ote-virtual-0",
"onodeName": "node-0",
"host_ip": "192.168.1.57",
"container": "ote-8074.service",
"pid": 22202,
"type": "java",
"containerKey": 2024596057,
"tx_count": 56,
"tx_error": 0,
"tx_time": 1545.4464,
"apdex_satisfied": 37,
"apdex_tolerated": 18,
"apdex_total": 56,
"tx_dbc_time": 13.375,
"tx_sql_time": 209.01785,
"tx_httpc_time": 661.3214,
"sql_count": 125,
"sql_error": 0,
"sql_time": 77.808,
"sql_fetch_count": 41112,
"sql_fetch_time": 3.162094E-4,
"httpc_count": 39,
"httpc_error": 0,
"httpc_time": 1138.1538,
"active_tx_count": 18,
"active_tx_0": 14,
"active_tx_3": 4,
"active_tx_8": 0,
"tps": 10,
"resp_time": 2924,
"arrival_rate": 10.8,
"pack_dropped": 35,
"metering": 4,
"_clock_delta_": 128,
"oid": 1499132250
}
]
MXQL path API
POST https://api.whatap.io/open/api/flush/mxql/path
# Add the _pk_ column with INJECT; param is unavailable.
curl --location 'https://api.whatap.io/open/api/flush/mxql/path' \
-H 'x-whatap-token: {{PROJECT API TOKEN}}' \
-H 'x-whatap-pcode: {{projectCode}}' \
-H 'Content-Type: application/json' \
-d '{
"stime": 1639016640000,
"etime": 1639016940000,
"mql": "/app/act_tx/agent_with_tx",
"limit": 2,
"pageKey": "mxql",
"inject": {
"default": "CREATE {key : _pk_, value : okindName}"
},
"param": {
}
}'
Key | Value |
---|---|
stime | Data lookup start time |
etime | Data lookup end time |
mql | See the following. |
limit | Maximum data query count |
pageKey | The string MXQL's fixed value |
inject | Optional See the following e.g. { "default": "ORDER {key : [oid], sort : [desc] }"} |
stime
and etime
in the request statement must be applied as the time for the user environment.
-
In case of no queried data
ResponseBody Example 1[]
-
In case of any queried data
ResponseBody Example 1[
{
"pcode": 101,
"pname": "Virtual",
"oid": -1348176005,
"oname": "22137-8071",
"otype": "ap",
"okind": -1085056726,
"okindName": "ote-virtual-1",
"onode": 334634079,
"onodeName": "node-1",
"type": "ap",
"subtype": "java",
"version": "2.1.0 20211207u",
"os_name": "Linux",
"ip": "192.168.1.57",
"container_id": 842770198,
"metering": 4,
"status": "ok",
"normal": 12,
"slow": 1,
"verySlow": 0,
"total": 13,
"_pk_": "okindName"
},
{
"pcode": 101,
"pname": "Virtual",
"oid": -883058050,
"oname": "22141-8070",
"otype": "ap",
"okind": -933992004,
"okindName": "ote-virtual-0",
"onode": 1693789385,
"onodeName": "node-0",
"type": "ap",
"subtype": "java",
"version": "2.1.0 20211207u",
"os_name": "Linux",
"ip": "192.168.1.57",
"container_id": 624997205,
"metering": 4,
"status": "ok",
"normal": 19,
"slow": 1,
"verySlow": 0,
"total": 20,
"_pk_": "okindName"
}
]