概述
通常我们要 silence 某个 AlertManager 的 alert 时,需要通过 UI 界面操作,如下图:
效率有点低,而且不够自动化,那么是否可以有一种办法快速创建 AlertManager silence 呢?
-- 有的,通过 API.
API Payload
v1
如下:
{
"matchers": [
{
"name": "alername1",
"value": ".*",
"isRegex": true
}
],
"startsAt": "2022-04-29T22:12:33.533Z",
"endsAt": "2022-04-29T23:11:44.603Z",
"createdBy": "api",
"comment": "Silence",
"status": {
"state": "active"
}
}
v2
{
"matchers": [
{
"name": "service",
"value": "rancher",
"isRegex": false,
"isEqual": true
},
{
"name": "alertname",
"value": "TargetDown",
"isRegex": false,
"isEqual": true
}
],
"startsAt": "2022-04-29T10:11:35.656Z",
"endsAt": "2022-04-29T12:11:35.656Z",
"createdBy": "Casey Cui",
"comment": "配置错误导致的误报",
"id": null
}
具体实现
curl 实现
标签:AlertManager,name,04,api,isRegex,value,API,silence From: https://www.cnblogs.com/east4ming/p/17032251.html