Home > Domino Tips > Administrator > Address Book > A Quicker Way To Get Formatted Server Information
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ADDRESS BOOK

A Quicker Way To Get Formatted Server Information


Ulf Svensson
08.03.2000
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Need to get server information for documentational purposes? Think opening server documents in R5 is SLOW? So did I...
This agent collects information from all the server documents in the Domino Directory and presents this (nicely formatted) in a document. It can be run as a scheduled agent or via the menu. The agent works with a form called "Document" containing the fields "From", "Subject", "Categories" and "Body" (rtf).

Code

(Declarations) section
Dim thisdb As NotesDatabase
Dim nab As NotesDatabase
Dim serverview As NotesView
Dim serverdoc As NotesDocument
Dim mapdocs As NotesDocumentCollection
Dim mapdoc As NotesDocument
Dim newdoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim servername As NotesName
Dim richStyle As NotesRichTextStyle
Dim rtpStyle As NotesRichTextParagraphStyle

Dim tmpsrvname As String
Dim tmptime As String
Dim pos As Long
Dim interval As Long

Sub Initialize
'Most declarations are in (Declarations) section
Dim session As New NotesSession
'Get a handle to this database
Set thisdb = session.CurrentDatabase
'simple error check
If thisdb.Server = "" Then
Msgbox "This agent must be run in a server replica of the database.", 0 + 48, "Error - stopping execution"
Exit Sub
End If
'simple version check
version$ = session.NotesVersion
boxTitle$ = "You are running " & version$
message$ = |This tool can only be used with R5 releases of the Notes client.
Check your version in the title bar of this message.

Do you want to continue?|
continue% = Messagebox ( message$ , 4 + 32 + 0 + 0, boxTitle$)
If continue% = 7 Then Exit Sub
'Get handles to a few other objects
Set nab = New NotesDatabase( thisdb.Server, "names.nsf" )
Set serverview = nab.GetView("Servers")
Set serverdoc = serverview.GetFirstDocument

'Loop through all th


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Address Book
Formula language button manages Deny Access list searches
Find a Lotus Notes user within NAB Deny Access groups
Synchronize LinkedIn contacts with Lotus Notes Domino
How to correct Lotus Notes public key mismatches in four easy steps
Creating a Lotus Notes Personal Address Book replica
Admin user unable to create NAB
@Transform formula for use in R6
Change NAB while maintaining integrity of documents
NAB: A key piece of the Domino administration puzzle
Build an extended directory catalog

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


e server documents found
Do While Not serverdoc Is Nothing

'For each server document, create a document in this database
'with information on the server
Set newdoc = New NotesDocument(thisdb)
'First the necessary fields for the doc in this database
newdoc.Form = "Document"
newdoc.From = session.Commonusername
newdoc.readers = ""
newdoc.Status = 1
newdoc.CurrentUser = session.Commonusername
tmptime = Str(Now)
Set servername = New NotesName(serverdoc.ServerName(0))
tmpsrvname = servername.Abbreviated
newdoc.Subject = tmpsrvname & " -> Info collected " & tmptime
newdoc.Categories = "Current Server Configurations"
'Create richtextstyle and richtextparagraphstyle (R5 only)
Set richStyle = session.CreateRichTextStyle
Set rtpStyle = session.CreateRichTextParagraphStyle
'Now collect some useful information
Set rtitem = New NotesRichTextItem(newdoc, "Body")
'WriteTextline and WriteHeader are subs
Call WriteTextline("Information collected on " & tmptime, 2)
'Servername, title, buildnumber, location and comment
Call WriteHeader("Server Name")
Call WriteTextline(tmpsrvname, 1)
Call WriteTextline(serverdoc.ServerTitle(0), 1)
Call WriteTextline(serverdoc.ServerBuildNumber(0), 2)
Call WriteHeader("Location")
Call WriteTextline(serverdoc.Location(0), 1)
Call WriteTextline(serverdoc.Comment(0), 2)
'Some information on the HTTP settings
Call WriteHeader("HTTP information")
If serverdoc.HTTP_DatabaseBrowsing(0) = "1" Then
tmpbrowse = "Yes"
Else
tmpbrowse = "No"
End If
Call WriteTextline("Database browsing: " & tmpbrowse, 1)
Call WriteTextline("HTTP port:" & Str(serverdoc.HTTP_Port(0)), 1)
Call WriteTextline("Home URL: " & serverdoc.HTTP_HomeURL(0),2)
Call WriteHeader("Host Name")
Call WriteTextline(serverdoc.SMTPFullHostDomain(0), 2)
'Notes Network information (gathered in its own procedure)
Call WriteHeader("Network Information")
Call WriteNetworkInfo()
'Web log file information
Call WriteHeader("Web Log Files")
Call WriteTextline("Log file directory: " & serverdoc.HTTP_LogDirectory(0), 1)
Call WriteTextline("Access log: " & serverdoc.HTTP_AccessLog(0), 1)
Call WriteTextline("Agent log: " & serverdoc.HTTP_AgentLog(0), 1)
Call WriteTextline("Referer log: " & serverdoc.HTTP_RefererLog(0), 1)
Call WriteTextline("Error log: " & serverdoc.HTTP_ErrorLog(0), 1)
Call WriteTextline("CGI-Error log: " & serverdoc.HTTP_CGIErrorLog(0), 2)
'Transaction logging information
Call WriteHeader("Transaction Logging")
If serverdoc.TRANSLOG_Status(0) = "1" Then
tmptranslogstatus = "Enabled"
'translogfile = serverdoc.TRANSLOG_Path(0)
Else
tmptranslogstatus = "Disabled"
'translogfile = ""
End If
Call WriteTextline("" & tmptranslogstatus, 1)
Call WriteTextline("Log path: " & serverdoc.TRANSLOG_Path(0), 2)
'Redirection URL information gathered from response documents to server document
Call WriteHeader("Redirection URL's")
Set mapdocs = serverdoc.Responses
If mapdocs.Count > 0 Then
Set mapdoc = mapdocs.GetFirstDocument
Do While Not mapdoc Is Nothing
If mapdoc.Form(0) = "Mapping" And mapdoc.RM_MapType(0) = "Redirect" Then
textline$ = mapdoc.RM_MapFrom(0) & " ---> " & mapdoc.RM_MapTo(0)
Call WriteTextline(textline$, 1)
End If
Set mapdoc = mapdocs.GetNextDocument(mapdoc)
Loop
End If
Call WriteTextline("", 2)

