Created 01-25-2019 03:03 PM
I have requirement to modify the email subject from Ambari for certain alerts. For example, anything related to HDFS, I need to have "CRITICAL HDFS" in the subject line. I went through this link : https://community.hortonworks.com/questions/198815/ambari-email-alert-format.html
but it does not talk about customizing the subject for certain alerts.
Has anyone has this setup in your environment ?
Created 01-29-2019 03:11 AM
Hi @Kumar Veerappan,
I guess you are referring to this blog for Customizing the Ambari Alert : https://cwiki.apache.org/confluence/display/AMBARI/Customizing+the+Alert+Template
then you can change the alert to Your desired one with help of editing the <subject></subject> in alert-templates.xml : https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/alert-templates.xml#L21
Just for example, I have some changes on subject for my Business logic :
<subject> <![CDATA[ #set( $criticalServices = $summary.getServicesByAlertState("CRITICAL")) #if( $summary.getCriticalCount() ==0) There is no new critical Alert! #{else} We have $summary.getCriticalCount() Critical Alert(s).Alert Details : ,#foreach( $service in $criticalServices ) #foreach( $alert in $summary.getAlerts($service,"CRITICAL") ) Service Name : $alert.getServiceName(),Host Name : $alert.getHostName() #end #end #end ]]> </subject>
Which is doing nothing but Listing critical alert count in the Email subject.
See if you can Makeuse of some thing out of it.
Please give a Accept answer if it did.
Created 01-29-2019 03:11 AM
Hi @Kumar Veerappan,
I guess you are referring to this blog for Customizing the Ambari Alert : https://cwiki.apache.org/confluence/display/AMBARI/Customizing+the+Alert+Template
then you can change the alert to Your desired one with help of editing the <subject></subject> in alert-templates.xml : https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/resources/alert-templates.xml#L21
Just for example, I have some changes on subject for my Business logic :
<subject> <![CDATA[ #set( $criticalServices = $summary.getServicesByAlertState("CRITICAL")) #if( $summary.getCriticalCount() ==0) There is no new critical Alert! #{else} We have $summary.getCriticalCount() Critical Alert(s).Alert Details : ,#foreach( $service in $criticalServices ) #foreach( $alert in $summary.getAlerts($service,"CRITICAL") ) Service Name : $alert.getServiceName(),Host Name : $alert.getHostName() #end #end #end ]]> </subject>
Which is doing nothing but Listing critical alert count in the Email subject.
See if you can Makeuse of some thing out of it.
Please give a Accept answer if it did.