PrometheusAlert
PrometheusAlert copied to clipboard
飞书机器人告警接口调用成功,但是实际上未发送到飞书群
日志如下: [feishuv2] {"msg_type":"interactive","email":"[email protected]","card":{"config":{"wide_screen_mode":true,"enable_forward":true},"elements":[{"tag":"div","text":{"content":"日志项目:chl-test\r\n告警标题:chl-test\r\n命名空间:cn-rule-chl\r\n容器名称:cn-rule-chl\r\n告警等级:P0\r\n重复次数:0\r\n重复告警:1\r\n告警关键字:\r\ntraceId:\r\n告警内容:卡片问题测试-chl-3}
2023/10/12 11:13:22.387 [I] [feishu.go:30] [1697080402135415717] [feishuv2] PrometheusAlert告警消息: {"StatusCode":0,"StatusMessage":"success","code":0,"data":{},"msg":"success"}
但实际上对应的飞书群并未收到消息卡片,之前是好的,从昨天下午就开始不行了
补充请求源码和业务日志: 源码: req, err := http.NewRequest("POST", prometheusAlertUrl, bytes.NewBuffer(jsonStr)) if err != nil { log.Error(err.Error()) return "error", err } else { // req.Header.Set("X-Custom-Header", "myvalue") req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
log.Infof("调用prometheusAlert异常,%s", err.Error())
return "error", err
} else {
log.Infof("response Status:%s", resp.Status)
log.Debug("response Headers:", resp.Header)
body, _ := ioutil.ReadAll(resp.Body)
defer resp.Body.Close()
log.Infof("response Body:%s", string(body))
return "success", nil
}
}
日志: