Tuesday, August 08, 2006

Tell me when my scheduled jobs fail please

Just recently I discovered a problem with an EPiServer scheduled job that I built for a client that kicks off a search engine re-index on a nightly basis. What I didn't realise was that the way in which I was starting the re-index was completly stuffed and the as a result the job had been failing for about a month.

This got me thinking about ways to notify someone when a scheduled job fails. Now I'm not just thinking about notifing for my custom created jobs as that would be easy, instead what I thought would be good is a process that notifies me about all the EPiServer job failures (standard and custom ones).

I can think of two ways to get this information, one is directly from the EPiServer database tables where it stores the history of the scheduled jobs, the other is to use the EPiServer API to get the status of scheduled jobs and their history. Now I always prefer to use the API as much as possible when doing product development so I'm going discount the direct database access for now ;)

Some other things I want is to be able to schedule when I got notifications about failed jobs and have the notifications summarised in a single email.

So as a result I have started creating another EPiServer scheduled job that notifies me about scheduled job failures. The idea is that when it runs it will trawl through all the other scheduled job status' and history, pick out any failures and email them to me.

I'll update this when I have something working but if you have any other ideas please add a comment below.

2 comments:

Anonymous said...

So what happens if your scheduled task watcher, running as a scheduled task (!) fails? :-)

Anyway, this is a very good idea! I'd love to see it on EPiCode ;-)

Jeremy said...

Yeah this is something I had thought of to. And I would hope that if this happens it would be a temporary or unique scenario, which I would then be notified about when it runs the next time. Something to think about though.