Manage Learn to apply best practices and optimize your operations.

Auto checking the server for DECS activity

This is the code I put in the agent that checks the server tasks and checks whether the DECS activity is running and if not, sends an e-mail to the required people.

We have a very important application, containing customer complaint information, that uses DECS. If the DECS activity fails or is not running, then any complaints created will not get entered into our DB2, which is the storage facility for all complaints. Notes is only the front end, therefore we must ensure that the DECS activity controlling the connection between Notes and DB2 is always active. Unfortunately, our Notes administrator was unable to manually check the tasks running on the server every day. Now our Notes administrator is outsourced, so the priority of this task being checked has become even lower, unfortunately.

To ensure the checking of this DECS activity gets the priority it deserves, I created a scheduled agent that runs everyday to check the connection. If it is not running, it sends an e-mail to the required personnel so we can be more pro-active in responding to the failure.

Below is the code I put in the agent that checks the server tasks and whether or not the DECS activity is running, and then sends an e-mail to the required people.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim servername As String
Dim result As String
Dim MailDoc As NotesDocument
Dim richtextitem As NotesRichTextItem
Dim richstyle As NotesRichTextStyle

Set db = session.Currentdatabase
servername = db.Server
result = session.SendConsoleCommand
( servername, "Show Tasks" )
result = Strright( result, "DECS Server" )

If result = "" Then Goto sendemail

result = Ltrim( result )
result = Left$( result, 4 )

If Ucase( result ) = "IDLE" Then Goto sendemail

Exit Sub
Set MailDoc = New NotesDocument( db )
MailDoc.Form = "Memo" 
MailDoc.SendTo = "Agent Error Notifications"
Set richtextitem = 
New NotesRichTextItem( MailDoc, "Body" )
Set richStyle = session.CreateRichTextStyle

MailDoc.Subject = "DECS Activity not running"
Call richtextitem.AppendText( "Please note 
that there are no DECS Activities running on " & _
db.server )
Call richtextitem.AddNewline( 2 )
Call richtextitem.AppendText( "Please investigate
 this as the Customer Complaints Activity should
 be running at all times." )
Call maildoc.Send( False)

Do you have comments on this tip? Let us know.

This tip was submitted to the tip exchange by member Graham Frey. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Dig Deeper on Lotus Notes Domino Database Management

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials'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 ...