1、登录ambari管理页面,找到Manage Notifications选项
2、创建告警
3、配置告警
4、163邮箱授权码设置
5、修改邮件标题
(若没特殊需求,可忽略)
- 下载 alert-templates.xml
https://raw.githubusercontent.com/apache/ambari/branch-2.5/ambari-server/src/main/resources/alert-templates.xml
注意:下面这些操作都是在ambari安装节点上进行的
- 编辑alert-templates.xml
找到<alert-template type="EMAIL">标签,修改里面内容
原内容:
<![CDATA[Alert Summary: OK[$summary.getOkCount()], Warning[$summary.getWarningCount()], Critical[$summary.getCriticalCount()], Unknown[$summary.getUnknownCount()]]]>
修改为:
<![CDATA[xx数据--数据中心--Ambari监控报告:OK[$summary.getOkCount()], Warning[$summary.getWarningCount()], Critical[$summary.getCriticalCount()], Unknown[$summary.getUnknownCount()]]]>
- 将alert-templates.xml移动到 /var/lib/ambari-server/resources/
- 编辑/etc/ambari-server/conf/ambari.properties 文件
在文件最后一行增加 alerts.template.file=/var/lib/ambari-server/resources/alert-templates.xml
- 重启ambari server
ambari-server restart
- 查看ambari server日志
tail -f /var/log/ambari-server/ambari-server.log