Manage Learn to apply best practices and optimize your operations.

Get Notified If Your Agent Keels Over

Some time ago (under Notes 4.5x) I had problems with an agent aborting without
any visible cause. I tried log entries and e-mail notification in the script,
but it didn't work, since the agent just quit at a certain point (i.e., script
never entered into error handling routine). I found that by creating an e-mail
log I could get notification of a failure, even if the agent didn't finish. The
log apparently gets created under the server itself and stays open until either
the agent goes away or code in the agent closes it. After some back and forth I
found that the agent was eating up all available AMGR memory (I used the
embedded Lsi_info calls to gauge available memory) . I ended up having to split
the work, restarting the agent on an hourly basis and picking up a chunk during
every run.
The log method could also be used writing into a file on the server. I just
found it more useful being beeped, since the agent ran over a weekend. If you
keep the subject short enough and don't write anything other than errors into
this log, you'll be able to tell on an alphanumeric beeper if the agent
completed successfully or not, since success means you'll only get the subject
in the beep.
Caveats:
* The log will get closed and e-mail will be sent, regardless of positive or
negative outcome. I haven't found a way to abort sending of a log message.
* Sending to a beeper will only work if you have a pager gateway that accepts
mail
* A log that gets too long won't display properly in the mail form. I've had to
resort to getting the body field properties to get the full text.
On Error Goto ErrHdlr

Dim session As New NotesSession
Dim db As NotesDatabase
Dim agentServer As String
Dim errorLog As NotesLog
Dim errorAds() as String

'find out which server this agent runs on
Set db = session.CurrentDatabase
If ( db.Server <> "" ) Then 'get the name of the server on which this agent
runs
agentServer = Mid$(db.Server,4,Instr(db.Server,"/")-4)
Else
agentServer = "Local"
End If

'set e-mail and beeper recipients for the log
errorAds(0) = "Jane Smith" 'set mail recipient
errorAds(1) = "(123)555-1212@Metrocal" 'set beeper number

'start the log
Set errorLog = New NotesLog("ErrorLog") 'new log for errors encountered
Call errorLog.OpenMailLog(errorAds(),"Log for xAgent Errors on " +
agentServer) 'address to recipients with short subject for beeper

'some debugging tools - repeat this every so often to see how much memory is
used/left
Print("Mail Janitor Start Pool: " + Lsi_info(51)) 'printing starting mem
config into server log
Print("Mail Janitor Start Alloc: " + Lsi_info(50)) 'printing starting mem
config into server log
Print("Mail Janitor Start Blocks: " + Lsi_info(52)) 'printing starting mem
config into server log

'any old entry in the log
Call errorLog.LogAction("Starting xAgent agent.")

ErrHdlr:
'an error entry in the log
Call errorLog.LogAction("Error " + Str(Err) + " (" + Error$ + ") on " + dbTitle
+ " (" + path + ")")
Resume Next

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close