'Save the new document and get the next serverdoc
Call newdoc.Save(True,True)
Call newdoc.ComputeWithForm(True,True)
Set serverdoc = serverview.GetNextDocument(serverdoc)
Loop

End Sub

Sub WriteHeader(tmptext As String)
'Headers are written in underlined bold style
richStyle.FontSize = 10
richStyle.Bold = True
richStyle.Underline = True
Call rtitem.AppendStyle(richStyle)
Call rtitem.Appendtext(tmptext)
Call rtitem.Addnewline(1)
End Sub

Sub WriteTextline(tmptext As String, postlines As Integer)
'postlines is the number of new lines to add after the text
richStyle.FontSize = 8
richStyle.Bold = False
richStyle.Underline = False
Call rtitem.AppendStyle(richStyle)
Call rtitem.Appendtext(tmptext)
Call rtitem.Addnewline(postlines)
End Sub

Sub WriteNetworkInfo
'This sub utilizes tabs from NotesRichTextParagraphStyle
'to create a table-like output
pos = RULER_ONE_INCH
interval = 2000 'RULER_ONE_INCH
Call rtpStyle.SetTabs(5, pos, interval, TAB_LEFT)
Call rtitem.AppendParagraphStyle(rtpStyle)
richStyle.FontSize = 9
richStyle.Bold = True
richStyle.Underline = False
Call rtitem.AppendStyle(richStyle)
Call rtitem.AppendText("Port Name")
Call rtitem.AddTab(1)
Call rtitem.AppendText("Protocol")
Call rtitem.AddTab(1)
Call rtitem.AppendText("Notes Network")
Call rtitem.AddTab(1)
Call rtitem.AppendText("Net Address")
Call rtitem.AddNewLine(1)

richStyle.FontSize = 9
richStyle.Bold = False
richStyle.Underline = False
Call rtitem.AppendStyle(richStyle)
For i = 0 To 7
fieldname = "Enabled_" & Ltrim(Rtrim(Str(i)))
If serverdoc.GetItemValue(fieldname)(0) = "1" Then
fieldname = "Port_" & Ltrim(Rtrim(Str(i)))
Call rtitem.AppendText(serverdoc.GetItemValue(fieldname)(0))
Call rtitem.AddTab(1)
fieldname = "Protocol_" & Ltrim(Rtrim(Str(i)))
Call rtitem.AppendText(serverdoc.GetItemValue(fieldname)(0))
Call rtitem.AddTab(1)
fieldname = "NetName_" & Ltrim(Rtrim(Str(i)))
Call rtitem.AppendText(serverdoc.GetItemValue(fieldname)(0))
Call rtitem.AddTab(1)
fieldname = "NetAddr_" & Ltrim(Rtrim(Str(i)))
Call rtitem.AppendText(serverdoc.GetItemValue(fieldname)(0))
Call rtitem.AddNewLine(1)
End If
Next
Call rtpStyle.ClearAllTabs()
Call rtitem.AppendParagraphStyle(rtpStyle)
Set rtpStyle = Nothing
Call rtitem.AddNewLine(1)
End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts