获取服务拓扑图
curl --request POST \
--url 'https://api.flashcat.cloud/monit/servicemap/topology?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"anchor": {
"host_id": "host_0123456789abcdef0123456789abcdef"
},
"depth": 2,
"max_nodes": 100,
"max_edges": 200,
"include_metrics": true,
"unresolved_mode": "full"
}
'import requests
url = "https://api.flashcat.cloud/monit/servicemap/topology?app_key="
payload = {
"anchor": { "host_id": "host_0123456789abcdef0123456789abcdef" },
"depth": 2,
"max_nodes": 100,
"max_edges": 200,
"include_metrics": True,
"unresolved_mode": "full"
}
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({
anchor: {host_id: 'host_0123456789abcdef0123456789abcdef'},
depth: 2,
max_nodes: 100,
max_edges: 200,
include_metrics: true,
unresolved_mode: 'full'
})
};
fetch('https://api.flashcat.cloud/monit/servicemap/topology?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/topology?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([
'anchor' => [
'host_id' => 'host_0123456789abcdef0123456789abcdef'
],
'depth' => 2,
'max_nodes' => 100,
'max_edges' => 200,
'include_metrics' => true,
'unresolved_mode' => 'full'
]),
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/topology?app_key="
payload := strings.NewReader("{\n \"anchor\": {\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n },\n \"depth\": 2,\n \"max_nodes\": 100,\n \"max_edges\": 200,\n \"include_metrics\": true,\n \"unresolved_mode\": \"full\"\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/topology?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"anchor\": {\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n },\n \"depth\": 2,\n \"max_nodes\": 100,\n \"max_edges\": 200,\n \"include_metrics\": true,\n \"unresolved_mode\": \"full\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/servicemap/topology?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 \"anchor\": {\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n },\n \"depth\": 2,\n \"max_nodes\": 100,\n \"max_edges\": 200,\n \"include_metrics\": true,\n \"unresolved_mode\": \"full\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"network_scope_id": "ns_0123456789abcdef0123456789abcdef",
"anchor_host_id": "host_0123456789abcdef0123456789abcdef",
"observed_at_ms": 1784635556072,
"freshness": {
"status": "fresh",
"newest_received_at_ms": 1784635557272,
"oldest_received_at_ms": 1784635557272,
"max_age_ms": 1200
},
"coverage": {
"direction": "outbound",
"hosts_loaded": 2,
"degraded_hosts": 0,
"truncated_hosts": 0,
"capture_modes": [
"ebpf"
],
"network_inventory_status": "complete",
"kubernetes_enrichment_status": "unavailable",
"listener_address_family_status": "complete",
"ipv6_wildcard_listener_count": 0,
"ipv6_only_known_listener_count": 0,
"ipv6_only_unknown_listener_count": 0
},
"truncated": false,
"nodes": [
{
"host_id": "host_0123456789abcdef0123456789abcdef",
"id": "procw_v1_source",
"kind": "process",
"display_name": "orders.service",
"systemd_unit": "orders.service",
"first_seen": "2026-07-01T02:00:00Z",
"last_seen": "2026-07-21T18:45:56.072+08:00"
},
{
"host_id": "host_fedcba9876543210fedcba9876543210",
"id": "procw_v1_mysql",
"kind": "process",
"display_name": "mysqld.service",
"systemd_unit": "mysqld.service",
"first_seen": "2026-07-01T02:00:00Z",
"last_seen": "2026-07-21T18:45:56.072+08:00"
}
],
"edges": [
{
"host_id": "host_0123456789abcdef0123456789abcdef",
"id": "edge_v1_example",
"source_entity_id": "procw_v1_source",
"source_netns_id": "netns_v1_default",
"destination": {
"ip": "203.0.113.105",
"port": 3306,
"protocol": "tcp"
},
"evidence": "connect",
"last_seen": "2026-07-21T18:45:56.072+08:00",
"depth": 1,
"endpoint_resolution": {
"status": "resolved",
"endpoint": {
"ip": "203.0.113.105",
"port": 3306,
"protocol": "tcp"
},
"candidates": [
{
"host_id": "host_fedcba9876543210fedcba9876543210",
"entity_id": "procw_v1_mysql",
"netns_id": "netns_v1_default",
"listener_id": "listener_v1_mysql",
"listener_ip": "203.0.113.105",
"effective_ip": "203.0.113.105",
"protocol": "tcp",
"port": 3306,
"match_kind": "exact",
"confidence": 1,
"node_kind": "process",
"node_display_name": "mysqld.service",
"graph_sequence": 42,
"observed_at_ms": 1784635556072
}
]
}
}
],
"unresolved_endpoints": [],
"resolution_counts": {
"resolved": 1,
"ambiguous": 0,
"unresolved": 0
},
"unresolved_projection": {
"mode": "full",
"total": 0,
"returned": 0,
"omitted": 0,
"by_reason": []
}
}
}{
"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
/
topology
获取服务拓扑图
curl --request POST \
--url 'https://api.flashcat.cloud/monit/servicemap/topology?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"anchor": {
"host_id": "host_0123456789abcdef0123456789abcdef"
},
"depth": 2,
"max_nodes": 100,
"max_edges": 200,
"include_metrics": true,
"unresolved_mode": "full"
}
'import requests
url = "https://api.flashcat.cloud/monit/servicemap/topology?app_key="
payload = {
"anchor": { "host_id": "host_0123456789abcdef0123456789abcdef" },
"depth": 2,
"max_nodes": 100,
"max_edges": 200,
"include_metrics": True,
"unresolved_mode": "full"
}
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({
anchor: {host_id: 'host_0123456789abcdef0123456789abcdef'},
depth: 2,
max_nodes: 100,
max_edges: 200,
include_metrics: true,
unresolved_mode: 'full'
})
};
fetch('https://api.flashcat.cloud/monit/servicemap/topology?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/topology?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([
'anchor' => [
'host_id' => 'host_0123456789abcdef0123456789abcdef'
],
'depth' => 2,
'max_nodes' => 100,
'max_edges' => 200,
'include_metrics' => true,
'unresolved_mode' => 'full'
]),
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/topology?app_key="
payload := strings.NewReader("{\n \"anchor\": {\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n },\n \"depth\": 2,\n \"max_nodes\": 100,\n \"max_edges\": 200,\n \"include_metrics\": true,\n \"unresolved_mode\": \"full\"\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/topology?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"anchor\": {\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n },\n \"depth\": 2,\n \"max_nodes\": 100,\n \"max_edges\": 200,\n \"include_metrics\": true,\n \"unresolved_mode\": \"full\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/monit/servicemap/topology?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 \"anchor\": {\n \"host_id\": \"host_0123456789abcdef0123456789abcdef\"\n },\n \"depth\": 2,\n \"max_nodes\": 100,\n \"max_edges\": 200,\n \"include_metrics\": true,\n \"unresolved_mode\": \"full\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"network_scope_id": "ns_0123456789abcdef0123456789abcdef",
"anchor_host_id": "host_0123456789abcdef0123456789abcdef",
"observed_at_ms": 1784635556072,
"freshness": {
"status": "fresh",
"newest_received_at_ms": 1784635557272,
"oldest_received_at_ms": 1784635557272,
"max_age_ms": 1200
},
"coverage": {
"direction": "outbound",
"hosts_loaded": 2,
"degraded_hosts": 0,
"truncated_hosts": 0,
"capture_modes": [
"ebpf"
],
"network_inventory_status": "complete",
"kubernetes_enrichment_status": "unavailable",
"listener_address_family_status": "complete",
"ipv6_wildcard_listener_count": 0,
"ipv6_only_known_listener_count": 0,
"ipv6_only_unknown_listener_count": 0
},
"truncated": false,
"nodes": [
{
"host_id": "host_0123456789abcdef0123456789abcdef",
"id": "procw_v1_source",
"kind": "process",
"display_name": "orders.service",
"systemd_unit": "orders.service",
"first_seen": "2026-07-01T02:00:00Z",
"last_seen": "2026-07-21T18:45:56.072+08:00"
},
{
"host_id": "host_fedcba9876543210fedcba9876543210",
"id": "procw_v1_mysql",
"kind": "process",
"display_name": "mysqld.service",
"systemd_unit": "mysqld.service",
"first_seen": "2026-07-01T02:00:00Z",
"last_seen": "2026-07-21T18:45:56.072+08:00"
}
],
"edges": [
{
"host_id": "host_0123456789abcdef0123456789abcdef",
"id": "edge_v1_example",
"source_entity_id": "procw_v1_source",
"source_netns_id": "netns_v1_default",
"destination": {
"ip": "203.0.113.105",
"port": 3306,
"protocol": "tcp"
},
"evidence": "connect",
"last_seen": "2026-07-21T18:45:56.072+08:00",
"depth": 1,
"endpoint_resolution": {
"status": "resolved",
"endpoint": {
"ip": "203.0.113.105",
"port": 3306,
"protocol": "tcp"
},
"candidates": [
{
"host_id": "host_fedcba9876543210fedcba9876543210",
"entity_id": "procw_v1_mysql",
"netns_id": "netns_v1_default",
"listener_id": "listener_v1_mysql",
"listener_ip": "203.0.113.105",
"effective_ip": "203.0.113.105",
"protocol": "tcp",
"port": 3306,
"match_kind": "exact",
"confidence": 1,
"node_kind": "process",
"node_display_name": "mysqld.service",
"graph_sequence": 42,
"observed_at_ms": 1784635556072
}
]
}
}
],
"unresolved_endpoints": [],
"resolution_counts": {
"resolved": 1,
"ambiguous": 0,
"unresolved": 0
},
"unresolved_projection": {
"mode": "full",
"total": 0,
"returned": 0,
"omitted": 0,
"by_reason": []
}
}
}{
"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"
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 20 次/分钟;1 次/秒 |
| 权限要求 | 服务拓扑查看(monit) |
使用说明
- 服务拓扑是可选子系统:未配置
redis.servicemap的部署会返回ServiceUnavailable。 at当前仅支持now(留空效果相同)。direction当前仅支持outbound(留空效果相同)。anchor.host_id必须已被服务拓扑感知(存在当前或近期的拓扑数据),否则返回ResourceNotFound。depth(最大 3)、max_nodes(最大 500)、max_edges(最大 1000)共同限定遍历范围;触发任一上限时truncated=true,并在truncation_reasons中说明原因。unresolved_mode=summary(相对默认值full)会从edges中省略未解析边,仅在unresolved_endpoints中返回有界样本。
授权
在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API 时都必须携带。它等同于所属账户的身份凭证,请妥善保管。
请求体
application/json
出向拓扑遍历的查询参数。
遍历的起始主机(及可选的实体)。
Show child attributes
Show child attributes
可选的一致性校验:如果设置,必须与 anchor.host_id 已关联的网络域一致,否则返回 InvalidParameter。
查询的时间选择器。当前仅支持 now;省略该字段效果相同。
可用选项:
now 遍历方向。当前仅支持 outbound;省略该字段效果相同。
可用选项:
outbound 从锚点开始的最大遍历深度。默认 1,最大 3。
必填范围:
x <= 3返回节点数量的上限,超出则截断。默认 100,最大 500。
必填范围:
x <= 500遍历边数量的上限,超出则截断。默认 200,最大 1000。
必填范围:
x <= 1000是否在响应中包含每条边的原始 metrics 数据。默认 false。
未解析边的投影方式。full(默认)会将其同时纳入 edges 和 unresolved_endpoints;summary 会从 edges 中省略,仅在 unresolved_endpoints 中返回有界样本。
可用选项:
summary, full 此页面对您有帮助吗?
⌘I