Hi,
Really appreciate the work put into DbAlert, but I wanted to contribute a change that helped us: flagging disabled agents in the "Agent Out Of Schedule" functionality:
In the "Alert" script library, change the RunAgentOutOfSchedule sub to the below.
Best wishes,
Richard
Sub RunAgentOutOfSchedule
' If agent do not run for x secs
On Error Goto e
If debug Then Print Cstr(Getthreadinfo(1))
Dim xagent As notesagent,agentDT As NotesDatetime
Dim dtnow As notesdatetime,diff As Long,session As New notessession
If doc.AgentName(0) <> "" And Cstr(doc.AgentMins(0)) <> "" Then
Set xagent = xdb.GetAgent(doc.AgentName(0))
If xagent Is Nothing Then
Call rt.AppendText("Agent " + doc.AgentName(0) + " was not found in database")
mail = True
Else
If xagent.IsEnabled = False Then
Call rt.AddNewline(1)
Call rt.AppendText(|Agent: "| + doc.AgentName(0) + |" is disabled!|)
mail = True
Else
Set agentDT = session.CreateDateTime(xagent.lastrun)
Set dtnow = session.createdatetime(Now)
diff = dtnow.TimeDifference(agentDT)
If diff > doc.AgentMins(0) * 60 Then
Call rt.AddNewline(1)
Call rt.AppendText(|Agent: "| + doc.AgentName(0) + |" has not run for | + Cstr(Round(diff/ 60,0)) + | minutes - Last run time was | + Cstr(xagent.LastRun))
mail = True
Else
End If
End If
End If
End If
Exit Sub
e:
Call LogError
'Print Cstr(Getthreadinfo(1)) + " Msg: " + Error & " Line: " + Cstr(Erl)
'Call SaveError(Cstr(Getthreadinfo(1)) + " Msg: " + Error & " Line: " + Cstr(Erl))
End Sub