LScript to Check for Domino Server "Slow" Downs

Friday 1st February, 2008
Have you ever had end users report the Domino Server is responding slow but by the time they call you the Server is no longer slow?  

I recently encountered this issue with a customer and wrote the following LotusScript to try and prove when a server is responding slow.  The LotusScript will go into a Loop trying to open a database on the server, report the time duration to open in seconds and then sleep for so many seconds.  The idea is every 5 seconds you try to open the names.nsf, record how long it takes and do this 120 times.  So for a 10 minute window you now have the time it took to open a database every 5 seconds.  If you set the database to run for a longer period of time, say 1 hour, you could possible identify server slow downs.

Sub Initialize
        Dim session As New NotesSession
        Dim db As NotesDatabase
        Dim doc As NotesDocument
        Dim db2 As NotesDatabase
        Dim ws As New NotesUIWorkspace
        Dim mystart As Long
        Dim myend As Long
        Dim mytime As String
        Dim mybatchtime As String
        Dim myserver As String        
        Dim stopthis As Integer
        Dim counter As Integer
        Dim sleeptime As Integer
        Dim overduration As Integer
       
        Set db = session.CurrentDatabase
        counter = 0
        stopthis = 1
        mybatchtime = Now
       
'Define All Variables Here if Hardcoded
'        myserver = "BROWNSERV1/HOME"        'Server Name to poll
'        mydbtoget = "names.nsf"                'Database to Open
'        counter2 = 5                                'Number of Iterations to run
'        sleeptime = 2                                'Time to sleep between each iteration
'        overduration = 5                                'Time to flag as taking to long to open        
       
'Define All Variables Here if Dynamic
        myserver = Inputbox("Enter Canonical Server Name to poll")
        mydbtoget = Inputbox("Enter database to open on server - suggest names.nsf")
        counter2 = Inputbox("Enter number of iterations to run through")
        sleeptime = Inputbox("Enter how many seconds to pause between iterations")
        overduration = Inputbox("Enter the amount of time in seconds that is to long when opening the database to set an additional flag")
       
PICKUPHERE:
       
        Do Until stopthis = 0
                'If you answer Yes to the Prompt in the IF statement below, it returns 1 and loops, if you answer No it returns 0 and stops
                mytime = Now
                mystart = Timer        
                Set db2 = session.GetDatabase(myserver,mydbtoget)
               
                If db2.IsOpen = "False" Then
                        Set doc = db.CreateDocument
                        doc.myserver = "FAILED"
                        doc.mybatchtime = "FAILED"
                        doc.mytime = "FAILED"
                        doc.mystart = "FAILED"
                        doc.myend = "FAILED"
                        doc.myduration = "FAILED"                        
                        doc.Form = "TrackResponse"
                        Call doc.Save( True, True )
                        End
                End If
                myend = Timer
                Call db2.Close
                myduration = myend - mystart
                'Move the "If myduration > overduration Then" 8 lines down to here if you want to only create a document when you exceed the time
                Set doc = db.CreateDocument
                doc.myserver = myserver
                doc.mybatchtime = mybatchtime
                doc.mytime = mytime
                doc.mystart = mystart
                doc.myend = myend
                doc.myduration = myduration
                If myduration >= overduration Then
                        doc.durationflag = "1"
                End If
                doc.Form = "TrackResponse"
                Call doc.Save( True, True )
               
                counter = 1 + counter
                If counter = counter2 Then
                        Print "Agent is sleeping for " & sleeptime & " seconds - finished iteration " & counter
                        stopthis = ws.Prompt(PROMPT_YESNO,"Continue?", "Do you wish to continue for another " & counter2 & " interations?")
                        counter = 0
                        Goto PICKUPHERE
                End If
               
                Print "Agent is sleeping for " & sleeptime & " seconds - finished iteration " & counter
                Sleep sleeptime
        Loop
       
End Sub

[0]