curl --location 'https://api.flashcat.cloud/api/v2/firemap/rule/card/upsert' \
--header 'X-User-Token: YOUR_USER_TOKEN' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdXVpZCI6IjM2ZTRjZjI3LWI4OWYtNDFlZS04ZDhmLWZiMjdhMmZlZGIzOSIsImF1dGhvcml6ZWQiOnRydWUsImV4cCI6MTc3NTExMTEyMywidXNlcl9pZGVudGl0eSI6IjEtcm9vdCJ9.IwPWDg92AjjvuUTGplaXgpexmOSsONx73M7Y7pOI_vE' \
--header 'Content-Type: application/json' \
--data '{
"id": 0,
"name": "Kubernetes Pod 自动发现",
"note": "按 namespace/pod 标签自动生成灭火图卡片",
"enable": true,
"data_source_type": "prometheus",
"data_source_ids": [
1
],
"window_seconds": 300,
"delay_seconds": 60,
"calculation": 1,
"firemap_type": "function",
"business_name": "核心业务",
"group_names": [
"Kubernetes",
"Workload"
],
"card_name": "$namespace / $pod",
"labels": {
"namespace": "$namespace",
"pod": "$pod"
},
"metrics": [
{
"metric_idx": "A",
"metric": "pod_cpu_usage",
"name": "CPU 使用率",
"mode": 0,
"layout_number": 0,
"unit": "%",
"settings": {
"prometheus.promql": "sum(rate(container_cpu_usage_seconds_total{namespace=\"$namespace\",pod=\"$pod\"}[5m]))"
}
}
],
"multi_thresholds": [
{
"group_uuid": "a24d127e-4333-4b41-a308-35466b3b4e60",
"severity": 2,
"mode": 0,
"thresholds": [
{
"metric": "pod_cpu_usage",
"operator": ">",
"threshold": 80,
"limit": 3,
"aggregation": "avg"
}
]
}
],
"settings": {
"label_keys": [
"namespace",
"pod"
]
},
"blacklists": [
{
"namespace": "kube-system"
}
],
"delete_rule": {
"num_of_nodata_days": 7,
"delete_by_path_match": true,
"time_unit_of_path_match": "1d",
"time_num_of_path_match": 1
},
"num_of_cycle": 5,
"unit_of_cycle": "m",
"limit": 100
}'