- 介绍
- /api/n9e 接口
- 告警规则
- 订阅规则
- 屏蔽规则
- 告警事件
- 通知规则
- 机器列表
- 团队管理
- 业务组管理
- 用户管理
- 权限管理
- 采集配置
- 网络设备
- 告警管理
- 指标视图
- 告警自愈
- 采集配置
- 网络设备
- pingmesh
- pingmesh-idc网络规则注册POST
- pingmesh-idc网络规则修改PUT
- pingmesh-idc网络规则查询GET
- pingmesh-idc网络规则删除DELETE
- pingmesh-idc间ping规则配置注册POST
- pingmesh-idc间ping规则配置查看GET
- pingmesh-idc间ping规则配置修改PUT
- pingmesh-idc间ping规则配置删除DELETE
- pingmesh-ping动作开关设置PUT
- pingmesh-ping动作开关查询GET
- pingmesh-idc之间拓扑图GET
- pingmesh-idc内netident拓扑GET
- pingmesh-netident内server之间拓扑GET
- pingmesh-查询指标历史数据POST
- pingmesh-idc网络规则注册(From CMDB)POST
- pingmesh-报警规则导出POST
- 数据查询
- 仪表盘
- 模板中心
- 拨测任务API
- 集成仪表盘
- 审计管理
- 数据源
- 全局屏蔽
- 仪表盘标注
- 通知媒介
- 消息模板
- auth认证
- metricsDesc
- 通知配置-待下线
- 快捷视图(指标)
- 变量设置
- 单点登陆
- 用户信息--待删除(与用户管理重复)
- /v1/n9e 接口
pingmesh-报警规则导出
POST
https://api.flashcat.cloud/api/n9e-plus/pingmesh/alert-rules/export
pingmesh
最后修改时间:2024-03-08 11:32:02
body参数说明:
metric:
- ping_percent_packet_loss (icmp协议丢包率) ping_maximum_response_ms(最大延迟)
- net_response_response_time (tcp/udp: 延时 )
aggregation: 指标聚合方法
- max
- avg
- min
op: metric阈值比较方法:
- < 、> 、<= 、>= 、== 、!=
threshold: 阈值(string类型)
- 如 -1, 23.223, 100
logic: 多个metric之间的逻辑运算服
- || 、&&
severity: 报警等级 1,2,3
idc_relation: 机房间关系: idc_inside、idc_between
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Header 参数
Authorization
string
可选
示例值:
Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3NfdXVpZCI6IjRlNzYxNmY2LWFjZGUtNGNlNS04MmE3LTBiMTgyYzJjYzQ2ZiIsImF1dGhvcml6ZWQiOnRydWUsImV4cCI6MTcwMDA0NjQxNiwidXNlcl9pZGVudGl0eSI6IjEtcm9vdCJ9.Xe_fI7H2tUnLtnwe7fkI4wT0DBYetLkUWG2O_0KuoYM
Body 参数application/json
notify_channels
array[string]
必需
notify_groups
array[string]
必需
alert_rules
array [object {5}]
必需
idc_relation
string
必需
severity
integer
必需
rules
array [object {6}]
必需
source_idc
string
可选
target_idc
string
可选
示例
{
"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": ""
}
]
}
]
}
示例代码
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/n9e-plus/pingmesh/alert-rules/export' \
--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": ""
}
]
}
]
}'
返回响应
🟢200成功
application/json
Body
dat
array [object {41}]
必需
id
integer
必需
group_id
integer
必需
cate
string
必需
datasource_ids
array[integer]
必需
cluster
string
必需
name
string
必需
note
string
必需
prod
string
必需
algorithm
string
必需
algo_params
null
必需
delay
integer
必需
severity
integer
必需
severities
null
必需
disabled
integer
必需
prom_for_duration
integer
必需
prom_ql
string
必需
rule_config
null
必需
prom_eval_interval
integer
必需
enable_stime
string
必需
enable_stimes
null
必需
enable_etime
string
必需
enable_etimes
null
必需
enable_days_of_week
array[string]
必需
enable_days_of_weeks
null
必需
enable_in_bg
integer
必需
notify_recovered
integer
必需
notify_channels
array[string]
必需
notify_groups_obj
null
必需
notify_groups
array[string]
必需
notify_repeat_step
integer
必需
notify_max_number
integer
必需
recover_duration
integer
必需
callbacks
null
必需
runbook_url
string
必需
append_tags
null
必需
annotations
null
必需
extra_config
null
必需
create_at
integer
必需
create_by
string
必需
update_at
integer
必需
update_by
string
必需
err
string
必需
示例
{
"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": ""
}

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


修改于 2024-03-08 11:32:02