新增/修改卡片
POST
/api/v2/firemap/flexible/card/upsert
最后修改时间:2024-03-15 06:55:19
请求参数
Header 参数
Content-Type
string
必需
示例值:
application/json
FC-WORKSPACE-ID
string
必需
示例值:
1963865361927
Body 参数application/json
id
integer
必需
name
string
必需
owners
array[string]
可选
firemap_type
enum<string>
必需
枚举值:
slomodule
order
integer
必需
business_id
integer
必需
business_name
string
可选
group_id
integer
可选
group_name
string
可选
data_source_type
string
必需
data_source_ids
array[integer]
必需
metrics
array [object {4}]
必需
metric
string
必需
name
string
必需
settings
object
必需
aggregation
string
必需
multi_thresholds
array [object {4}]
必需
thresholds
array [object {5}]
可选
severity
integer
可选
mode
enum<integer>
模式
枚举值:
01
expression
string
可选
示例
{
"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
]
}
]
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
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
]
}
]
}'
返回响应
🟢200成功
application/json
Body
request_id
string
必需
data
integer
必需
示例
{
"request_id": "string",
"data": 0
}

添加官方技术人员微信
在这里,获得使用上的任何帮助,快速上手企业告警一站式响应平台FlashDuty


修改于 2024-03-15 06:55:19