In one of our larger applications, there are a number of critical scheduled agents that update data in the application from a back-end relational database. If the connection is lost, or the Lotus Notes database is down, the agents don't run to completion. Agent logs report all activity, but you have to open the logs to check for problems.
Recently the data server failed for an extended period and the logs weren't checked. This led to no updates for 48 hours, until the users noticed and reported the problem to our help desk.
It wasn't a problem to fix the connection and get everything running. But the situation prompted me to write some basic code to e-mail me if the Notes/Domino agents I was most interested in had not run for more than 12 hours.
Monitoring scheduled agents by e-mail involves a procedure that you insert at the end of each agent you want to monitor. This updates a keyword document in the application. You then add another scheduled agent, which runs every 12 hours/every day ,and checks when the agents last ran. If the agents haven't run, then an e-mail is sent to the administrator advising them to check the application and activity logs to see what is going on.
I have included the code for the subroutine which used the existing application keyword form, and a simple agent to check that at least one of the agents have run in the last 12 hours.
MEMBER FEEDBACK TO THIS TIP
If the agent is in the database, what would monitor whether this agent is running or not? I "tweaked" it a little to remove the keywords, run against all enabled scheduled agents, and e-mail a list of the agents that were not running. Now I can use the same agent in my databases. Here is my new code:
Pat C.
******************************************
It's an interesting idea to have an agent check if they are enabled or have been turned off using agent properties, which might occur if the application design was updated fr
To continue reading for free, register below or login
To read more you must become a member of SearchDomino.com
');
// -->

om a template with agents turned off. However, it doesn't solve the problem that I designed the process for, because it won't tell you when an agent failed to run to completion because of a run-time processing error. This is why the code that updated the keyword is being placed in the very last lines of the script.
Andrew Broxholme, tip author
******************************************
Just a thought about this tip: What if there is a problem running scheduled agents on the server? It could be a problem on the server, changes in access rights for the agent signer, or any number of things. If the agent doesn't run then there is no mail.
Erik R.
******************************************
It could be a problem where agents are not running at all, but system administrators should detect this. This process is designed to monitor a single application, which has core processes that need to run to maintain the application's integrity. If you need to monitor an entire server, you could have servers monitor one another.
Andrew Broxholme, tip author
******************************************
We have designed a fairly extensive system of error reporting that is fed by all Lotus Notes Domino agents -- whether they are scheduled or triggered. The agents create a custom "log" document and start with a "failed" state. If they run successfully, they change the status to "Success," and the Lotus Notes document gets deleted. But if there is any error with the execution (system error, data error, rights problem, etc.), then it is reported on this log document, along with detailed information (error #, line #, user, server stats, etc.). This method has worked quite well.
Nadeem M.
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip library by member Andrew Broxholme. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.