config: global: resolve_timeout: 5m smtp_smarthost: 'smtp.qq.com:465' smtp_from: 'xx@qq.com' smtp_auth_username: 'xx@qq.com' smtp_auth_password: 'xreqcqffrxtnieff' smtp_hello: '163.com' smtp_require_tls: false route: group_by: ['job','severity'] group_wait: 30s group_interval: 1m repeat_interval: 1h receiver: default routes: - receiver: webhook match: alertname: TargetDown receivers: - name: default email_configs: - to: 'xx@pcidata.cn' send_resolved: true - name: webhook email_configs: - to: 'xx@pcidata.cn' send_resolved: true
注意這裏有個天大的坑!!!!!html
1.smtp.qq.com:465 ,端口使用465。其餘資料說用587端口也能夠。(若是是雲服務器,25端口一般是被服務商封閉的(fk...),全部也不能使用25端口)web
報錯信息:服務器
msg="Notify for alerts failed" num_alerts=1 err="*notify.loginAuth failed: 530 Must issue a STARTTLS command first."post
2.smtp_require_tls: false 必須加上,由於smtp_require_tls默認爲true。ui
3.須要先登陸QQ郵箱,開通smtp功能,並獲取受權碼。smtp_auth_password填寫的信息,就是受權碼,而非QQ郵箱的登陸密碼!(TM這個卡了我好幾天)spa
設置好以後就能夠愉快的發郵件啦。。。htm