curl --location --request POST 'https://api.flashcat.cloud/api/v2/firemap/flexible/card/upsert' \
--header 'FC-WORKSPACE-ID: 1963865361927' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 1714,
"name": "自定义模块指标-测试",
"owners": [],
"firemap_type": "module",
"order": 0,
"business_id": 1281,
"business_name": "v2_测试",
"group_id": 0,
"group_name": "",
"data_source_type": "prometheus",
"data_source_ids": [
241
],
"metrics": [
{
"metric": "alive",
"name": "实例存活率",
"settings": {
"prometheus.promql": "sum ( up { container =~ \"grafana\" } ) by ( container ) / count ( up { container =~ \"grafana\" } ) by ( container ) * 100"
},
"aggregation": "min"
},
{
"metric": "cpu",
"name": "CPU使用率",
"settings": {
"prometheus.promql": "sum ( irate ( container_cpu_usage_seconds_total { container =~ \"grafana\" } [5m] ) * 100 ) by ( pod )"
},
"aggregation": "max"
},
{
"metric": "mem",
"name": "MEM使用率",
"settings": {
"prometheus.promql": "sum ( container_memory_usage_bytes { container =~ \"grafana\", namespace = \"monitoring\" } ) by ( pod, container ) / sum ( container_spec_memory_limit_bytes { container =~ \"grafana\", namespace = \"monitoring\" } ) by ( pod, container ) * 100"
},
"aggregation": "max"
}
],
"thresholds": [
{
"metric": "alive",
"threshold": 101,
"operator": "<",
"logic": "",
"normalize": "percentage"
}
],
"multi_thresholds": [
{
"thresholds": [
{
"metric": "alive",
"threshold": 101,
"operator": "<",
"logic": "",
"normalize": "percentage"
},
"severity": 1
]
}
]
}'