Cluster Management

This script will report the replicas of databases on the cluster node, it uses cluster directory to enumerate information.

Administrator can use this report & keep the cluster consistent.

Sub Click(Source As Button)
Dim session As New notessession
Dim db As NotesDatabase
Dim doccoll As NotesDocumentCollection
Dim Allview As NotesView
Dim doc As NotesDocument
Dim tempdoc As NotesDocument
Dim xlApp As Variant, xlsheet As Variant, rows As Integer, cols As Integer
Dim tempCol As Integer

Dim serv_nm As String
Dim db_nm As String

Dim TempNumServOnClust As String
Dim NumServOnClust As Integer

Dim lst_repid  List As String


rows=1
cols=1


serv_nm=Inputbox(“Provide the name of the server on which the Cluster directory resides. Blank  entry would look for the cluster directory database on local  “,”Tools”,”ServerName”)

db_nm=”cldbdir.nsf”

TempNumServOnClust=Inputbox$(“Number of member servers of the cluster “,”Tools”,”2″)

If  Not Isnumeric(TempNumServOnClust) Then
Msgbox “Server count on the  cluster should be numeric”
Exit Sub
Else
NumServOnClust=Cint(TempNumServOnClust)
End If

‘Set db=session.CurrentDatabase
Set db=New NotesDatabase(serv_nm,db_nm)

If db Is Nothing Then
Msgbox “Database could not be found on the server”+serv_nm
Exit Sub
End If

Set Allview=db.getview(“($ReplicaID)”)

‘======================================================================================================
‘excel variable initialization
Set xlApp = CreateObject(“Excel.Application”)
‘start Excel with OLE Automation
xlApp.StatusBar = “Creating WorkSheet. Please be patient…”
xlApp.Visible = True
xlApp.Workbooks.Add
xlApp.ReferenceStyle = 2
Set xlsheet = xlApp.Workbooks(1).Worksheets(1) ‘select first worksheet
‘=============================================================================================

‘worksheet title
xlsheet.Cells(rows,cols).Value =”Following Databases are not available on all the ” +Cstr(NumServOnClust)+”   Servers ,  Database: ” + db.title +”, Export  created on: ” + Format(Now,”DD/MON/yyyy HH:MM”)

xlApp.StatusBar = “Creating Column Heading. Please be patient…”

rows=2

xlsheet.Cells(rows,1).value=”Database File”
xlsheet.Cells(rows,2).value=”Title”
xlsheet.Cells(rows,3).value=”Available on Servers”

maxcols=NumServOnClust

Set doc=allview.GetFirstDocument

rows=3

While Not doc Is Nothing

repid = Evaluate({@text(ReplicaID;”*”)},doc)

Set doccoll=allview.GetAllDocumentsByKey(repid(0))

flg=Iselement ( lst_repid( repid(0) ) )

xlApp.StatusBar = “Checking  ” & doc.title(0)

If doccoll.count<NumServOnClust  And  flg=False   Then

xlsheet.Cells(rows,1).Value =”‘”+ doc.GetItemValue(“Pathname”)(0)
xlsheet.Cells(rows,2).Value =”‘”+ doc.GetItemValue(“Title”)(0)

‘=======================================================
Set tempdoc=doccoll.GetFirstDocument
tempCol=3
While Not tempdoc Is Nothing
xlsheet.Cells(rows,tempCol).Value =”‘”+ tempdoc.GetItemValue(“Server”)(0)
Set tempdoc=doccoll.GetNextDocument(tempdoc)
tempCol=tempCol+1
Wend
‘===========================================================


xlApp.StatusBar = “Importing Notes Data – Document ” & rows-1

rows=rows+1

End If

lst_repid(repid(0))=repid(0)

Set doc=allview.GetNextDocument(doc)
Wend

xlApp.Rows(“1:1”).Select
xlApp.Selection.Font.Bold = True
xlApp.Selection.Font.Underline = True
xlApp.Range(xlsheet.Cells(2,1), xlsheet.Cells(rows,maxcols)).Select
xlApp.Selection.Font.Name = “Arial”
xlApp.Selection.Font.Size = 9
xlApp.Selection.Columns.AutoFit
With xlApp.Worksheets(1)
.PageSetup.Orientation = 2
.PageSetup.centerheader = “Report – Confidential”
.Pagesetup.RightFooter = “Page &P” & Chr$(13) & “Date: &D”
.Pagesetup.CenterFooter = “”
End With
xlApp.ReferenceStyle = 1
xlApp.Range(“A1”).Select
xlApp.StatusBar = “Importing Data from Lotus Notes Application was Completed.”



Set xlapp=Nothing ‘stop OLE
Set db=Nothing

End Sub

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s