monitors:win_2003_dc_diags

Error loading plugin struct
ParseError: syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM)
More info is available in the error log.

BBDcDiags

Author Graeme Shea
Compatibility Xymon 4.2
Requirements dcdiags and netdiags from the windows support tools and a Xymon client
Download None
Last Update 2008-08-26

Runs the support tools dcdiags.exe and netdiags.exe and reports the results to Big Brother or Xymon. These two tests are the basic tests to confirm the correct operation of Active Directory.

Client side

Save the script, dcdiags.exe and netdiags.exe into the same folder. Add a sceduled task to run the script as required at your site (once a day?).

Several errors have been hardcoded to be ignored. You may need to comment these out.

Server side

none

Show Code ⇲

Hide Code ⇱

Option Explicit
'******************************************************************************************************
' Run DcDiag and NetDiag. Report result of tests to Big Brother.
' save copy of output to current folder to help diagnose any errors.
' 17/08/06 Graeme Shea
' Added ignor of dc link test. 05/09/06 Graeme Shea
' Fixed capialisation problem with ignore of dc link test. 07/09/06 Graeme Shea
' V1.3 Added ignore of concerrent error msg with error of dc link test. 14/09/06 Graeme Shea
' V1.4 Added ignore of WAN test. 1/10/06 Graeme Shea
' V1.4.1 Added ignore of FRS events from previous 24hrs. 3/12/06 Graeme Shea
' V1.4.2 Added ignore of a syslog event from previous 24hrs. 20/02 Graeme Shea
' V1.5.0 BBWin compatable. 01/05/08 Graeme Shea
'*******************************************************************************************************

Dim oShell,oFile,FSO,ExtPath, szResult, szOutPut, szDelay, b64Bit
Const Version = "1.4.2"

Set FSO= CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("WScript.Shell")

szDelay = "+27h" 'Sets the PURPLEDELAY for this service check - change to match frequency of defrag

szOutput = ""

' Retrieve path to big brother log files
ExtPath = GetBigBrotherPath
on Error GoTo 0

szResult = runoutput("cmd /C dcdiag.exe",1, "DcDiag.txt")
szResult = lCase(szResult)

if instr(szResult, "failed test frsevent")>0 Then
	'If the FRS is not working now will still raise error. I'm not very concerned
	' if there was an error of some sort in the last 24hrs.
	szResult = Replace (szResult, "failed test frsevent", " ")
	szResult = Replace (szResult, "failing sysvol replication", " ")
	szOutPut = szOutPut & vbcrlf &  "&yellow FRS Event Ignored. "
	'MsgBox "in fail system log"
	
end If

if instr(szResult, "failed test systemlog")>0 Then
	'If there are errors in the system log you have allready been advised
	' no need to have a red dot for the whole day.
	szResult = Replace (szResult, "failed test systemlog", " ")
	szOutPut = szOutPut & vbcrlf &  "&yellow System Log Error Ignored. "
	'MsgBox "in fail system log"
	if instr(szResult, "browser service has failed to retrieve the")>0 Then
		'MsgBox "The browser service has failed to retrieve the"
   		szResult = replace (szResult, " failed to retrieve the", " ")
		szOutPut = szOutPut & vbcrlf &  "&yellow Browser Error Ignored. "
	end If
	if instr(szResult, "service failed to see a directory server")>0 Then
		'MsgBox "The browser service has failed to retrieve the"
   		szResult = replace (szResult, "service failed to see a directory server", " ")
   		szResult = replace (szResult, "service failed to see a directory server", " ") 'Error often in pairs
		szOutPut = szOutPut & vbcrlf &  "&yellow Syslog reported a service couldnt see the directory server. "
	end If
	
end If




' msgbox "szOutput = " & szOutPut
if instr(szResult, "fail") > 0 Then
   szOutPut = szOutPut  & VbCrLf & "&red DcDiag test failed. " & VbCrLf & VbCrLf
   else szOutPut = szOutPut  & VbCrLf & "&green DcDiag test passed. " & VbCrLf & VbCrLf
end If




szResult = runoutput("cmd /C netdiag.exe",1, "NetDiag.txt")
szResult = lCase(szResult)

if instr(szResult, "default gateway test . . . : failed")>0 then
   'VicSmart Routers allways seem to fail gateway test so ignore
   szResult = replace (szResult, "default gateway test . . . : failed", " ")
   szResult = replace (szResult, "default gateway test . . . . . . . : failed", " ")
   szOutPut = szOutPut & vbcrlf &  "&yellow NetDiag Default Gateway Test Failure Ignored. " & VbCrLf
end If

if instr(szResult, "domain membership test . . . . . . : failed")>0 Then
   'When the Big Brother client is running under the system account it cannot access
   ' the network to check domain membership.  If you run under another account you
   ' can comment this section out (I think)
   szResult = replace (szResult, "domain membership test . . . . . . : failed", " ")
   szOutPut = szOutPut & vbcrlf &  "&yellow NetDiag Domain Membership Test Failure Ignored. " & vbcrlf
end If

if instr(szResult, "dc list test . . . . . . . . . . . : failed")>0 Then
   'When the Big Brother client is running under the system account it cannot access
   ' the network to check domain membership.  If you run under another account you
   ' can comment this section out (I think)
   szResult = replace (szResult, "dc list test . . . . . . . . . . . : failed", " ")
   ' This is an error message that occurs concurrntly and causes false detection of error
   szResult = replace (szResult, "failed to enumerate dcs by using the browser.", " ")
   szOutPut = szOutPut & VbCrLf &  "&yellow NetDiag DC list test Test Failure Ignored. " & VbCrLf
   
end If

if instr(szResult, "wan configuration test . . . . . . : failed")>0 Then
   szResult = replace (szResult, "wan configuration test . . . . . . : failed", " ")
   szOutPut = szOutPut & VbCrLf &  "&yellow NetDiag WAN configuration Test Failure Ignored. " & VbCrLf
   
end If

if instr(szResult, "fail")> 0 Then
   szOutPut = szOutPut & "&red NetDiag test failed. " & VbCrLf
   else szOutPut = szOutPut & "&green NetDiag test passed. " & vbcrlf
end If

if instr(szOutPut, "fail")>0 then
   szOutPut = "red" & szDelay & "   " & now & vbcrlf & vbcrlf & szOutPut
   else szOutPut = "green" & szDelay & "   " &Now & vbcrlf & vbcrlf & szOutPut
end if

Set oFile = FSO.OpenTextFile(ExtPath &"\dcdiags", 2, True)
oFile.write(szOutput)
oFile.WriteBlankLines(2)
oFile.WriteLine "DCDiags Check, BBDCDiags.vbs Version " & Version
oFile.close


Function RunOutput( cProgram, nWindowType, szTempFileName )
' Run a program and save results to szTempFileName
' Got this routing of the net somewhere. Apologies to the orginal author
   Dim oFS
   Set oFS = CreateObject("Scripting.FileSystemObject")
   Dim oShell
   Set oShell = CreateObject( "WScript.Shell" )
   oShell.Run cProgram & " > " & szTempFileName, nWindowType, True
   Dim oFile
   Set oFile = oFS.OpenTextFile(szTempFileName, 1, True)
   RunOutput = oFile.ReadAll()
   oFile.Close
   Set oShell = Nothing
 End Function

function Convert2Text(sTemp)
	' Converts non printable characters to " " , so that Textfile is working
	dim loopcount, tempwert, inttest
	tempwert=""
	for loopcount = 1 to len(sTemp)   ' replace all unprintable characters  maybe easier and faster with RegEx
		 inttest = ascw(mid(sTemp,loopcount,1))
		'if ((inttest>=32) and (inttest<127)) or (inttest=10) or (inttest=13) or (inttest=9) then
		if ((inttest>=32) and (inttest<127)) then
			 tempwert = tempwert & chr(inttest)  ' printable Character or CR LF TAB
		 else
			 tempwert = tempwert & " "
		 end if
		'tempwert = tempwert & chr(ascb(mid(sTemp,loopcount,1)))
	next
	Convert2Text = tempwert
end function


' Get path to external log files (for BB 1.08d)
Function GetBigBrotherPath()
Dim ExtPath
On Error Resume Next

ExtPath = oShell.RegRead("HKLM\SOFTWARE\Quest Software\BigBrother\bbnt\ExternalPath\")
If IsEmpty(ExtPath) Then
	ExtPath = oShell.RegRead("HKLM\SOFTWARE\BBWin\tmppath")
End If
If Not IsEmpty (ExtPath) Then  'If not empty then we have 32bit machine
	b64Bit = False
End If
If IsEmpty(ExtPath) Then
	ExtPath = oShell.RegRead("HKLM\SOFTWARE\Wow6432node\Quest Software\BigBrother\bbnt\ExternalPath\")
End If
If IsEmpty(ExtPath) Then
	ExtPath = oShell.RegRead("HKLM\SOFTWARE\Wow6432node\BBWin\tmppath")
End If

If Not IsEmpty(ExtPath) And isEmpty(b64Bit) Then 
	b64Bit = True
	err.clear
End If

If IsEmpty(ExtPath) Then
	'Put exit stuff here
End If
on Error GoTo 0
GetBigBrotherPath = ExtPath
End Function




  • 2008-08-26
    • Initial release
  • monitors/win_2003_dc_diags.txt
  • Last modified: 2009/11/23 06:12
  • by 127.0.0.1