labels: 定义告警的标签,可以用于对告警进行分类和过滤。上述中 team 在之后可以用于分组告警,指某类告警信息发送给指定的人
annotations: 定义告警的注释,可以用于提供额外的告警信息
description: 对告警的详细描述
summary: 对告警的简要概述
title: 告警的标题
runbook_url: 运行手册的URL
severity: 告警的严重性级别
status: 告警的状态
value: 触发告警的值
通过 Alertmanager 发送邮箱告警信息,可能并不准确,有问题可以评论中提,谢谢
这边就不描述安装过程了,以下例子与上述配置有关联请仔细查询
alertmanager.yml
global:# 全局配置resolve_timeout: 5m # 处理超时时间,默认为5minsmtp_from:'使用哪个邮箱进行发送'# 邮件发送地址smtp_smarthost:'smtp.qq.com:25'# 邮箱SMTP 服务地址smtp_auth_username:''# 邮件发送地址用户名smtp_auth_password:''# 邮件发送地址授权码smtp_require_tls:false# 用于指定是否需要在与 SMTP 服务器通信时使用 TLS 加密。如果将其设置为 true,则 Alertmanager 会在与 SMTP 服务器建立连接时强制使用 TLS 加密smtp_hello:'qq.com'route:# 设置报警的分发策略group_by:['alertname']group_wait: 20s # 最初即第一次等待多久时间发送一组警报的通知group_interval: 5m # 在发送新警报前的等待时间repeat_interval: 30m # 发送重复警报的周期 对于email配置中,此项不可以设置过低,否则将会由于邮件发送太多频繁,被smtp服务器拒绝receiver:'email'# 它定义了警报应该如何发送,包括用于发送警报的地址和协议(例如电子邮件、Slack、PagerDuty 等)receivers:# 配置告警消息接受者信息-name:'email'email_configs:-to:''# #邮件接收地址 send_resolved:trueinhibit_rules:-source_match:severity:'red'target_match_re:severity: ^(blue|yellow|orange)$
# Apply inhibition if the alertname and instance is the same.equal:['alertname','instance']-source_match:severity:'orange'target_match_re:severity: ^(blue|yellow)$
# Apply inhibition if the alertname and instance is the same.equal:['alertname','instance']-source_match:severity:'yellow'target_match_re:severity: ^(blue)$
# Apply inhibition if the alertname and instance is the same.equal:['alertname','instance']
global:# 全局配置resolve_timeout: 5m # 处理超时时间,默认为5minsmtp_from:''# 邮件发送地址smtp_smarthost:'smtp.qq.com:25'# 邮箱SMTP 服务地址smtp_auth_username:''# 邮件发送地址用户名smtp_auth_password:''# 邮件发送地址授权码smtp_require_tls:falsesmtp_hello:'qq.com'route:# 设置报警的分发策略group_by:['alertname']group_wait: 20s # 最初即第一次等待多久时间发送一组警报的通知group_interval: 5m # 在发送新警报前的等待时间repeat_interval: 30m # 发送重复警报的周期 对于email配置中,此项不可以设置过低,否则将会由于邮件发送太多频繁,被smtp服务器拒绝receiver:'email'routes:-receiver:'lingqi'match_re:team: lingqi
-receiver:'jvm'match_re:team: jvm
receivers:# 配置告警消息接受者信息-name:'email'email_configs:-to:''# #邮件接收地址1send_resolved:true-name:'lingqi'email_configs:-to:''# #邮件接收地址2send_resolved:true-name:'jvm'email_configs:-to:''# #邮件接收地址3send_resolved:trueinhibit_rules:-source_match:severity:'red'target_match_re:severity: ^(blue|yellow|orange)$
# Apply inhibition if the alertname and instance is the same.equal:['alertname','instance']-source_match:severity:'orange'target_match_re:severity: ^(blue|yellow)$
# Apply inhibition if the alertname and instance is the same.equal:['alertname','instance']-source_match:severity:'yellow'target_match_re:severity: ^(blue)$
# Apply inhibition if the alertname and instance is the same.equal:['alertname','instance']