views:

35

answers:

2

I have a C# console application that fetches data from more than 100 servers using SNMP and then writes the same in DB. I have scheduled the same in Windows 2008 R2 server's Task Scheduler and is suppose to run after every 15 min. But the strange part is sometimes it runs and sometimes it don't. If I run it manually then it runs every time. Proper Try Catch is there in the code and mails will be triggered is exception happens, but nothing of that sort is happening. The task process gets created and action completed is happening simultaneously.

I am confused, please suggest what to do!

A: 

Does it run for longer then 15 minutes? (So could you be ending up with more than one running, and interfering with each other?)

Look in the Event Log's Application Events to see if any crashes of your program are recorded.

It sounds like the email notifications may not be working on your server, so I'd add some trace into it: Write to a log file the DateTime.Now every time it starts, and perhaps the name of each server as it is processed, and then then exit time. And of course, log the details of any exceptions you want to know about (ideally, add an unhandled exception handler so you can log all exceptions). Then you'll be able to see exactly when it is executing and that it is processing everything properly. This will help diagnose if it is not being run, if it is being run but is failing immediately, or if it is doing a partial run and failing after processing a few servers. Then you can focus in on the point of failure.

Jason Williams
Ok I will do that, and let me check whether mail is working properly or not.
Arup Chaudhury
Thanks Jason! Your answer directed me to the right way to solve my problem. First of all email was not working, which I rectified. And secondly I have scheduled the same after every 10 min with 9 min of max run time and it will retry to start the task after every 1 min for 3 times if the startup fails.
Arup Chaudhury
A: 

Very quick counter question: does fetching of this data from 100 server (always) complete within 15 minutes?

peSHIr
Yes, it hardly takes 3 to 4 min.
Arup Chaudhury