Community Articles

Find and share helpful community-sourced technical articles.
avatar

Introduction

When the NiFi bootstrap starts or stops NiFi, or detects that it has died unexpectedly, it is able to notify configured recipients. Currently, the only mechanism supplied is to send an e-mail notification.

Prerequisite

1) Assuming you already have HDF-2.x Installed, Ambari and NiFi is up and running. If not, I would recommend "Ease of Deployment" section of this article to install it [You can also follow this article for Automated installation of HDF cluster or refer hortonworks.com for detailed steps]

Configuring NiFi property files in Ambari

1) To setup email notifications we have to update only two configurations file bootstrap.conf and bootstrap-notification-services.xml

2) We have to update appropriate properties in Ambari to configure it, first we have to edit Template for bootstrap.conf to update below properties. Uncomment below lines in the properties file:

nifi.start.notification.services=email-notification 
nifi.stop.notification.services=email-notification
nifi.dead.notification.services=email-notification

11931-bootstrapconf.jpg

3) Edit Template for bootstrap-notification-services.xml and make sure your SMTP settings are updated, and are uncommented. Sample configuration is given below:

<service> 
<id>email-notification</id> 
<class>org.apache.nifi.bootstrap.notification.email.EmailNotificationService</class> 
<property name="SMTP Hostname">west.xxxx.server.net</property> 
<property name="SMTP Port">587</property> 
<property name="SMTP Username">jgeorge@hortonworks.com</property> 
<property name="SMTP Password">Th1sisn0tmypassw0rd</property>   
<property name="SMTP TLS">true</property> 
<property name="From">jgeorge@hortonworks</property> 
<property name="To">jgeorge@hortonworks.com</property> 
</service>

11932-bootstrap-notification-services.jpg

4) Save the Config changes in Ambari after uncommenting the, <service> property, confirm when asked and restart service.

Testing NiFi Notification Services

1) Once restarted, you will see both stopped and started alerts in your inbox with details.

Stopped Email Alert:

11933-email-alert-stop.jpg

Started Email Alert:

11934-email-alert-start.jpg

2) Try out stopping and killing NiFi process [make sure you don’t kill bootstrap process which monitors NiFi which in turn restarts NiFi process.]

Died Email Alert:

11935-email-alert-died.jpg

References

NiFi notification_services

Thanks,

Jobin George

bootstrapconf.jpg
3,541 Views
Comments
avatar
Explorer

Hey Jobin,

After configuring all the setting for Bootstrap notifier I'm not receiving any emails or I'm not receiving any errors. I'm not sure if I'm missing anything. I have checked all the files again, everything looks good but not getting any output. I'm using outlook email address.

Thank you

avatar
Rising Star

I too faced the same issue of not receiving emails,although configuration was set as mentioned in the above article,then i added this property in botstrap-notification.xml and it worked for me. since my smtp didnt require any username and password authentication, i deleted those properties and added this one,

<property name="SMTP Auth">false</property>

(note this needs to be added additionally its not already there in default xml, need to false it as its default value is true (reference:https://github.com/apache/nifi/blob/master/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/notification/email/EmailNotificationService.java)

please vote up if my answer helped.