n9e-edge无法正常发送告警恢复以及历史报警栏中标签会丢失

Viewed 116

版本
n9e v6 G10
n9e-edge v6 G10
categraf v0.2.35 (目前看来与这个版本无关)
victoria-metrics v1.73.0

架构说明:
ECS机器均通过categraf采集指标并且直接对接了n9e-edge,由n9e-edge写入VM中,其他中间件监控均使用市场开源的exporter获取指标由prometheus远程写入到VM中。n9e-edge侧属于边缘机房与n9e端对接,边缘机房告警引擎均配置为n9e-edge配置中的EngineName。

edge.toml 配置信息

[Global]
RunMode = "release"

[CenterApi]
Addrs = ["http://10.0.202.33:17000"]
BasicAuthUser = "user001"
BasicAuthPass = "ccc26da7b9aba533cbb263a36c07dcc5"
# unit: ms
Timeout = 9000

[Log]
# log write dir
Dir = "logs"
# log level: DEBUG INFO WARNING ERROR
Level = "DEBUG"
# stdout, stderr, file
Output = "stdout"
# # rotate by time
# KeepHours = 4
# # rotate by size
# RotateNum = 3
# # unit: MB
# RotateSize = 256

[HTTP]
# http listening address
Host = "0.0.0.0"
# http listening port
Port = 17000
# https cert file path
CertFile = ""
# https key file path
KeyFile = ""
# whether print access log
PrintAccessLog = false
# whether enable pprof
PProf = false
# expose prometheus /metrics?
ExposeMetrics = true
# http graceful shutdown timeout, unit: s
ShutdownTimeout = 30
# max content length: 64M
MaxContentLength = 67108864
# http server read timeout, unit: s
ReadTimeout = 20
# http server write timeout, unit: s
WriteTimeout = 40
# http server idle timeout, unit: s
IdleTimeout = 120

[HTTP.APIForAgent]
Enable = true
# [HTTP.APIForAgent.BasicAuth]
# user001 = "ccc26da7b9aba533cbb263a36c07dcc5"

[HTTP.APIForService]
Enable = true
[HTTP.APIForService.BasicAuth]
user001 = "ccc26da7b9aba533cbb263a36c07dcc5"

[Alert]
[Alert.Heartbeat]
# auto detect if blank
IP = ""
# unit ms
Interval = 1000
EngineName = "edge-huawei-cloud"

# [Alert.Alerting]
# NotifyConcurrency = 10

[Pushgw]
# use target labels in database instead of in series
LabelRewrite = true
# # default busigroup key name
# BusiGroupLabelKey = "busigroup"
# ForceUseServerTS = false

# [Pushgw.DebugSample]
# ident = "xx"
# __name__ = "xx"

# [Pushgw.WriterOpt]
# # Writer Options
# QueueCount = 1000
# QueueMaxSize = 1000000
# QueuePopSize = 1000
# # ident or metric
# ShardingKey = "ident"

[[Pushgw.Writers]]
# Url = "http://127.0.0.1:8480/insert/0/prometheus/api/v1/write"
Url = "http://127.0.0.1:8428/api/v1/write"
# Basic auth username
BasicAuthUser = ""
# Basic auth password
BasicAuthPass = ""
# timeout settings, unit: ms
Headers = ["X-From", "n9e"]
Timeout = 10000
DialTimeout = 3000
TLSHandshakeTimeout = 30000
ExpectContinueTimeout = 1000
IdleConnTimeout = 90000
# time duration, unit: ms
KeepAlive = 30000
MaxConnsPerHost = 0
MaxIdleConns = 100
MaxIdleConnsPerHost = 100
## Optional TLS Config
# UseTLS = false
# TLSCA = "/etc/n9e/ca.pem"
# TLSCert = "/etc/n9e/cert.pem"
# TLSKey = "/etc/n9e/key.pem"
# InsecureSkipVerify = false
# [[Writers.WriteRelabels]]
# Action = "replace"
# SourceLabels = ["__address__"]
# Regex = "([^:]+)(?::\\d+)?"
# Replacement = "$1:80"
# TargetLabel = "__address__"

通过模拟一个告警观察现象:

下图表示数据源告警引擎选择edge后,在edge服务器中发现告警的截图:
image.png
原则上来说告警都是可以看到执行的脚步返回以及发送钉钉的一些信息输出,但是edge看不到不过问题不大,这个告警已经发送出来了。

下图表示数据源告警引擎选择edge后,手动恢复告警值,在edge服务器中发现的一些日志截图:
image.png
原则上来讲,告警恢复是要给钉钉等媒介发送告警恢复的消息,但是到目前为止没有任何恢复通知。

下图表示本次模拟告警恢复后在前端页面看到的历史告警截图:
image.png
可以看到当发生报警时这条信息没问题,但是等恢复后标签都丢失了,这里我就开始怀疑恢复通知没下发与这个标签丢失有一点关联。

接下来把边缘机房的数据源告警引擎切换至n9e 进行模拟验证

下图表示数据源告警引擎选择n9e后,在n9e服务器中发现告警的截图:
image.png
可以看到当报警发生时,消息发送都很明确,很清楚看到发到哪了,这个到没问题。

下图表示数据源告警引擎选择n9e后,手动恢复告警值,在n9e服务器中发现的一些日志截图:
image.png
可以看到有相关恢复的事件,并且也有消息通知发出,我在钉钉中确实有收到恢复通知。

下图表示本次模拟告警恢复后在前端页面看到的历史告警截图:
image.png
可以看到这个报警恢复的历史数据很正常,也没有丢标签的现象了。

总体的问题就是这样,使用edge后无法走通完整的报警恢复流程,通过几次验证后不管是使用了categraf还是其他开源的exporter 都会有这种问题,所以这个大概与categraf 没有关系,求保姆级解决方案!!!

2 Answers

@AKAYYDS 感谢反馈,这个问题 在手动修改 promql 之后,导致告警恢复的情况下会出现,最新的代码已经修复了,可以拉最新的代码自己编译下二进制,或者等下次发版的时候更新下

意思是手动对监控规则阈值的修改来模拟本次故障发生的时候,会出现这样的情况吗?