Manage Learn to apply best practices and optimize your operations.

Agent run info on the Web

See the state of agents by a browser. Do your scheduled agents run as they should? No need for designer client.

See the state of agents by a browser. Do your scheduled agents run as they should? No need for designer client.

Simply put this code in a 'hidden' java agent in each database and call it by browser: Output is nicely displayed in html.
This agent shows when agent have been running

import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
	Session session = getSession();
	AgentContext agentContext = 
      // (Your code goes here) 
	PrintWriter pw = getAgentOutput();
     Database db = agentContext.getCurrentDatabase();
     Vector agents = db.getAgents();
     pw.println("<STYLE>BODY TD {font-family:arial; font-size:11} 
</STYLE><H1>AGENT INFO: " + db.getTitle() + " (" + db.getFilePath()
+ ")</H1>"); for (int i=0; i<agents.size(); i++) { Agent agent = (Agent)agents.elementAt(i); // target=""; // trigger=""; String target="", trigger=""; switch (agent.getTarget()) { case Agent.TARGET_ALL_DOCS: if (target=="") target = "all documents"; case Agent.TARGET_ALL_DOCS_IN_VIEW: if (target=="") target = "all documents in view"; case Agent.TARGET_NEW_DOCS: if (target=="") target = "all new documents"; case Agent.TARGET_NEW_OR_MODIFIED_DOCS: if (target=="") target = "all new or modified documents"; case Agent.TARGET_NONE: if (target=="") target = "none"; case Agent.TARGET_SELECTED_DOCS: if (target=="") target = "selected documents"; case Agent.TARGET_UNREAD_DOCS_IN_VIEW: if (target=="") target = "unread documents in view"; case Agent.TARGET_RUN_ONCE: if (target=="") target = "run once";} switch (agent.getTrigger()) { case Agent.TRIGGER_AFTER_MAIL_DELIVERY: if (trigger=="") trigger = "after mail delivery"; case Agent.TRIGGER_BEFORE_MAIL_DELIVERY: if (trigger=="") trigger = "before new mail"; case Agent.TRIGGER_DOC_PASTED: if (trigger=="") trigger = "document pasted"; case Agent.TRIGGER_DOC_UPDATE: if (trigger=="") trigger = "document updated"; case Agent.TRIGGER_NONE: if (trigger=="") trigger = "none"; case Agent.TRIGGER_SCHEDULED: if (trigger=="") trigger = "scheduled"; case Agent.TRIGGER_MANUAL: if (trigger=="") trigger = "manual"; } DateTime date = agent.getLastRun(); pw.println("<TABLE CELLSPACING=1 CELLPADDING=2
WIDTH=100% ><TR BGCOLOR=#CCCCCC><TD WIDTH=100><B>Agent</B></TD><TD>"+agent.getName()
+"</TD></TR>"); if (agent.getLastRun() != null) { pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>last ran on</TD><TD>" ); pw.println(date.getDateOnly()+" at " + date.getTimeOnly()+"<BR>" ); } else { pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>hasn't run yet</TD><TD>" ); pw.println("<BR>" ); } pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>Signer</TD><TD>" ); pw.println(agent.getOwner() +"<BR>" ); pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>Enabled</TD><TD>" ); pw.println(agent.isEnabled() +"<BR>" ); pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>Webagent</TD><TD>" ); pw.println(agent.isWebAgent() +"<BR>" ); pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>Servername</TD><TD>" ); pw.println(agent.getServerName() +"<BR>" ); pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>Target</TD><TD>" ); pw.println(target +"<BR>" ); pw.println( "<TR VALIGN=TOP BGCOLOR=#EEEEEE><TD>Trigger</TD><TD>" ); pw.println(trigger +"<BR>" ); pw.println("</TD></TR>"); } pw.println("</TABLE><BR>"); } catch(Exception e) { e.printStackTrace(); } } }

Dig Deeper on Lotus Notes Domino Administration Tools

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 ...