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