Detecting an agent time-out vs server crash

Hi all,This is the case:

I’ve written an application which collects a lot of information from all mailfiles in the company. One agent runs on each server in the weekend and creates an overview of the buildup of a mailfile in time. As there are quite many huge mailfiles on the server this agent won’t complete within its time limit (error: Agent did not complete within the time limit). This is not a problem as the next time the agent runs (it runs every hour in the weekend) it will pickup where it left and continue.

We have one server where this agent crashes the server. This is probably caused by multiple corrupt mailfiles. However, I therefore need a mechanism to detect whether the agent timed out or whether agent stopped running because of a server crash, so in the latter case I can send a warning mail to an application manager and not continue.

I can’t access the agent log through LotusScript to look for the magic “did not complete” error message, which was my first guess. Second I hoped to be able to write some code in the Terminate sub as this sub is supposed to be executed even if the agent times out. However, this seems to be rather arbitrary. Sometimes it executes the code in the terminate sub right. Sometimes it creates a new logdoc (I let it write to a document in the same database which contains run info for the agent), sometimes it doesn’t execute at all (in which case usually also the “did not complete” message is not to be found in the agent log.

Does anyone know of a robust method to identify whether an agent run was cancelled due to a timeout or due to a server crash?

Subject: detecting an agent time-out vs server crash

Martijn,

My instinct is to suggest that you have a check in your agent so that as you approach the dreaded timeout you gracefully stop. Otherwise, since you’re dealing with two different non-graceful stops to your agent execution, I think it’d be a pain to ferret out that info.

I know you can have an agent parse the log.nsf but that’s probably a bigger hassle than anything else you’d come up with.

good luck,

raphael

Subject: RE: detecting an agent time-out vs server crash

Thanks both for your suggestions. I have to withdraw my statement that the terminate sub is not a reliable method. I was testing it from the console running my infinite loop agent with "tell amgr run “database” ‘agentname’, but found that agents started that way don’t always get stopped by the time-out limit. Since I’ve run this agent as a scheduled agent it turned in reliable results.

I agree that a check to prevent the time-out would be the more graceful approach. However, I would have to either check between each document, which would cost me some hard needed performance, or check after each database. As the processing of a database could take up to 6 minutes of the 15 mins timeframe I have, that wouldn’t work either in this case.

Subject: detecting an agent time-out vs server crash

You could scan the log.nsf db of that server for specific words since your last run.

For server crashs, you can send the NSD file to a mail-on db and then scan this db with your super agent to see if you have any crashes since your last run.

JYR