Check if an agent is currently running

Show ‘n tell thursday logo - new style - icon

I needed a way to see if an agent is running. To my knowledge, there’s no such thing possible with “normal” Notes-programming (is there such thing is normal programming in Notes?).

Collegue Jo Van Eynde (all credits go to him) came with the idea of sending a console command and capturing the output the console returns. Brilliant!

If the agent manager isn’t doing anything, it’s just idle, otherwise it returns something like Running agent ‘x’. Once you know that, it gets really simple.

Here’s the code:

Sub Click(Source As Button) Dim ConsoleReturn As String Dim StringToFind As String Dim AgentName As String Dim session As New NotesSession 'Specify the server to check ConsoleReturn = session.SendConsoleCommand("<Servername>","sh ta") 'Specify the agent to check AgentName="<AgentToCheck>" StringToFind="Running agent '"+AgentName+"'" Dim array1(0) As String Dim array2(0) As String Dim array3(0) As String Dim ret As Variant array1(0) =ConsoleReturn array2(0) = StringToFind array3(0) = "" ret = Replace(array1, array2, array3) If ret(0)<>consoleReturn Then Msgbox |Agent "|+agentName+|" RUNS!|,64,"Check Agent" Else Msgbox |Agent "|+agentName+|" DOESN'T run!|,64,"Check Agent" End If End Sub

The only thing I don’t check in my code, is the database name, so you if your agents have the same name across different databases, it might be another agent in another database that is running (instead of the one you wanted to check).


  1. Just to be clear… Jo’s solution is completely awesome. :-)

  2. Please be gentle with this simple Domino Admin, but is the agent signed by server or by someone that is permitted to run console commands?

  3. @Nathan: I didn’t know about the codelock. I didn’t read your article in-depth, thanks pointing to an alternative!
    @Gregg: the person who runs the script should have permission to run console commands (if not, he would get an “You’re not authorized to look at me” prompt.


Submit a Comment

Your email address will not be published. Required fields are marked *

− 1 = 1

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>