I have a pipeline that starts with an ad-hoc flow file processor as the starting processor. During cluster maintenance, the processors often go to a stopped state. Is there a way, I can get an alert with the note this processor is in a stopped state? Basically, the ask is to send alerts based on the state of the processor.
Thanks in advance.
Hi @ep_gunner ,
You can use the QueryNiFiReportingTask reporting task to report on the status of any processors, connections, process groups, etc. This reporting task allow you to use a SQL query NiFi status.
For example, if you're interested in any stopped processor, you can use the query:
select * from PROCESSOR_STATUS where runStatus = 'Stopped'
You could also filter that by processor name or id if you need to be more specific:
select * from PROCESSOR_STATUS where runStatus = 'Stopped' and <YOUR_FILTER> where YOUR_FILTER could be any of the below: id = '<YOUR_PROCESSOR_ID>' groupId = '<YOUR_PROCESSOR_GROUP_ID>' name = '<YOUR_PROCESSOR_NAME>' processorType = '<YOUR_PROCESSOR_TYPE>' or any combination of the above
The results of this reporting task can be forwarded to any available ReportSink in NiFi (Database, Kafka, Email, etc). You can also send the results to a NiFi Input Port using the SiteToSiteReportingRecordSink and them you can process those reports with NiFi itself and take any other action you want.
Thanks for the reply @araujo
I was trying this solution out. The Nifi instance (1.16) I am using doesn't have QueryNifiReportingTask in the reporting task section, so I assume I have to build the nar first & then use it? Is that understanding correct?
You can download the NAR from here: https://repo1.maven.org/maven2/org/apache/nifi/nifi-sql-reporting-nar/1.16.0/
Make sure you get the one that matches your NiFi version.
If you do not mind, you can add MonitorActivity processor to the output end of the processor. This would generate two flow files(inactivity & activity restored) whenever your processor is down. In addition, connect the output end of MonitorActivity processor to PutEmail processor to configure an email Alert that would notify you when the processor is down & when activity has been restored.
I hope this helps.