ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## AlertManager 语法 实例 ``` # The root route with all parameters, which are inherited by the child # routes if they are not overwritten. route: receiver: 'default-receiver' group_wait: 30s group_interval: 5m repeat_interval: 4h group_by: [cluster, alertname] # All alerts that do not match the following child routes # will remain at the root node and be dispatched to 'default-receiver'. routes: # All alerts with service=mysql or service=cassandra # are dispatched to the database pager. - receiver: 'database-pager' group_wait: 10s matchers: - service=~"mysql|cassandra" # All alerts with the team=frontend label match this sub-route. # They are grouped by product and environment rather than cluster # and alertname. - receiver: 'frontend-pager' group_by: [product, environment] matchers: - team="frontend" # All alerts with the service=inhouse-service label match this sub-route. # the route will be muted during offhours and holidays time intervals. # even if it matches, it will continue to the next sub-route - receiver: 'dev-pager' matchers: - service="inhouse-service" mute_time_intervals: - offhours - holidays continue: true # All alerts with the service=inhouse-service label match this sub-route # the route will be active only during offhours and holidays time intervals. - receiver: 'on-call-pager' matchers: - service="inhouse-service" active_time_intervals: - offhours - holidays ``` 说明 ``` receiver: 'default-receiver' 默认的接收者。如果没有匹配到任何子路由,告警将被发送到这个接收者。 group_wait: 30s 在分组发送告警前等待30秒,以便收集更多的告警。 group_interval: 5m 如果有新的告警属于同一个分组,在发送第一次告警后等待5分钟再发送后续告警。 repeat_interval: 4h 对同一组告警每4小时重复发送一次通知,直到问题解决。 group_by: [cluster, alertname] 按`cluster`和`alertname`进行分组,避免同一个集群和同一个告警类型产生过多的通知。 ``` ### 可用的 `receiver` ``` # The unique name of the receiver. name: <string> # Configurations for several notification integrations. discord_configs: [ - <discord_config>, ... ] email_configs: [ - <email_config>, ... ] msteams_configs: [ - <msteams_config>, ... ] opsgenie_configs: [ - <opsgenie_config>, ... ] pagerduty_configs: [ - <pagerduty_config>, ... ] pushover_configs: [ - <pushover_config>, ... ] slack_configs: [ - <slack_config>, ... ] sns_configs: [ - <sns_config>, ... ] telegram_configs: [ - <telegram_config>, ... ] victorops_configs: [ - <victorops_config>, ... ] webex_configs: [ - <webex_config>, ... ] webhook_configs: [ - <webhook_config>, ... ] wechat_configs: [ - <wechat_config>, ... ] ``` > 每个具体配置 查看 https://prometheus.io/docs/alerting/latest/configuration/#receiver 页面