Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NIFI - Create alerts

avatar
Explorer

Hello, I need create warnings and alerts. I will recive "a.txt" and "b.txt" files in a input folder, it's possible create a warning if the files are not received before 10 o'clock and create a alert if are not received before 12 o'clock?

thanks!!

1 ACCEPTED SOLUTION

avatar
Master Guru
@Pepelu Rico

Use MonitorActivity processor for this case and Configure the processor as Cron Driven to run at 10:00AM,10:01AM

Processor configs:

CronDriven

* 0,1 10 1/1 * ? *

91589-monitor.png

Threshold Duration

1 min //consider how much time elapse before considering the flow is inactive

Continually Send Messages

false

Inactivity Message

Lacking activity as of time: ${now():format('yyyy/MM/dd HH:mm:ss')}; flow has been inactive for ${inactivityDurationMillis:toNumber():divide(60000)} minutes //change this message as per your requirements

Activity Restored Message

Activity restored at time: ${now():format('yyyy/MM/dd HH:mm:ss')} after being inactive for ${inactivityDurationMillis:toNumber():divide(60000)} minutes

Copy Attributes

false //include all the flowfile attributes in the content of flowfile

Monitoring Scope

cluster //determine activeness of flow

Reporting Node

primary //specify which node to send mail

in this way we are running Monitor Activity processor at 10:00AM,10:01AM,

at 10:00AM processor runs every second and check is there any flowfile.

at 10:01AM is to sent out mail for inactivity.

In the same way use another monitorActivity processor to run at 12 to send alert mail.

Flow:

91590-flow.png

Use inactivity relationship to send out the alert email and Configure PutEmail processor.

-

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

View solution in original post

3 REPLIES 3

avatar
Master Guru
@Pepelu Rico

Use MonitorActivity processor for this case and Configure the processor as Cron Driven to run at 10:00AM,10:01AM

Processor configs:

CronDriven

* 0,1 10 1/1 * ? *

91589-monitor.png

Threshold Duration

1 min //consider how much time elapse before considering the flow is inactive

Continually Send Messages

false

Inactivity Message

Lacking activity as of time: ${now():format('yyyy/MM/dd HH:mm:ss')}; flow has been inactive for ${inactivityDurationMillis:toNumber():divide(60000)} minutes //change this message as per your requirements

Activity Restored Message

Activity restored at time: ${now():format('yyyy/MM/dd HH:mm:ss')} after being inactive for ${inactivityDurationMillis:toNumber():divide(60000)} minutes

Copy Attributes

false //include all the flowfile attributes in the content of flowfile

Monitoring Scope

cluster //determine activeness of flow

Reporting Node

primary //specify which node to send mail

in this way we are running Monitor Activity processor at 10:00AM,10:01AM,

at 10:00AM processor runs every second and check is there any flowfile.

at 10:01AM is to sent out mail for inactivity.

In the same way use another monitorActivity processor to run at 12 to send alert mail.

Flow:

91590-flow.png

Use inactivity relationship to send out the alert email and Configure PutEmail processor.

-

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of issues.

avatar
Master Guru
@Pepelu Rico

Use MergeContent and RouteOnAttribute processors before MonitorActivity Processor.

Configure MergeContent processor

Minimum Number of Entries

5

So now processor will wait for 5 flowfiles and only if there are 5 flowfiles then processor merges all the flowfiles into 1 and transfer the flowfile to merged relationship.

Use Max Bin Age property as a wildcard to force the bin to be merged, if we won't configure this property then processor will wait infinite time until it reaches 5 flowfiles.

Then use the Merged Relationship from MergeContent processor to RouteOnAttribute processor

RouteOnAttribute Configurations:

MergeContent processor adds merge.count attribute to the flowfile so use that attribute to check if the value is 5 then give this relationship to MonitorActivity(run this processor at 12:00) processor.

Add new property in RouteOnAttribute processor

${merge.count:equals(5)}

Flow:

1.other processors
2.MergeContent -->use merged relation
3.RouteOnAttribute -->use new property relation
4.MonitorActivity 5.PutEmail

in case if you want sequential merging then refer to this link for flow and configurations.

avatar
Explorer

@Shu

I would need to look in an HDFS folder and check that before 10 a.m. there are 5 files, if there are not 5 files I should run PutSNS processor.
If there are 0 files, How can I check that? because in this case no fileflow would be sent
Thanks!