WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Alert when no files arrive
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1264068373

Message started by shepy on Jan 21st, 2010 at 11:06am

Title: Alert when no files arrive
Post by shepy on Jan 21st, 2010 at 11:06am
Hello,

Is there a way that you can monitor a folder (incl sub folders) and if nothing arrives on any given day a notification can be sent out by email.

I realise that this probably goes against the concept of what WatchDir is all about but we have customers who send us files daily and if for some reason WatchDIr or our process does not pick up the file and load it into the database then we miss the event.

Many Thanks in advance

Title: Re: Alert when no files arrive
Post by Gert on Jan 21st, 2010 at 12:30pm
Hi,

You are right, this isn't something WD is designed to do. However, here is an idea.

Setup a new task using the email plugin. This task will send you an email when there have been no files for X seconds (3600 for 1 hour).
Make sure the message-body contains something like


Code (]MESSAGE REASON: %WD_REASON%[/code):
probably near the bottom of the message.

The %WD_REASON% will be replaced by WD by the reason of the message (FILENEW for a new file, QUIET when nothing has happened).
Setup the Events window ( http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage4.html ) so it fires for FILENEW and QUIET (you really need both). Set the proper QUIET interval.

When configured like this, you will receive an email for new files and when "nothing happened" during the quiet interval.
If you don't want to have the emails for new files you still MUST enable the FILENEW option. This is because QUIET needs some other event to "compare against".

Now the reason for the
[code]MESSAGE REASON: %WD_REASON%

line at the bottom of the message. If you do not want to receive those messages for new files, you can tell the System.Mail process (wdPostman) to ignore them.
Open the menu "View -> Email -> Email Settings" and press the "Filter Email" button.
Add
MESSAGE REASON: FILENEW
as a "message body filter".

From now on, the System.Mail process will silently ignore emails with that text inside the message body.

Gert

Title: Re: Alert when no files arrive
Post by Gert on Jan 21st, 2010 at 12:45pm
One more thought....

If you (ever) want to do something like this for multiple tasks, the "MESSAGE REASON" setting is global, for ALL tasks.

Perhaps it is better to change it to
[code]MESSAGE REASON: %WD_CONFIG%:%WD_REASON%[/code]
%WD_CONFIG% is replaced by the name of your task, see http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html

That way, this "filter" only has effect on this task.

Title: Re: Alert when no files arrive
Post by shepy on Feb 3rd, 2010 at 2:22pm
Hello Gert,

Apologies, not got back to you sooner everything works fine.

Thanks for your assistance as always first class

Regards
Paul

Title: Re: Alert when no files arrive
Post by Gert on Feb 5th, 2010 at 9:11am
I just wrote a HOWTO blogpost about this:
http://watchdirftp.blogspot.com/2010/02/receive-email-when-no-files-are-created.html

Title: Re: Alert when no files arrive
Post by montgomery_oh on Aug 28th, 2012 at 5:47pm
I followed your instructions on the blog post and it works great when you always receive a file every XXX of seconds.  

Now, I would like to create similar alerts allowing for exceptions around certain days or times:

Example 1: I receive a file every 24 hours (+/- few minutes depending on ftp/size/etc) on Monday-Friday only.  Can the "Scheduler" in (Pro) be configured to only monitor/alert on M-F if I don't receive a file?  I have setup "Events" with "FileNew" and "Quiet" (90000) and Scheduler set to "Start task immediately" which alerts me on Sat & Sun.  I have tried different combinations of "Only run tasks on these days" and "Events outside these periods are ignored" but I can't seem to get the right combination.  

Example 2: I receive a file every 30 minutes (+/- few minutes depending on ftp/size/etc) every day.  However, I don't receive files while they perform backups (2am, 2:30am, 3am, 3:30am) and don't want to alert during that time frame.  I setup the alert to notify if I don't receive a file within an hour (3600 secs).  I set Scheduler to run between 00:00 - 01:45 and 03:45 - 23:59 with "Events outside these periods are ignored" checked.  I receive an alert at 2:18am & 4:45am even though I received files at 1:33am and 4:03am).

Can you provide some additional instruction for these scenarios above?

Also, does "Merge tasks" or "When Merging" apply when the Events "FileNew" & "Quiet" options are the only ones checked?

Title: Re: Alert when no files arrive
Post by Gert on Aug 29th, 2012 at 6:52am
Are you running the latest (4.6.7) version - free upgrade? It was released earlier this month and has a bugfix that is related:
http://www.watchdirectory.net/wdhelp/help/wdcc_version_history.html

Improved: When using the Scheduler, QUIET events were not handled properly.


About your settings for this task, see the attached picture.
Assuming you expect the file to arrive a bit after 6am every day, make the scheduled period long enough for the file to be detected AND the QUIET event to fire: do not set it to 90000 (25 hrs) but to just under 1 hour (3550 seconds). Make sure "events outside these periods are ignored" is selected.


29-8-2012_6-45-15.png (30 KB | )

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.