执行探索查询
curl --request POST \
--url 'https://api.flashcat.cloud/monit/query/explore?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"datasource_id": 101,
"expr": "rate(http_requests_total[5m])",
"args": {},
"execution": {
"kind": "range",
"from_ms": 1787187600000,
"to_ms": 1787191200000,
"max_data_points": 1200,
"min_step_seconds": 15
}
}
'import requests
url = "https://api.flashcat.cloud/monit/query/explore?app_key="
payload = {
"datasource_id": 101,
"expr": "rate(http_requests_total[5m])",
"args": {},
"execution": {
"kind": "range",
"from_ms": 1787187600000,
"to_ms": 1787191200000,
"max_data_points": 1200,
"min_step_seconds": 15
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
datasource_id: 101,
expr: 'rate(http_requests_total[5m])',
args: {},
execution: {
kind: 'range',
from_ms: 1787187600000,
to_ms: 1787191200000,
max_data_points: 1200,
min_step_seconds: 15
}
})
};
fetch('https://api.flashcat.cloud/monit/query/explore?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/monit/query/explore?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'datasource_id' => 101,
'expr' => 'rate(http_requests_total[5m])',
'args' => [
],
'execution' => [
'kind' => 'range',
'from_ms' => 1787187600000,
'to_ms' => 1787191200000,
'max_data_points' => 1200,
'min_step_seconds' => 15
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/monit/query/explore?app_key="
payload := strings.NewReader("{\n \"datasource_id\": 101,\n \"expr\": \"rate(http_requests_total[5m])\",\n \"args\": {},\n \"execution\": {\n \"kind\": \"range\",\n \"from_ms\": 1787187600000,\n \"to_ms\": 1787191200000,\n \"max_data_points\": 1200,\n \"min_step_seconds\": 15\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/monit/query/explore?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"datasource_id\": 101,\n \"expr\": \"rate(http_requests_total[5m])\",\n \"args\": {},\n \"execution\": {\n \"kind\": \"range\",\n \"from_ms\": 1787187600000,\n \"to_ms\": 1787191200000,\n \"max_data_points\": 1200,\n \"min_step_seconds\": 15\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/query/explore?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"datasource_id\": 101,\n \"expr\": \"rate(http_requests_total[5m])\",\n \"args\": {},\n \"execution\": {\n \"kind\": \"range\",\n \"from_ms\": 1787187600000,\n \"to_ms\": 1787191200000,\n \"max_data_points\": 1200,\n \"min_step_seconds\": 15\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"format": "explore_result.v1",
"result": {
"kind": "frames",
"frames": [
{
"kind": "time_series",
"fields": [
{
"name": "time",
"type": "time",
"values": [
"2026-08-20T10:00:00Z",
"2026-08-20T10:01:00Z"
]
},
{
"name": "value",
"type": "float",
"labels": {
"job": "api"
},
"values": [
1.25,
null
]
}
]
}
]
},
"execution": {
"kind": "range",
"effective_step_seconds": 60
}
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}诊断分析
执行探索查询
对已配置的数据源执行探索查询,返回 frames、samples 或 logs 形态的结果。
POST
/
monit
/
query
/
explore
执行探索查询
curl --request POST \
--url 'https://api.flashcat.cloud/monit/query/explore?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"datasource_id": 101,
"expr": "rate(http_requests_total[5m])",
"args": {},
"execution": {
"kind": "range",
"from_ms": 1787187600000,
"to_ms": 1787191200000,
"max_data_points": 1200,
"min_step_seconds": 15
}
}
'import requests
url = "https://api.flashcat.cloud/monit/query/explore?app_key="
payload = {
"datasource_id": 101,
"expr": "rate(http_requests_total[5m])",
"args": {},
"execution": {
"kind": "range",
"from_ms": 1787187600000,
"to_ms": 1787191200000,
"max_data_points": 1200,
"min_step_seconds": 15
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
datasource_id: 101,
expr: 'rate(http_requests_total[5m])',
args: {},
execution: {
kind: 'range',
from_ms: 1787187600000,
to_ms: 1787191200000,
max_data_points: 1200,
min_step_seconds: 15
}
})
};
fetch('https://api.flashcat.cloud/monit/query/explore?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/monit/query/explore?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'datasource_id' => 101,
'expr' => 'rate(http_requests_total[5m])',
'args' => [
],
'execution' => [
'kind' => 'range',
'from_ms' => 1787187600000,
'to_ms' => 1787191200000,
'max_data_points' => 1200,
'min_step_seconds' => 15
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/monit/query/explore?app_key="
payload := strings.NewReader("{\n \"datasource_id\": 101,\n \"expr\": \"rate(http_requests_total[5m])\",\n \"args\": {},\n \"execution\": {\n \"kind\": \"range\",\n \"from_ms\": 1787187600000,\n \"to_ms\": 1787191200000,\n \"max_data_points\": 1200,\n \"min_step_seconds\": 15\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/monit/query/explore?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"datasource_id\": 101,\n \"expr\": \"rate(http_requests_total[5m])\",\n \"args\": {},\n \"execution\": {\n \"kind\": \"range\",\n \"from_ms\": 1787187600000,\n \"to_ms\": 1787191200000,\n \"max_data_points\": 1200,\n \"min_step_seconds\": 15\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/query/explore?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"datasource_id\": 101,\n \"expr\": \"rate(http_requests_total[5m])\",\n \"args\": {},\n \"execution\": {\n \"kind\": \"range\",\n \"from_ms\": 1787187600000,\n \"to_ms\": 1787191200000,\n \"max_data_points\": 1200,\n \"min_step_seconds\": 15\n }\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"format": "explore_result.v1",
"result": {
"kind": "frames",
"frames": [
{
"kind": "time_series",
"fields": [
{
"name": "time",
"type": "time",
"values": [
"2026-08-20T10:00:00Z",
"2026-08-20T10:01:00Z"
]
},
{
"name": "value",
"type": "float",
"labels": {
"job": "api"
},
"values": [
1.25,
null
]
}
]
}
]
},
"execution": {
"kind": "range",
"effective_step_seconds": 60
}
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter template_id is not valid.",
"reason": "<string>"
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 100 次/分钟;16 次/秒 |
| 权限要求 | 数据源查看(monit) |
| Edge 版本要求 | 受支持的部署要求 monit-edge v0.68.0 或更高版本 |
使用说明
- 需要数据源原生结果形态时使用本接口;
/monit/query/data返回稳定的query_result.v1契约。本接口根据data.result.kind(frames、samples或logs)分发结果。 execution.kind决定可接受的配套字段:instant只需to_ms,range需要from_ms、to_ms和max_data_points,window需要from_ms和to_ms。不接受step_seconds,步长由max_data_points与min_step_seconds推导。args用于宏替换(例如 Grafana 风格变量),取值均为字符串。logs结果最多返回 1,000 条,并通过applied_limit与has_more说明截断情况。时序与采样结果各最多 1,000 条,成功响应整体上限 8 MiB。- WebAPI 跨实例转发与 Edge 执行合计可能耗时 35 秒,客户端超时建议至少 40 秒。
授权
在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API 时都必须携带。它等同于所属账户的身份凭证,请妥善保管。
请求体
application/json
探索查询请求。四个顶层字段均为必填,未知字段会被拒绝。
数据源 ID,来自 /monit/datasource/list。必须是正数且不超过 JavaScript 安全整数范围,且属于当前账户。
必填范围:
1 <= x <= 9007199254740991使用数据源原生语言的查询表达式(如 PromQL、LogsQL、SQL 等)。非空 UTF-8 字符串,最长 64 KiB;部分数据源类型限制更小。
Minimum string length:
1宏替换参数,按变量名索引,用于 Grafana 风格变量。键最长 256 字节,值最长 64 KiB,总预算 128 KiB。
Show child attributes
Show child attributes
查询的时间语义。可接受的配套字段取决于 kind:instant 只需 to_ms(from_ms 可选),range 需要 from_ms、to_ms 和 max_data_points,window 需要 from_ms 和 to_ms。HTTP 接口不接受 step_seconds。
Show child attributes
Show child attributes
此页面对您有帮助吗?