获取采集状态
curl --request POST \
--url 'https://api.flashcat.cloud/monit/servicemap/status?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"host_id": "host_0123456789abcdef0123456789abcdef"
}
'import requests
url = "https://api.flashcat.cloud/monit/servicemap/status?app_key="
payload = { "host_id": "host_0123456789abcdef0123456789abcdef" }
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({host_id: 'host_0123456789abcdef0123456789abcdef'})
};
fetch('https://api.flashcat.cloud/monit/servicemap/status?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/servicemap/status?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([
'host_id' => 'host_0123456789abcdef0123456789abcdef'
]),
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/servicemap/status?app_key="
payload := strings.NewReader("{\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\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/servicemap/status?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/servicemap/status?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 \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"fleet": false,
"items": [
{
"host_id": "host_0123456789abcdef0123456789abcdef",
"network_scope_id": "ns_0123456789abcdef0123456789abcdef",
"status": "active",
"authoritative": true,
"graph_available": true,
"capability": {
"present": true,
"enabled": true,
"status": "running",
"host_id": "host_0123456789abcdef0123456789abcdef",
"capture_mode": "ebpf",
"report_interval_ms": 60000,
"snapshot_ready": true
},
"freshness": {
"status": "fresh",
"newest_received_at_ms": 1784635557272,
"oldest_received_at_ms": 1784635557272,
"max_age_ms": 1200
},
"coverage": {
"degraded": false,
"truncated": false,
"network_inventory_status": "complete",
"kubernetes_enrichment_status": "unavailable"
},
"observed_at_ms": 1784635556072,
"received_at_ms": 1784635557272,
"report_interval_ms": 60000,
"node_count": 12,
"edge_count": 8
}
],
"coverage": {
"requested": 1,
"succeeded": 1,
"failed": 0,
"truncated": false,
"states": {
"active": 1,
"degraded": 0,
"stale": 0,
"initializing": 0,
"disabled": 0,
"unsupported": 0,
"no_data": 0
}
},
"partial": false,
"generated_at_ms": 1784635558472
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "ServiceUnavailable",
"message": "servicemap store is not initialized"
}
}服务拓扑
获取采集状态
返回一台或多台主机的服务拓扑采集状态,或一份有界的主机群抽样状态。
POST
/
monit
/
servicemap
/
status
获取采集状态
curl --request POST \
--url 'https://api.flashcat.cloud/monit/servicemap/status?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"host_id": "host_0123456789abcdef0123456789abcdef"
}
'import requests
url = "https://api.flashcat.cloud/monit/servicemap/status?app_key="
payload = { "host_id": "host_0123456789abcdef0123456789abcdef" }
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({host_id: 'host_0123456789abcdef0123456789abcdef'})
};
fetch('https://api.flashcat.cloud/monit/servicemap/status?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/servicemap/status?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([
'host_id' => 'host_0123456789abcdef0123456789abcdef'
]),
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/servicemap/status?app_key="
payload := strings.NewReader("{\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\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/servicemap/status?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/servicemap/status?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 \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"fleet": false,
"items": [
{
"host_id": "host_0123456789abcdef0123456789abcdef",
"network_scope_id": "ns_0123456789abcdef0123456789abcdef",
"status": "active",
"authoritative": true,
"graph_available": true,
"capability": {
"present": true,
"enabled": true,
"status": "running",
"host_id": "host_0123456789abcdef0123456789abcdef",
"capture_mode": "ebpf",
"report_interval_ms": 60000,
"snapshot_ready": true
},
"freshness": {
"status": "fresh",
"newest_received_at_ms": 1784635557272,
"oldest_received_at_ms": 1784635557272,
"max_age_ms": 1200
},
"coverage": {
"degraded": false,
"truncated": false,
"network_inventory_status": "complete",
"kubernetes_enrichment_status": "unavailable"
},
"observed_at_ms": 1784635556072,
"received_at_ms": 1784635557272,
"report_interval_ms": 60000,
"node_count": 12,
"edge_count": 8
}
],
"coverage": {
"requested": 1,
"succeeded": 1,
"failed": 0,
"truncated": false,
"states": {
"active": 1,
"degraded": 0,
"stale": 0,
"initializing": 0,
"disabled": 0,
"unsupported": 0,
"no_data": 0
}
},
"partial": false,
"generated_at_ms": 1784635558472
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "ServiceUnavailable",
"message": "servicemap store is not initialized"
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 100 次/分钟;5 次/秒 |
| 权限要求 | 监控对象查看(monit) |
使用说明
- 服务拓扑是可选子系统:未配置
redis.servicemap的部署会返回ServiceUnavailable。 - 每次调用只能使用一种选择方式:显式的
host_id/host_ids,或fleet=true;两者同时传入会被拒绝。 - 与
POST /monit/servicemap/topology、POST /monit/servicemap/summary不同,单个主机解析失败不会导致整个请求失败,而是通过items[].error_code逐项披露。 limit(默认 100,最大 200)限定了显式主机的接受数量,在fleet模式下则限定了抽样的候选主机数量。
授权
在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API 时都必须携带。它等同于所属账户的身份凭证,请妥善保管。
请求体
application/json
选择要查询采集状态的主机:可指定明确的主机 ID,或使用有界的主机群抽样。
要查询的单个主机 ID。可与 host_ids 组合以查询多台;与 fleet=true 互斥。
Maximum string length:
128Pattern:
^host_[a-z0-9_-]+$本次调用要查询的多个主机 ID,与 host_id 合计最多 200 个。与 fleet=true 互斥。
为 true 时忽略 host_id/host_ids,改为对账户内主机抽样,最多返回 limit 台候选主机。默认 false。
fleet 模式下抽样的候选主机数量,其他模式下忽略该字段。默认 100,范围 1~200。
必填范围:
1 <= x <= 200此页面对您有帮助吗?
⌘I