curl --location --request POST 'https://api.flashcat.cloud/api/n9e-plus/pingmesh/alert-rules/export' \
--header 'X-User-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"notify_channels": [
"feishu",
"qq"
],
"notify_groups": [
"2"
],
"alert_rules": [
{
"idc_relation": "idc_inside",
"severity": 2,
"rules": [
{
"cate": "idc",
"aggregation": "max",
"metric": "ping_percent_packet_loss",
"op": ">",
"threshold": "40",
"logic": "||"
},
{
"cate": "idc",
"aggregation": "max",
"metric": "net_response_response_time",
"op": ">",
"threshold": "43.20",
"logic": ""
}
]
},
{
"idc_relation": "idc_between",
"severity": 2,
"rules": [
{
"cate": "net_ident",
"aggregation": "max",
"metric": "ping_percent_packet_loss",
"op": ">",
"threshold": "40",
"logic": "||"
},
{
"cate": "server",
"aggregation": "max",
"metric": "net_response_response_time",
"op": ">",
"threshold": "43.20",
"logic": ""
}
]
},
{
"idc_relation": "custom",
"severity": 2,
"source_idc": "idc1",
"target_idc": "idc2",
"rules": [
{
"cate": "net_ident",
"aggregation": "max",
"metric": "ping_percent_packet_loss",
"op": ">",
"threshold": "40",
"logic": "||"
},
{
"cate": "server",
"aggregation": "max",
"metric": "net_response_response_time",
"op": ">",
"threshold": "43.20",
"logic": ""
}
]
}
]
}'
{
"dat": [
{
"id": 0,
"group_id": 0,
"cate": "prometheus",
"datasource_ids": [
849
],
"cluster": "",
"name": "pingmesh-IDC内-丢包率or延迟告警",
"note": "pingmesh alert rule of the idc_inside",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 3,
"severities": null,
"disabled": 0,
"prom_for_duration": 60,
"prom_ql": "max by(sidc,tidc,protocol,relation)(ping_percent_packet_loss{relation=\"idc_inside\"}) > 40 or max by(sidc,tidc,protocol,relation)(net_response_response_time{relation=\"idc_inside\"}) > 43.20",
"rule_config": null,
"prom_eval_interval": 30,
"enable_stime": "00:00",
"enable_stimes": null,
"enable_etime": "23:59",
"enable_etimes": null,
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_days_of_weeks": null,
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"feishu",
"qq"
],
"notify_groups_obj": null,
"notify_groups": [
"2"
],
"notify_repeat_step": 60,
"notify_max_number": 0,
"recover_duration": 0,
"callbacks": null,
"runbook_url": "",
"append_tags": null,
"annotations": null,
"extra_config": null,
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": ""
},
{
"id": 0,
"group_id": 0,
"cate": "prometheus",
"datasource_ids": [
849
],
"cluster": "",
"name": "pingmesh-IDC之间-机柜之间丢包率or服务器之间延迟告警",
"note": "pingmesh alert rule of the idc_between",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 3,
"severities": null,
"disabled": 0,
"prom_for_duration": 60,
"prom_ql": "max by(sidc,tidc,protocol,relation,snet_ident,tnet_ident)(ping_percent_packet_loss{relation=\"idc_between\"}) > 40 or max by(sidc,tidc,protocol,relation,snet_ident,tnet_ident,ident,target)(net_response_response_time{relation=\"idc_between\"}) > 43.20",
"rule_config": null,
"prom_eval_interval": 30,
"enable_stime": "00:00",
"enable_stimes": null,
"enable_etime": "23:59",
"enable_etimes": null,
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_days_of_weeks": null,
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"feishu",
"qq"
],
"notify_groups_obj": null,
"notify_groups": [
"2"
],
"notify_repeat_step": 60,
"notify_max_number": 0,
"recover_duration": 0,
"callbacks": null,
"runbook_url": "",
"append_tags": null,
"annotations": null,
"extra_config": null,
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": ""
},
{
"id": 0,
"group_id": 0,
"cate": "prometheus",
"datasource_ids": [
849
],
"cluster": "",
"name": "pingmesh-IDC之间从idc1到idc2,机柜之间丢包率or服务器之间延迟告警",
"note": "pingmesh alert rule of the custom",
"prod": "",
"algorithm": "",
"algo_params": null,
"delay": 0,
"severity": 3,
"severities": null,
"disabled": 0,
"prom_for_duration": 60,
"prom_ql": "max by(sidc,tidc,protocol,relation,snet_ident,tnet_ident)(ping_percent_packet_loss{sidc=\"41#idc1\",tidc=\"40#idc2\"}) > 40 or max by(sidc,tidc,protocol,relation,snet_ident,tnet_ident,ident,target)(net_response_response_time{sidc=\"41#idc1\",tidc=\"40#idc2\"}) > 43.20",
"rule_config": null,
"prom_eval_interval": 30,
"enable_stime": "00:00",
"enable_stimes": null,
"enable_etime": "23:59",
"enable_etimes": null,
"enable_days_of_week": [
"1",
"2",
"3",
"4",
"5",
"6",
"0"
],
"enable_days_of_weeks": null,
"enable_in_bg": 0,
"notify_recovered": 1,
"notify_channels": [
"feishu",
"qq"
],
"notify_groups_obj": null,
"notify_groups": [
"2"
],
"notify_repeat_step": 60,
"notify_max_number": 0,
"recover_duration": 0,
"callbacks": null,
"runbook_url": "",
"append_tags": null,
"annotations": null,
"extra_config": null,
"create_at": 0,
"create_by": "",
"update_at": 0,
"update_by": ""
}
],
"err": ""
}