Home > Lotus Notes Management, Lotus Notes Tutorial, LotusScript, Notes Designer > Check Lotus Notes Domino status by IsServerUp Function

Check Lotus Notes Domino status by IsServerUp Function

Basically, the code connects to the remote server and checks to see if the template log.ntf can be found and it has a valid replica ID. If the template can be found and has a valid replica ID, then the server is up. Otherwise, assume the server is down. Our testing of this function amounted to running it as a scheduled agent with the remote server up and after we shut the remote server down.

It successfully returned TRUE when the server was up and FALSE when the server has been down. We have been using a scheduled hourly agent as a monitor (this is part of the process of building another application) and, so far, this function has been 100% reliable. But, like I said, we haven’t experienced any network problems or unusually heavy loads on one of the servers to be able to see what this function does in those situations. Here’s the code:

Function IsServerUp(session As NotesSession, serverName As String) As Boolean
On Error Goto BubbleError
‘ Return TRUE if the remote server is up, FALSE if it is down
Dim db As NotesDatabase
On Error Resume Next
Set db = session.GetDatabase(serverName, “log.ntf”)
If Not db Is Nothing Then
If Not db.IsOpen Then Call db.Open(“”, “”)
‘ Every once in a while Notes returns an invalid database as a valid
‘ database with a string of zeros as the replica id. Check for that.
If db.ReplicaID = String$(Len(db.ReplicaID), “0″) Then Set db = Nothing
End If
On Error Goto BubbleError
If Err <> 0 Or db Is Nothing Then
Err = 0
IsServerUp = False
Else
IsServerUp = True
End If
Exit Function
BubbleError:
Error Err, Error$ & Chr$(10) & ” in procedure ” & Getthreadinfo(1) & “, line ” & Cstr(Erl)
End Function

If you have any input, or can try this out against a heavily used server (that may not respond) or a lot of network traffic, let us know your results.

Viewed 8640 times by 2590 viewers

  1. Chris Osborne
    September 15th, 2010 at 19:52 | #1

    Thanks for the post, it was helpful. I found away to check for server availability without having to hard code a database or template. Feel free to check it out:

    http ://blog.theozzyblogger.com/2010/09/lotus-script-to-check-if-server-is.html

  1. No trackbacks yet.