'--------------------------------------------
Dim insideMP
'insideMP = false 'only for test outside MP
insideMP = true 'script runs inside MP
'--------------------------------------------
' Search patterns, e.g. important functions:
' MonitorCommandAndCheckCommfile
'--------------------------------------------
Dim DebugMode
Dim DebugFile
Dim DebugConsole
DebugMode = false '*** enables Deug generally, may be overrided by inifile
DebugFile = false '*** set to "true" if logfile has been created
DebugConsole = false '*** enables console output for debug
'--------------------------------------------
' BCDebug can be changed during runtime in the file given in constant:
' CONST LOGINIFILENAME = "SVISCOM-BL.Log.ini"
' by changing the value "DebugLevel" in the section given by constant:
' CONST INISEC_BLADESYSTEMDISCOVERY = "BladeSystemDiscovery"
'
' Note: If "DebugMode" = FALSE, BCDebug has no effect.
'
' Allow no / less / more DEBUG (bitwise, e.g.: 10 = 0x0A = 0x02 + 0x08)
Dim BCDebug
BCDebug = 0
CONST BCNUM_MAX_INDEX = 49 ' maximum index for supported enclosures
CONST BC_MAX_NUM = 50 ' maximum number of supported enclosures
CONST BCDEBUG_MIN = 1 ' 0x0001
CONST BCDEBUG_MAX = 2 ' 0x0004
CONST BCDEBUG_FUNC = 16 ' 0x0010 "Function ...()"
'--------------------------------------------
Dim Registry
Const HKEY_LOCAL_MACHINE = &H80000002
'--------------------------------------------
Dim ErrorsDetected
ErrorsDetected = false
Dim ExitOnMonitorServiceNotRunning '*** true: script quits if monitor service is not running
ExitOnMonitorServiceNotRunning = true
Dim updateByControlCode
updateByControlCode = true '*** disabled because control code doesn't work on W2K3
Dim absDiscoveryFileName, absDiscoveryDoneFileName
' path to "SVISCOM-BL" in registry
CONST BL_REG_PATH = "SOFTWARE\Fujitsu\ServerView Suite\SCOM Integration\SVISCOM-BL"
' path to "monitor service" in registry (= BL_REG_PATH & "\" & KEY_MONITOR_SERVICE)
' "MonitorService" entries
CONST REGKEY_MS_COMMFILEPATH = "CommFilePath"
CONST REGKEY_MS_CONFIGFILENAME = "ConfigFileName"
CONST REGKEY_MS_CONFIGFILEPATH = "ConfigFilePath"
CONST REGKEY_MS_LOGFILESUBDIR = "LogFileSubDir"
CONST REGKEY_MS_LOGINIFILENAME = "LogIniFileName"
CONST REGKEY_MS_MANAGEDFILENAME = "ManagedFileName"
' Use the "WMI" name!
CONST BLADESYSTEMMONITORSERVICE = "PRIMERGYBladeSystemMonitor"
'*** absolute default name of communication file (if it cannot be determined else)
CONST ABSBCCOMMFILE = "C:\Program Files\Fujitsu\ServerView Suite\SCOM Integration\SVISCOM-BL\MonitorService\comm\ManagedPRIMERGYBlades.xml"
'*** LOG files and the LOG INI file are stored here:
'*** default name of log file subdirectory
CONST LOGFILESUBDIR = "SVISCOM\SVISCOM-BL"
'*** default name of log file path (if it cannot be determined else)
CONST LOGFILEDIR = "C:\Windows\Temp\SVISCOM\SVISCOM-BL"
'*** Note: This path is assembled during runtime!
'*** For the beginning of the path the system environment variable "TEMP" (usually: C:\Windows)
'*** is used, e.g. if OS is NOT installed in partition "C:" or subdir "Windows",
'*** and for the end the reg key value of "REGKEY_MS_LOGFILESUBDIR"!
'*** default name of log file name
CONST LOGFILENAME = "PYBladeSystemDiscovery_"
'*** default name of log ini file name
CONST LOGINIFILENAME = "SVISCOM-BL.Log.ini"
Dim strLogIniFileDir, strLogIniFileName, strLogIniFileNameAbs
Dim strLogFileSubDir, strLogFileDir, strLogFileNameAbs
Dim Computer, simulationMode
Dim oAPI, WshShell, oDiscoveryEmptyData, xmlDoc
Dim FSO1
Dim StartTime
Dim MonitorAgentRunning, strEventLogMsg
Dim strBladeSystemErrorLogName
Dim BC_PropertyNameList, PropertyNameList, ComponentsList, BC_ComponentsGroupList
Dim index, SCCIindex, componentNameArray, componentInfoArray
Dim componentNames, componentInfos, componentHealth
Dim nStatus
Dim PropertyArray
Dim NoOfBladeSystem
Dim SysChassisSerialNumber, SysCtrlSystemName, SysCtrlHousingType, BCIpAddress
Dim NoOfStorageBladesMonitored
Dim SourceType, SourceID, ManagedEntityId, PrincipalName
Dim oDiscoveryData, oInstBC, oInst
Dim TEMP
Dim BladeSystemCommunicationFilePath
Dim NoOfMMBUnits
Dim NoOfPSUnits
Dim NoOfFanUnits
Dim NoOfTempSensorUnits
Dim NoOfConnectUnits
Dim NoOfKVMUnits
Dim NoOfServerBlades
Dim NoOfStorageBlades
'*** Script MUST support a maximum of 100 blade "servers", thus:
'*** 102 (cMAXINDEX) elements in every array available ***
'*** (102 is the next multiple of 16, which is bigger than 100 ...)
'*** Done Matrix, first index: BC number, second index: component number
Dim arrDoneMatrix(50, 10)
Dim responseMatrix(50, 10)
'********************************************************************
' Sub Main(): main sub
'********************************************************************
Sub Main()
Dim oArgs, iniVal
Dim i, j, TargetComputer
Dim controlReturn, checkCount, fileUpdated, fileCouldBeRead, filePath
Dim BC_number, NoOfUnits, Unit_i, SaveBCDebug
Dim EnvVar, SYSTEMDRIVE, SYSTEMROOT, WINDIR
Dim strCommand, strComponent, strValue, strCOMM3File, strTempName
Dim retGetBC_Properties
Dim discoveryDone
Dim fileNames
Dim tmpEnclosures
Dim commFileFolder
Dim allFiles
Dim ResponseProcessed
Dim responseFile
Dim acc1, mod1, diffsec
Dim respFileCount, retryCount
'*** Check function arguments *************************************************
Set oArgs = WScript.Arguments
If insideMP = true Then
If oArgs.Count < 4 Then
DebugOut("Not enough args!")
Wscript.Quit -1
ElseIf oArgs.Count = 4 Then
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
PrincipalName = oArgs(2)
TargetComputer = oArgs(3)
Else
'*** more than 4 arguments
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
PrincipalName = oArgs(2)
TargetComputer = oArgs(3)
If oArgs(4) = "ComponentInstances" Then
ComponentInstances = true
End If
End If
End If
TEMP = ""
If insideMP = TRUE Then
'*** this value is different in interactive mode!
TEMP = EnvVar.Item("TEMP")
End If
If Len(TEMP) = 0 Then
'try this as default
If Len(WINDIR) > 0 Then
TEMP = WINDIR & "\" & KEY_TEMP
Else
If Len(SYSTEMROOT) > 0 Then
TEMP = SYSTEMROOT & "\" & KEY_TEMP
Else
TEMP = SYSTEMDRIVE & "\" & KEY_WINDOWS & "\" & KEY_TEMP
End If
End If
End If
'*** assemble LOG files and LOG INI file dir path
strLogFileSubDir = GetMonSvrRegistryValue(REGKEY_MS_LOGFILESUBDIR)
If Len(strLogFileSubDir) = 0 Then
strLogFileSubDir = LOGFILESUBDIR
End If
If Len(strLogFileSubDir) > 0 AND Len(TEMP) > 0 Then
strLogFileDir = TEMP & "\" & strLogFileSubDir
Else
strLogFileDir = LOGFILEDIR
End If
strLogIniFileName = GetMonSvrRegistryValue(REGKEY_MS_LOGINIFILENAME)
If Len(strLogIniFileName) = 0 Then
strLogIniFileName = LOGINIFILENAME
End If
strLogIniFileNameAbs = strLogIniFileDir & "\" & strLogIniFileName
'*** check if debug mode is enabled by ini file ***************************
If DebugMode = false Then
Call GetLogFileIni(strLogIniFileNameAbs, INISEC_BLADESYSTEMDISCOVERY)
End If
SaveBCDebug = 0
If DebugMode = TRUE Then
SaveBCDebug = BCDebug
BCDebug = GetOpenIniValue(strLogIniFileNameAbs, INISEC_BLADESYSTEMDISCOVERY, "DebugLevel")
If BCDebug = "" Then
'e.g. ini file not there: restore old value
BCDebug = SaveBCDebug
End If
End If
If DebugMode = true Then
strLogFileNameAbs = strLogFileDir & "\" & LOGFILENAME & TargetComputer & ".log"
Call CreateLogFile(strLogFileNameAbs, TRUE)
End If
'*** we create *.in_ file if not yet done
Call CreateLogIniFile(strLogIniFileDir)
'### On Error Resume Next
If BCDebug AND BCDEBUG_MAX Then
'*** get the windows error log file name from out of the config file
strTempName = GetConfigFileEntry("//*/LogFile/Name")
'*** it ends with ".log" - we don't need it - replace it by "" (nothing) [= delete the ".log" appendix]
strBladeSystemErrorLogName = Replace(strTempName, ".log", "")
If Len(strBladeSystemErrorLogName) = 0 Then
'*** use DEFAULT
strBladeSystemErrorLogName = KEY_EVENT_LOG
End If
strCommand = "eventcreate /L " & strBladeSystemErrorLogName & " /T Information /SO " & _
Chr(34) & "SVISCOM-BL Discovery" & Chr(34) & " /ID 499 /D " & Chr(34) & _
"SVISCOM-BL: Started new DISCOVERY cycle." & Chr(34)
WshShell.Run strCommand
'### On Error Goto 0
End If
If insideMP = true Then
strCommand = "Args: " & "SourceId=" & SourceId & ", ManagedEntityId=" & ManagedEntityId & ", PrincipalName=" & PrincipalName & ", TargetComputer=" & TargetComputer
DebugOut(strCommand)
Else
strCommand = "Args: TargetComputer = " & TargetComputer
DebugOut(strCommand)
DebugOut("EnvVar SYSTEMDRIVE = '" & SYSTEMDRIVE & "'")
End If
'Warning: string 'strCommand' is used below again (do not change in between!)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("*** Check for simulation of blade server discovery/monitoring")
End If
simulationMode = false
simulationMode = CheckSimulationMode(strLogIniFileNameAbs)
'*** Create discovery data object
If insideMP = true Then
DebugOut("*** Create OM Script API and DiscoveryData Object")
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oDiscoveryData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
Set oDiscoveryEmptyData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
End If
'*** Generate start message
If insideMP = true Then
strEventLogMsg = "Fujitsu PRIMERGY Blade System Discovery started"
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 401, INFORMATIONAL_EVENT, strEventLogMsg)
DebugOut(strEventLogMsg)
End If
'*** Check the running state of the Blade System monitor agent
MonitorAgentRunning = IsMonitorAgentRunning()
If MonitorAgentRunning <> true Then
If ExitOnMonitorServiceNotRunning = true Then
strEventLogMsg = "The Blade System Monitor Service '" & BLADESYSTEMMONITORSERVICE & "' is not running, the Discovery script ends here!"
If insideMP = true Then
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 402, ERROR_EVENT, strEventLogMsg)
End If
DebugOut(strEventLogMsg)
WScript.Quit(0)
End If
End If
' *** assemble absolute "DISCOVERY" file name
absDiscoveryFileName = BladeSystemCommunicationFilePath & "\" & KEY_TIME & "\" & KEY_FILE_DISCOVERY
' *** assemble absolute "DISCOVERY.done" file name
absDiscoveryDoneFileName = BladeSystemCommunicationFilePath & "\" & KEY_TIME & "\" & KEY_FILE_DIS_DONE
' *** delete "done" file, if it exists
Set FSO1 = CreateObject("Scripting.FileSystemObject")
If FSO1.FileExists(absDiscoveryDoneFileName) = TRUE Then
Call FSO1.DeleteFile(absDiscoveryDoneFileName, TRUE)
End If
'*** we must set "NoOf...Units" to MAX (and check status) to find all units, e.g. those after "empty" ones
NoOfMMBUnits = MAX_MMBCOMPONENT '*** set to max. number
NoOfPSUnits = MAX_PSUCOMPONENT '*** set to max. number
NoOfFanUnits = MAX_FANCOMPONENT '*** set to max. number
NoOfTempSensorUnits = MAX_TSUCOMPONENT '*** set to max. number
NoOfConnectUnits = MAX_CUCOMPONENT '*** set to max. number
NoOfKVMUnits = MAX_KVMCOMPONENT '*** set to max. number
NoOfServerBlades = MAX_SERVERBLADES '*** set to max. number
NoOfStorageBlades = MAX_STORAGEBLADES '*** set to max. number
StartTime = now()
'******************************************************************************
'**** Real processing starts here *********************************************
'******************************************************************************
'*** cleanup old discovery files
Set commFileFolder = FSO1.GetFolder(BladeSystemCommunicationFilePath)
Set allFiles = commFileFolder.files
For Each responseFile in allFiles
On Error Resume Next
If (InStr(1,responseFile.Name, "Blade_", 1) > 0) and (InStr(1,responseFile.Name, "Dis_comm.xml", 1) > 0) Then
Call responseFile.Delete(TRUE)
End If
On Error GoTo 0
Next
respFileCount = 0
retryCount = 0
'*** Try to send enclosure CMDs for all enclosures
If tmpEnclosures < 0 Then
'*** file not available or other serious problem
strEventLogMsg = "File with managed enclosures couldn't be read. Discovery script ends here!"
If insideMP = true Then
Call oAPI.Return(oDiscoveryEmptyData)
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 404, ERROR_EVENT, strEventLogMsg) '#### to be changed
End If
DebugOut(strEventLogMsg)
WScript.Quit(0)
End If
If tmpEnclosures = 0 Then
'*** file available but no enclosures defined
strEventLogMsg = "No Blade System found in communication file. Discovery script ends here!"
If insideMP = true Then
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 405, WARNING_EVENT, strEventLogMsg)
Call oAPI.Return(oDiscoveryEmptyData)
End If
DebugOut("***** " & strEventLogMsg & " *****")
WScript.Quit(0)
End If
Do
ResponseProcessed = False
Set allFiles = commFileFolder.files
'*** check enclosure files with higher priority
For Each responseFile in allFiles
On Error Resume Next
If (InStr(1,responseFile.Name, "Blade_", 1) > 0) and (InStr(1,responseFile.Name, "_EnclosureDis_comm.xml", 1) > 0) Then
On Error Goto 0
'*** file out of date?
diffsec = FileAge(responseFile)
If diffsec < 0 Then
DebugOut("Response file out of date, ignoring it")
Else
On Error Resume Next
ResponseProcessed = ResponseProcessed or ProcessResponseFile(responseFile.Path)(0)
On Error Goto 0
End If
End If
Next
'*** now process all response files
For Each responseFile in allFiles
On Error Resume Next
If (InStr(1,responseFile.Name, "Blade_", 1) > 0) and (InStr(1,responseFile.Name, "Dis_comm.xml", 1) > 0) Then
On Error Goto 0
'*** file out of date?
diffsec = FileAge(responseFile)
If diffsec < 0 Then
DebugOut("Response file out of date, ignoring it")
Else
On Error Resume Next
ResponseProcessed = ResponseProcessed or ProcessResponseFile(responseFile.Path)(0)
On Error Goto 0
End If
End If
Next
If(ResponseProcessed = False) Then
'*** check if all files processed
If AreAllFilesProcessed() Then
If AllResponsesDone() Then
discoveryDone = true
Else
If retryCount = 0 Then
retryCount = retryCount + 1
strEventLogMsg = "Fujitsu PRIMERGY Blade System command retries started"
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 419, INFORMATIONAL_EVENT, strEventLogMsg)
PerformRetries()
respFileCount = 0
Else
discoveryDone = true
End If
End If
'*** check timeout for missing files
Else
'*** include delay here
WScript.Sleep(WAIT_5S)
respFileCount = respFileCount + 1
If respFileCount >= 120 Then
If retryCount = 0 Then
retryCount = retryCount + 1
strEventLogMsg = "Fujitsu PRIMERGY Blade System command retries started"
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 419, INFORMATIONAL_EVENT, strEventLogMsg)
PerformRetries()
respFileCount = 0
Else
discoveryDone = true
End If
Else
DebugOut("********** Still looping, count = " & CStr(respFileCount) & " **********")
End If
End If
End If
Loop Until discoveryDone = true
Call PostProcessBladeDevicesAndKVM()
Call PostProcessMissingComponents()
If insideMP = true Then
DebugOut("*** Return Discovery Data to OpsMgr")
Call oAPI.Return(oDiscoveryData) ' Submit the data
Set oDiscoveryData = Nothing
Set oAPI = Nothing
End If
CreateDiscoveryDoneFile()
DebugOut("********** Normal End of Discovery **********")
End Sub
'******************************************************************************
'**** Functions and Subs *********************************************
'******************************************************************************
'--------------------------------------------------------------------
' Function AreAllFilesProcessed()
'--------------------------------------------------------------------
Function AreAllFilesProcessed()
Dim i, j
Dim done
i = 1
done = True
Do While done and (i <= NoOfBladeSystem)
For j = 0 To COMPLIST_MAX
done = done and arrDoneMatrix(i,j)
Next
i = i + 1
Loop
AreAllFilesProcessed = done
End Function
'--------------------------------------------------------------------
' Function AllResponsesDone()
'--------------------------------------------------------------------
Function AllResponsesDone()
Dim i, j
Dim done
i = 1
done = True
Do While done and (i <= NoOfBladeSystem)
For j = 0 To COMPLIST_MAX
done = done and responseMatrix(i,j)
Next
i = i + 1
Loop
AllResponsesDone = done
End Function
AllResponsesDone()
'--------------------------------------------------------------------
' Function PerformRetries()
'--------------------------------------------------------------------
Function PerformRetries()
Dim i, j
Dim done
Dim controlReturn
Dim strEventLogMsg
i = 1
done = True
Do While done and (i <= NoOfBladeSystem)
'*** check enclosure
If arrDoneMatrix(i,0) = false Then
'*** process only enclosure file
Call GenerateSelectedDiscoveryCmdFile(arrSysChasSerNo(i), arrDiscoveryIp(i), 0)
Else
'*** process remaining components
For j = 1 To COMPLIST_MAX
If arrDoneMatrix(i,j) = false Then
Call GenerateSelectedDiscoveryCmdFile(arrSysChasSerNo(i), arrDiscoveryIp(i), j)
strEventLogMsg = "File lost"
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 430, INFORMATIONAL_EVENT, strEventLogMsg)
End If
Next
End If
i = i + 1
Loop
i = 1
done = True
Do While done and (i <= NoOfBladeSystem)
'*** check enclosure
If responseMatrix(i,0) = false Then
'*** process only enclosure file
arrDoneMatrix(i, 0) = False
Call GenerateSelectedDiscoveryCmdFile(arrSysChasSerNo(i), arrDiscoveryIp(i), 0)
Else
'*** process remaining components
For j = 1 To COMPLIST_MAX
If responseMatrix(i,j) = false Then
arrDoneMatrix(i, j) = False
Call GenerateSelectedDiscoveryCmdFile(arrSysChasSerNo(i), arrDiscoveryIp(i), j)
strEventLogMsg = "Timeout"
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 431, INFORMATIONAL_EVENT, strEventLogMsg)
End If
Next
End If
i = i + 1
Loop
controlReturn = MonitoringOnDemand()
PerformRetries = done
End Function
'--------------------------------------------------------------------
' Sub InitDoneMatrix()
'--------------------------------------------------------------------
Sub InitDoneMatrix()
Dim i, j
For i = 0 To BCNUM_MAX_INDEX
For j = 0 To COMPLIST_MAX
arrDoneMatrix(i,j) = false
Next
Next
End Sub
'--------------------------------------------------------------------
' Sub SetComponentsDoneInDoneMatrix(i)
'--------------------------------------------------------------------
Sub SetComponentsDoneInDoneMatrix(i)
Dim j
For j = 1 To COMPLIST_MAX
arrDoneMatrix(i,j) = true
Next
End Sub
'--------------------------------------------------------------------
' Sub InitResponseMatrix()
'--------------------------------------------------------------------
Sub InitResponseMatrix()
Dim i, j
For i = 0 To BCNUM_MAX_INDEX
For j = 0 To COMPLIST_MAX
responseMatrix(i,j) = true
Next
Next
End Sub
'--------------------------------------------------------------------
' Function ProcessResponseFile(responseFile)
'--------------------------------------------------------------------
Function ProcessResponseFile(responseFile)
Dim fileProcessed
Dim chassisSN
Dim indexBC
Dim strEventLogMsg
Dim fullFname
Dim compNum
Dim errors
DebugOut("Start: Function ProcessResponseFile(responseFile: " & responseFile)
'*** Try to load XML response file
Set xmlDoc = Nothing
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.load(responseFile)
If xmlDoc.parseError Then
DebugOut("Error when parsing the response file. 1st try")
'*** try it again
WScript.Sleep(WAIT_5S)
Set xmlDoc = Nothing
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = False
xmlDoc.load(responseFile)
End If
If xmlDoc.parseError Then
'*** something wrong
strEventLogMsg = "Could not parse XML file (5) " & responseFile
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 407, WARNING_EVENT, strEventLogMsg)
DebugOut("Error when parsing the response file. 2nd and last try")
Else
DebugOut("Now evaluating response file")
'*** Error Code processing
Set errors = xmlDoc.selectSingleNode("//Server/Errors")
If Not errors is Nothing Then
lastErrorNum = CInt(errors.getAttribute("LastErrorCode"))
Else
'*** not valid response
lastErrorNum = -1
DebugOut("Missing last error information in response file")
End If
'*** determine chassis serial number from response file
chassisSN = GetChassisSNFromResponeFile(responseFile)
If len(chassisSN) > 0 Then
'*** is this chassis SN known?
indexBC = GetBCNumberFromSN(chassisSN)
If indexBC < 0 Then
'*** No, then generate a warning and ignore this file
strEventLogMsg = "Response file for unknown chassis found; response file name: " & responseFile
If insideMP = true Then
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 408, ERROR_EVENT, strEventLogMsg)
End If
DebugOut("No valid chassis number in response file")
Else
DebugOut("Determining response file type")
If InStr(1,responseFile, "EnclosureDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_ENCLOSURE
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessEnclosures(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "ServerBladesDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_SERVERBLADES
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessServerBlades(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "StorageBladesDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_STORAGEBLADES
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessStorageBlades(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "MMBUnitsDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_MMBS
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessMMBs(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "PowerSupplyUnitsDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_POWERSUPPLIES
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessPSUs(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "FanUnitsDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_FANS
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessFans(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "TempSensorsDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_TEMPSENSORS
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessTempSensors(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "_ConnectUnitsDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_CONNECTUNITS
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessCCUs(indexBC, chassisSN, BC_COMP_CONNECTUNIT)
Else
DebugOut("File already done")
End If
ElseIf InStr(1,responseFile, "KVMUnitsDis_comm.xml", 1) <> 0 Then
compNum = COMPLIST_KVMUNITS
If arrDoneMatrix(indexBC,compNum) = false Then
fileProcessed = ProcessKVMs(indexBC, chassisSN)
Else
DebugOut("File already done")
End If
Else
'*** not a response file => ignore it
DebugOut("Not a response file")
fileProcessed = array(false, 0)
End If
End If
End If
End If
If fileProcessed(0) = true Then
DebugOut("ProcessResponseFile finished with success: ")
'*** set done matrix
arrDoneMatrix(indexBC, compNum) = True
DebugOut("Response file processed")
'*** delete response file
On Error Resume Next
If FSO1.FileExists(responseFile) = TRUE Then
Call FSO1.DeleteFile(responseFile, TRUE)
End If
On Error Goto 0
End If
'*** check on timeouts and other problems
If (fileProcessed(1) = 0) And ((lastErrorNum = 2) Or (lastErrorNum = 3) Or (lastErrorNum = 6) Or (lastErrorNum = 7) Or (lastErrorNum = 8) Or (lastErrorNum = -1)) Then
responseMatrix(indexBC, compNum) = False
DebugOut("Response file with timeout errors")
Else
responseMatrix(indexBC, compNum) = True
End If
Set xmlDoc = Nothing
ProcessResponseFile = fileProcessed
End Function
'--------------------------------------------------------------------
' Function ReadCOMM2FileAndSendEnclosureCMDs():
' - reads communication file with enclosures to be monitored
' - create and send CMDs for getting enclosure data from MA
'--------------------------------------------------------------------
Function ReadCOMM2FileAndSendEnclosureCMDs()
Dim strIpAddress, strChSN, strSystemName, dnsName
Dim strBCCommunicationFile
Dim fileLoaded
Dim maxIndex
Dim enclosureCount
Dim BladeSystem_i
Dim controlReturn
enclosureCount = 0
'*** (try to) load XML file
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
'disable asynchronous loading
xmlDoc.async = False
'*** read the name of communication file in registry
strBCCommunicationFile = GetBladeSystemCommunicationFile()
'*** Now look for the COMM2 file:
fileLoaded = xmlDoc.load(strBCCommunicationFile)
If fileLoaded = false Then
enclosureCount = -1
Else
enclosureCount = CInt(GetNoOfBladeSystems(xmlDoc))
End If
If enclosureCount > 0 Then
maxIndex = cMAXINDEX
BladeSystem_i = 1
If enclosureCount > 0 Then
Do While BladeSystem_i <= enclosureCount
strChSN = GetXMLComponentsPropertyValue(xmlDoc, BladeSystem_i, "Chassis Information", "SysChassisSerialNumber",FILETYPE_MNGD_NODES)
If len(strChSN) > 0 Then
arrSysChasSerNo(BladeSystem_i) = strChSN
DebugOut("Server " & BladeSystem_i & ": SysChassisSerialNumber = " & strChSN)
End If
strIpAddress = GetXMLComponentsPropertyValue(xmlDoc, BladeSystem_i, "Chassis Information", "DiscoveryIpAddress", FILETYPE_MNGD_NODES)
If len(strIpAddress) > 0 Then
arrDiscoveryIp(BladeSystem_i) = strIpAddress
DebugOut("Server " & BladeSystem_i & ": DiscoveryIpAddress = " & strIpAddress)
Else
strIpAddress = GetXMLComponentsPropertyValue(xmlDoc, BladeSystem_i, "Chassis Information", "AgentIpAddress", FILETYPE_MNGD_NODES)
If len(strIpAddress) > 0 Then
arrDiscoveryIp(BladeSystem_i) = strIpAddress
DebugOut("Server " & BladeSystem_i & ": AgentIpAddress = " & strIpAddress)
End If
End If
dnsName = GetXMLComponentsPropertyValue(xmlDoc, BladeSystem_i, "Chassis Information", "DNSName", FILETYPE_MNGD_NODES)
If len(dnsName) > 0 Then
arrDnsName(BladeSystem_i) = dnsName
DebugOut("Server " & BladeSystem_i & ": DNS Name = " & dnsName)
Else
arrDnsName(BladeSystem_i) = "N/A"
DebugOut("Server " & BladeSystem_i & ": DNS Name = " & "N/A")
End If
strSystemName = GetXMLComponentsPropertyValue(xmlDoc, BladeSystem_i, "Chassis Information", "AgentName",FILETYPE_MNGD_NODES)
If (len(strSystemName) > 0) And (len(strSystemName) <= 14) Then
arrEnclosureName(BladeSystem_i) = strSystemName
DebugOut("Server " & BladeSystem_i & ": SystemName = " & strSystemName)
ElseIf len(strSystemName) > 14 Then
arrEnclosureName(BladeSystem_i) = Left(strSystemName,14)
DebugOut("Server " & BladeSystem_i & ": SystemName = " & strSystemName)
Else
arrEnclosureName(BladeSystem_i) = "N/A"
DebugOut("Server " & BladeSystem_i & ": SystemName = " & "N/A")
End If
If BladeSystem_i >= maxIndex Then
DebugOut("Maximum number of instances reached/exceeded! Abort system detection loop!")
Exit Do
End If
Loop
End If
End If '*** enclosureCount > 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Blade System Serial Number: " & SysChassisSerialNumber)
DebugOut("Blade System Serial Number (Property): " & PropertyArray(BC_CHASSISSERIALNUMBER))
End If
SysCtrlSystemName = PropertyArray(BC_BLADESYSTEMMODEL)
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Blade System System Name: " & SysCtrlSystemName)
End If
SysCtrlHousingType = PropertyArray(BC_BLADESYSTEMCHASSIS)
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Blade System Chassis Model: " & SysCtrlHousingType)
End If
If BCDebug AND BCDEBUG_MAX Then
DebugOut("BladeSystem IP Address: " & BCIpAddress)
End If
BCRackName = PropertyArray(BC_RACKNAME)
If BCDebug AND BCDEBUG_MAX Then
DebugOut("BladeSystem Rack Name: " & BCRackName)
End If
BCHttpPort = PropertyArray(BC_HTTP_PORT)
If BCDebug AND BCDEBUG_MAX Then
DebugOut("BladeSystem HTTP Port: " & BCHttpPort)
End If
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
If BCIpAddress <> "0.0.0.0" And BCIpAddress <> "255.255.255.255" And BCIpAddress <> "" And BCIpAddress <> "N/A" Then
'*** If IPv6 address than add parentheses
If InStr(1,BCIpAddress, ":", 1) > 0 Then
If BCHttpPort <> "" Then
WebInterfaceUrl = "http://" & "[" & BCIpAddress & "]" & ":" & BCHttpPort
Else
WebInterfaceUrl = "http://" & "[" & BCIpAddress & "]"
End If
Else
If BCHttpPort <> "" Then
WebInterfaceUrl = "http://" & BCIpAddress & ":" & BCHttpPort
Else
WebInterfaceUrl = "http://" & BCIpAddress
End If
End If
End If
If insideMP = true And Len(SysChassisSerialNumber) > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("***** Create Blade System Instance: '" & EnclosureName & "' *****")
End If
Set oInstBC = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']$")
Call oInstBC.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInstBC.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInstBC.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", EnclosureName)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/DnsName$", BCDnsName)
'*** only in the case that we really got data they are transferred to SCOM
if Len(PropertyArray(BC_CHASSISSERIALNUMBER)) > 0 Then
Call oInstBC.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.System']/Model$", SysCtrlHousingType)
Call oInstBC.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.System']/SerialNumber$", SysChassisSerialNumber)
Call oInstBC.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.System']/OperatingSystem$", "Embedded Linux")
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysCtrlSystemName$", SysCtrlSystemName)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysCtrlHousingType$", SysCtrlHousingType)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/IpAddress$", BCIpAddress)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/RackName$", BCRackName)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/WebInterfaceUrl$", WebInterfaceUrl)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/ConnectState$", "connected")
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysLocation$", PropertyArray(BC_SYSLOCATION))
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysContact$", PropertyArray(BC_SYSCONTACT))
Else
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/ConnectState$", "not connected")
End If
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Complete Data of Blade System Enclosure for OpsMgr")
End If
Call oDiscoveryData.AddInstance(oInstBC)
numEnclosure = 1
End If
If numEnclosure > 0 Then
Call GenerateDiscoveryCmdFileForAllComp(SysChassisSerialNumber, BCIpAddress)
controlReturn = MonitoringOnDemand()
ProcessEnclosures = array(True, numEnclosure)
Else
'*** We are finished here, do not wait for component responses
DebugOut("*** No valid data in enclosure response found")
Call SetComponentsDoneInDoneMatrix(BladeSystem_i)
ProcessEnclosures = array(True, 0)
End If
End Function
'--------------------------------------------------------------------
' Function ProcessMMBs():
' - processes receiving MMB COMM4 files
' - instantiates MMBs
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessMMBs(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfMMBUnitsMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
If NoOfMMBUnits > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* MMB Collection *********")
End If
InitNameStatusArray()
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("***** Check MMB Properties *****")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get MMB Component Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_MMB), index+1, MMB + MMB_MIN, MMB_MAX) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Display all MMB property values:")
For i=MMB_MIN to MMB_MAX
DebugOut(PropertyNameList(MMB + i) & "=" & PropertyArray(i))
Next
End If
If Len(PropertyArray(MMB_ID)) > 0 And Len(PropertyArray(MMB_PRODUCTNAME)) > 0 Then
' seen an empty field here - avoid crash of script ...
If PropertyArray(MMB_STATUS) = "" Then
PropertyArray(MMB_STATUS) = MMB_STATUS_UNKNOWN
DebugOut("WARNING: MMB " & Unit_i & " STATUS = UNKNOWN!")
End If
If BCDebug AND BCDEBUG_MAX Then
DebugOut("PropertyArray(MMB)=" & PropertyArray(MMB_STATUS))
End If
nStatus = CInt(PropertyArray(MMB_STATUS))
If (nStatus = MMB_STATUS_STANDBY) Then
componentNameArray(index) = PropertyArray(MMB_ID) & ": " & PropertyArray(MMB_PRODUCTNAME) & " (standby); "
Else
componentNameArray(index) = PropertyArray(MMB_ID) & ": " & PropertyArray(MMB_PRODUCTNAME) & "; "
End If
If Len(PropertyArray(MMB_MODELNAME)) > 0 And Len(PropertyArray(MMB_MANUFACTURE)) > 0 Then
componentInfoArray(index) = PropertyArray(MMB_ID) & ": " & PropertyArray(MMB_MODELNAME) & " / " & PropertyArray(MMB_MANUFACTURE) & "; "
End If
index = index + 1
End If
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of MMB Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_MMBCOMPONENT Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfMMBUnitsMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Number of monitored MMB Units = " & NoOfMMBUnitsMonitored)
End If
If NoOfMMBUnitsMonitored > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Create MMB Collection")
End If
If insideMP = true Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Create instance of MMB Subsystem")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.MMBSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MMB Units")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
End If
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Collect MMB Subsystem Data")
End If
For i=0 To index
If Len(componentNameArray(i)) > 0 Then
componentNames = componentNames & componentNameArray(i)
componentInfos = componentInfos & componentInfoArray(i)
End If
Next
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Discovered MMB Units: " & componentNames)
DebugOut("Discovered MMB Unit Infos: " & componentInfos)
End If
If insideMP = true Then
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.MMBSubsystem']/MgmtBladeUnits$", NoOfMMBUnitsMonitored)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/Devices$", componentNames)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/DevicesInfo$", componentInfos)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Add Instance of MMB Subsystem to OM Data Base")
End If
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
End If ' If NoOfMMBUnitsMonitored > 0
End If ' If NoOfMMBUnits > 0
ProcessMMBs = array(True, NoOfMMBUnitsMonitored)
End Function
'--------------------------------------------------------------------
' Function ProcessPSUs():
' - processes receiving PSU COMM4 files
' - instantiates PSUs
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessPSUs(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfPSUnitsMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
If NoOfPSUnits > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Power Supplies Collection *********")
End If
InitNameStatusArray()
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
index = 0
Unit_i = 1
NoOfPSUnitsMonitored = 0
NoOfUnits = NoOfPSUnits
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("******** Check Power Supply instances")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get Power Supply Component Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_POWERSUPPLYUNIT), Unit_i, PSU + PSU_MIN, PSU_MAX) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Display all PSU property values:")
For i=PSU_MIN to PSU_MAX
DebugOut(PropertyNameList(PSU + i) & "=" & PropertyArray(i))
Next
End If
If Len(PropertyArray(PSU_ID)) > 0 And Len(PropertyArray(PSU_PRODUCTNAME)) > 0 Then
If Len(PropertyArray(PSU_STATUS)) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("PropertyArray(PSU)=" & PropertyArray(PSU_STATUS))
End If
nStatus = CInt(PropertyArray(PSU_STATUS))
Else
DebugOut("WARNING: PSU " & Unit_i & " STATUS = UNKNOWN!")
nStatus = PSU_STATUS_UNKNOWN
End If
'*** WARNING: this same condition is used in MONITORING! Keep the same!
If (nStatus = PSU_STATUS_DUMMY) OR (nStatus = PSU_STATUS_FANMODULE) Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Status of Power Supply Unit " & Unit_i & _
" = " & PropertyArray(PSU_STATUS) & _
" -> Component instance will NOT be monitored")
End If
Else
componentNameArray(index) = PropertyArray(PSU_ID) & ":" & PropertyArray(PSU_PRODUCTNAME) & "; "
If Len(PropertyArray(PSU_MODELNAME)) > 0 And Len(PropertyArray(PSU_MANUFACTURER)) > 0 Then
componentInfoArray(index) = PropertyArray(PSU_ID) & ":" & PropertyArray(PSU_MODELNAME) & "/" & PropertyArray(PSU_MANUFACTURER) & "; "
End If
index = index + 1
End If
End If
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of PowerSupply Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_PSUCOMPONENT Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfPSUnitsMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Number of monitored Power Supply Units = " & NoOfPSUnitsMonitored)
End If
If NoOfPSUnitsMonitored > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Create Power Supplies Collection")
End If
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Create instance of Power Supply Subsystem")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.PowerSupplySubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Power Supply Units")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
End If
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Collect Power Supply Subsystem Data")
End If
For i=0 To index
If Len(componentNameArray(i)) > 0 Then
componentNames = componentNames & componentNameArray(i)
componentInfos = componentInfos & componentInfoArray(i)
End If
Next
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Discovered Power Supply Units: " & componentNames)
DebugOut("Discovered Power Supply Unit Infos: " & componentInfos)
End If
If insideMP = true Then
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.PowerSupplySubsystem']/PowerSupplyUnits$", NoOfPSUnitsMonitored)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/Devices$", componentNames)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/DevicesInfo$", componentInfos)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Add Instance of PowerSupply Subsystem to OM Data Base")
End If
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
End If
End If
ProcessPSUs = array(True, NoOfPSUnitsMonitored)
End Function
'--------------------------------------------------------------------
' Function ProcessFans():
' - processes receiving Fan COMM4 files
' - instantiates Fan System Units
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessFans(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfFanUnitsMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
If NoOfFanUnits > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********** Fan Unit Collection **********")
End If
InitNameStatusArray()
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
index = 0
Unit_i = 1
NoOfFanUnitsMonitored = 0
NoOfUnits = NoOfFanUnits
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********** Check Fan units")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get Fan Unit Component Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_FANUNIT), Unit_i, FAN + FAN_MIN, FAN_MAX) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Display all Fan property values:")
For i=FAN_MIN to FAN_MAX
DebugOut(PropertyNameList(FAN + i) & "=" & PropertyArray(i))
Next
End If
If Len(PropertyArray(FAN_ID)) > 0 And Len(PropertyArray(FAN_DESIGNATION)) > 0 Then
If Len(PropertyArray(FAN_STATUS)) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("PropertyArray(FAN)=" & PropertyArray(FAN_STATUS))
End If
nStatus = CInt(PropertyArray(FAN_STATUS))
Else
DebugOut("WARNING: FAN " & Unit_i & " STATUS = UNKNOWN!")
nStatus = FAN_STATUS_UNKNOWN
End If
componentNameArray(index) = PropertyArray(FAN_ID) & ":'" & PropertyArray(FAN_DESIGNATION) & "'; "
index = index + 1
End If
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of Fan Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_FANCOMPONENT Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfFanUnitsMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Monitored Fan units = " & NoOfFanUnitsMonitored)
End If
If NoOfFanUnitsMonitored > 0 Then
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Create instance of Fan Subsystem")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.FanSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Fan Units")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
End If
For i=0 To index
If Len(componentNameArray(i)) > 0 Then
componentNames = componentNames & componentNameArray(i)
componentInfos = componentInfos & componentInfoArray(i)
End If
Next
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Discovered Fan Units: " & componentNames)
DebugOut("Discovered Fan Unit Infos: " & componentInfos)
End If
If Len(componentNames) > 2047 Then
componentNames = UCase(Left(componentNames, 2040)) & " ..."
End If
If Len(componentInfos) > 2047 Then
componentInfos = UCase(Left(componentInfos, 2040)) & " ..."
End If
If insideMP = true Then
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.FanSubsystem']/FanUnits$", NoOfFanUnitsMonitored)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/Devices$", componentNames)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/DevicesInfo$", componentInfos)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Add Instance of Fan Subsystem to OM Data Base")
End If
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
End If
End If
ProcessFans = array(True, NoOfFanUnitsMonitored)
End Function
'--------------------------------------------------------------------
' Function ProcessTempSensors():
' - processes receiving TempSensor COMM4 files
' - instantiates TempSensor Units
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessTempSensors(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfTempSensorUnitsMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
If NoOfTempSensorUnits > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********** Temp. Sensor Collection **********")
End If
InitNameStatusArray()
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
index = 0
Unit_i = 1
NoOfTempSensorUnitsMonitored = 0
NoOfUnits = NoOfTempSensorUnits
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Check Temperature Sensor instances")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get Temperature Sensor Component Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_TEMPSENSORUNIT), Unit_i, TSU + TSU_MIN, TSU_MAX) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Display all Temp Sensor property values:")
For i=TSU_MIN to TSU_MAX
DebugOut(PropertyNameList(TSU + i) & "=" & PropertyArray(i))
Next
End If
If BCDebug AND BCDEBUG_MIN Then
DebugOut("******** Create Temperature Sensor Collection")
End If
If Len(PropertyArray(TSU_ID)) > 0 And Len(PropertyArray(TSU_DESIGNATION)) > 0 Then
If Len(PropertyArray(TSU_STATUS)) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("PropertyArray(TSU)=" & PropertyArray(TSU_STATUS))
End If
nStatus = CInt(PropertyArray(TSU_STATUS))
Else
DebugOut("WARNING: TSU " & Unit_i & " STATUS = UNKNOWN!")
nStatus = TSU_STATUS_UNKNOWN
End If
componentNameArray(index) = PropertyArray(TSU_ID) & ":'" & PropertyArray(TSU_DESIGNATION) & "'; "
If Len(PropertyArray(TSU_CURRENTVALUE)) > 0 Then
componentInfoArray(index) = PropertyArray(TSU_CURRENTVALUE) & "; "
End If
index = index + 1
End If
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of Temp Sensor Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_TSUCOMPONENT Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfTempSensorUnitsMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Number of monitored Temp. Sensor Units = " & NoOfTempSensorUnitsMonitored)
End If
If NoOfTempSensorUnitsMonitored > 0 Then
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Create instance of Temperature Sensor Subsystem")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.TempSensorSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Temperature Sensors")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
End If
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Collect Temp. Sensor Subsystem Data")
End If
For i=0 To index
If Len(componentNameArray(i)) > 0 Then
componentNames = componentNames & componentNameArray(i)
End If
Next
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Discovered Temp. Sensor Units: " & componentNames)
DebugOut("Discovered Temp. Sensor Unit Infos: " & componentInfos)
End If
If Len(componentNames) > 2047 Then
componentNames = UCase(Left(componentNames, 2040)) & " ..."
End If
If Len(componentInfos) > 2047 Then
componentInfos = UCase(Left(componentInfos, 2040)) & " ..."
End If
If insideMP = true Then
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.TempSensorSubsystem']/TempSensors$", NoOfTempSensorUnitsMonitored)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/Devices$", componentNames)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/DevicesInfo$", componentInfos)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Add Instance of Temp. Sensor Subsystem to OM Data Base")
End If
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
'--------------------------------------------------------------------
' Function ProcessCCUs():
' - processes receiving CCU COMM4 files
' - instantiates CCUss
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessCCUs(BladeSystem_i, SysChassisSerialNumber, compNum)
Dim NoOfConnectUnitsMonitored
Dim Unit_i
Dim NoOfUnits
Dim i, j
Dim subCompNum
Dim strValue
Dim BCIpAddress, EnclosureName
Dim ccuIndex
Dim foundUnits
Dim ccuComponentNameArray(8)
Dim ccuComponentInfoArray(8)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
For subCompNum = 0 to BC_SUBCOMP_CCU_MAX
If NoOfConnectUnits > 0 Then
foundUnits = 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Connection Unit Collection *********")
End If
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Check Connection Unit instances")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get Connection Unit Component Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(compNum + subCompNum), Unit_i, CU + CU_MIN, CU_MAX) > 0 Then
foundUnits = foundUnits + 1
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Display all Connection Unit property values:")
For i=CU_MIN to CU_MAX
DebugOut(PropertyNameList(CU + i) & "=" & PropertyArray(i))
Next
End If
'*** check if component is available
If Len(PropertyArray(CU_ID)) > 0 And Len(PropertyArray(CU_PRODUCTNAME)) > 0 Then
On Error Resume Next
ccuIndex = int(PropertyArray(CU_ID))
On Error Goto 0
'*** check if component is enabled
If Len(PropertyArray(CU_STATUS)) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("PropertyArray(CU)=" & PropertyArray(CU_STATUS))
End If
nStatus = CInt(PropertyArray(CU_STATUS))
Else
DebugOut("WARNING: CU " & Unit_i & " STATUS = UNKNOWN!")
nStatus = CU_STATUS_UNKNOWN
End If
ccuComponentNameArray(ccuIndex) = PropertyArray(CU_ID) & ":'" & PropertyArray(CU_PRODUCTNAME) & "'; "
If Len(PropertyArray(CU_ADMINURL)) > 0 Then
ccuComponentInfoArray(ccuIndex) = PropertyArray(CU_ID) & ":'" & PropertyArray(CU_ADMINURL) & " ; "
End If
End If
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of Connection Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_CUCOMPONENT Then
Unit_i = 0
NoOfUnits = 0
End If
For i = 1 To 8
If (Len(ccuComponentNameArray(i)) > 0) Or (Len(ccuComponentInfoArray(i)) > 0) Then
NoOfConnectUnitsMonitored = NoOfConnectUnitsMonitored + 1
componentNames = componentNames & ccuComponentNameArray(i)
componentInfos = componentInfos & ccuComponentInfoArray(i)
End If
Next
If NoOfConnectUnitsMonitored > 0 Then
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Create instance of Connection Unit Subsystem")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.ConnectUnitSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Connection Units")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
End If
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Collect Connection Units Data")
DebugOut("Discovered Connection Units: " & componentNames)
DebugOut("Discovered Connection Units Infos: " & componentInfos)
End If
If insideMP = true Then
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.ConnectUnitSubsystem']/ConnectUnits$", NoOfConnectUnitsMonitored)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/Devices$", componentNames)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/DevicesInfo$", componentInfos)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Add Instance of Connection Units Subsystem to OM Data Base")
End If
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
End If
ProcessCCUs = array(True, foundUnits)
End Function
'--------------------------------------------------------------------
' Function ProcessKVMs():
' - processes receiving KVM COMM4 files
' - instantiates KVMs
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessKVMs(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfKVMUnitsMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
If NoOfKVMUnits > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* KVM Unit Collection *********")
End If
InitNameStatusArray()
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
Unit_i = 1
index = 0
NoOfKVMUnitsMonitored = 0
NoOfUnits = NoOfKVMUnits
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Check KVM instances")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get KVM Unit Component Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_KVMUNIT), Unit_i, KVM + KVM_MIN, KVM_MAX) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Display all KVM Unit property values:")
For i=KVM_MIN to KVM_MAX
DebugOut(PropertyNameList(KVM + i) & "=" & PropertyArray(i))
Next
End If
If Len(PropertyArray(KVM_ID)) > 0 And Len(PropertyArray(KVM_PRODUCTNAME)) > 0 Then
'*** check if component is enabled
If Len(PropertyArray(KVM_STATUS)) > 0 Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("PropertyArray(KVM)=" & PropertyArray(KVM_STATUS))
End If
nStatus = CInt(PropertyArray(KVM_STATUS))
Else
DebugOut("WARNING: KVM " & Unit_i & " STATUS = UNKNOWN!")
nStatus = KVM_STATUS_UNKNOWN
End If
componentNameArray(index) = PropertyArray(KVM_ID) & ":'" & PropertyArray(KVM_PRODUCTNAME) & "'; "
If Len(PropertyArray(KVM_ADMINURL)) > 0 Then
componentInfoArray(index) = PropertyArray(KVM_ADMINURL) & " ; "
End If
index = index + 1
End If
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of KVM Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_KVMCOMPONENT Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfKVMUnitsMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Number of monitored KVM Units = " & NoOfKVMUnitsMonitored)
End If
If NoOfKVMUnitsMonitored > 0 Then
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Create instance of KVM Unit Subsystem")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.KVMUnitSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "KVM Units")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
End If
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Collect KVM Units Data")
End If
For i=0 To index
If Len(componentNameArray(i)) > 0 Then
componentNames = componentNames & componentNameArray(i)
componentInfos = componentInfos & componentInfoArray(i)
End If
Next
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Discovered Connection Units: " & componentNames)
DebugOut("Discovered Connection Units Infos: " & componentInfos)
End If
If insideMP = true Then
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.KVMUnitSubsystem']/KVMUnits$", NoOfKVMUnitsMonitored)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/Devices$", componentNames)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/DevicesInfo$", componentInfos)
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Add Instance of KVM Units Subsystem to OM Data Base")
End If
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
'*** store KVM ID in config file
arrKVMCfg(BladeSystem_i) = "1"
End If
End If
ProcessKVMs = array(True, NoOfKVMUnitsMonitored)
End Function
'--------------------------------------------------------------------
' Function ProcessServerBlades(BladeSystem_i):
' - processes receiving Serverblades COMM4 files
' - instantiates Serverblades
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessServerBlades(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfServerBladesMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
Dim ViomStr
If NoOfServerBlades > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Server Blade Collection *********")
End If
InitNameStatusArray()
arrServerBladesCfg(BladeSystem_i) = ""
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
Unit_i = 1
index = 0
NoOfServerBladesMonitored = 0
NoOfUnits = NoOfServerBlades
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Check ServerBlade instances")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get Server Blade Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_SERVERBLADE), Unit_i, SRV + SERVER_MIN, SERVER_MAX) > 0 Then
If Len(PropertyArray(SERVER_ID)) > 0 And Len(PropertyArray(SERVER_CUSTOMERPRODUCTNAME)) > 0 Then
'*** check if component is enabled
If Len(PropertyArray(SERVER_STATUS)) > 0 Then
nStatus = CInt(PropertyArray(SERVER_STATUS))
Else
DebugOut("WARNING: Server " & Unit_i & " STATUS = UNKNOWN!")
nStatus = SERVER_STATUS_UNKNOWN
End If
ViomStr = "N/A"
On Error Resume Next
If Len(PropertyArray(SERVER_VIOMSETTINGSTATUS)) > 0 Then
ViomStr = arrViomSettingTab(PropertyArray(SERVER_VIOMSETTINGSTATUS))
End If
On Error Goto 0
'*** Server is monitored
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Create instance of Serverblade")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.ServerBlade']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
'*** store blade ID in config file
arrServerBladesCfg(BladeSystem_i) = arrServerBladesCfg(BladeSystem_i) & PropertyArray(SERVER_MIN + SERVER_ID) & ", "
index = index + 1
End If '*** Len(PropertyArray(SERVER_ID)) > 0 And Len(PropertyArray(SERVER_PRODUCTNAME)) > 0
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of SRV Unit: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_SERVERBLADES Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfServerBladesMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Number of monitored Serverblades = " & NoOfServerBladesMonitored)
End If
End If
'--------------------------------------------------------------------
' Function ProcessStorageBlades(BladeSystem_i):
' - processes receiving Storageblades COMM4 files
' - instantiates Storageblades
' Note: it is assumed that xmlDoc is already loaded
'--------------------------------------------------------------------
Function ProcessStorageBlades(BladeSystem_i, SysChassisSerialNumber)
Dim NoOfStorageBladesMonitored
Dim Unit_i
Dim NoOfUnits
Dim index
Dim i, j
Dim strValue
Dim BCIpAddress, EnclosureName
If NoOfStorageBlades > 0 Then
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Storage Blade Collection *********")
End If
InitNameStatusArray()
BCIpAddress = arrDiscoveryIp(BladeSystem_i)
arrStorageBladesCfg(BladeSystem_i) = ""
EnclosureName = arrEnclosureName(BladeSystem_i) & "_" & SysChassisSerialNumber
Unit_i = 1
index = 0
NoOfStorageBladesMonitored = 0
NoOfUnits = NoOfStorageBlades
Do While NoOfUnits > 0
If BCDebug AND BCDEBUG_MIN Then
DebugOut("********* Check StorageBlade instances")
End If
InitPropertyArray()
nStatus = 0
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Get Storage Blade Properties of Blade System " & BladeSystem_i)
End If
If GetBCComponent_Properties(BladeSystem_i, BC_ComponentsGroupList(BC_COMP_STORAGEBLADE), Unit_i, STR + STORAGE_MIN, STORAGE_MAX) > 0 Then
If Len(PropertyArray(STORAGE_ID)) > 0 And Len(PropertyArray(STORAGE_CUSTOMERPRODUCTNAME)) > 0 Then
'*** check if component is enabled
If Len(PropertyArray(STORAGE_STATUS)) > 0 Then
nStatus = CInt(PropertyArray(STORAGE_STATUS))
Else
DebugOut("WARNING: Storage " & Unit_i & " STATUS = UNKNOWN!")
nStatus = STORAGE_STATUS_UNKNOWN
End If
'*** Storage is monitored
If insideMP = true Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("*** Create instance of Storageblade")
End If
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.StorageBlade']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Storage Blade " + PropertyArray(STORAGE_MIN + STORAGE_ID))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BladeId$", PropertyArray(STORAGE_MIN + STORAGE_ID))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BladeType$", "StorageBlade")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/IpAddress$", BCIpAddress)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BladeSerialnumber$", PropertyArray(STORAGE_MIN + STORAGE_SERIALNUMBER))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/ProductName$", PropertyArray(STORAGE_MIN + STORAGE_CUSTOMERPRODUCTNAME))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/ModelName$", PropertyArray(STORAGE_MIN + STORAGE_ID))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/HardwareVersion$", PropertyArray(STORAGE_MIN + STORAGE_HWVERSION))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BIOSVersion$", PropertyArray(STORAGE_MIN + STORAGE_BIOSVERSION))
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/AssetTag$", "N/A")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BladeSystemName$", EnclosureName)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
'*** store blade ID in config file
arrStorageBladesCfg(BladeSystem_i) = arrStorageBladesCfg(BladeSystem_i) & PropertyArray(SERVER_MIN + SERVER_ID) & ", "
index = index + 1
End If '*** Len(PropertyArray(STORAGE_ID)) > 0 And Len(PropertyArray(STORAGE_PRODUCTNAME)) > 0
NoOfUnits = NoOfUnits - 1
Else
If BCDebug AND BCDEBUG_MAX Then
DebugOut("No Properties of Storage Blade: " & Unit_i)
End If
End If
Unit_i = Unit_i + 1
If Unit_i > MAX_STORAGEBLADES Then
Unit_i = 0
NoOfUnits = 0
End If
Loop
NoOfStorageBladesMonitored = index
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Number of monitored Storageblades = " & NoOfStorageBladesMonitored)
End If
End If
'--------------------------------------------------------------------
' Sub PostProcessBladeDevices()
'--------------------------------------------------------------------
Sub PostProcessBladeDevicesAndKVM()
Dim i
For i = 1 To NoOfBladeSystem
If (Len(arrServerBladesCfg(i)) > 0) Or (Len(arrStorageBladesCfg(i)) > 0) Then
Call GenerateBladeDeviceCfgFile(arrSysChasSerNo(i), arrServerBladesCfg(i), arrStorageBladesCfg(i), arrKVMCfg(i))
End If
Next
End Sub
'--------------------------------------------------------------------
' Sub PostProcessMissingComponents()
'--------------------------------------------------------------------
Sub PostProcessMissingComponents()
Dim i, j
Dim NoOfConnectUnitsMonitored
Dim BCIpAddress, EnclosureName, SysChassisSerialNumber
Dim strEventLogMsg
Dim enclosureInError, componentOK
Dim CommunicationErrorFailedComp, TimeoutErrorFailedComp
Dim strBladeId
Dim bladeIdStr, bladeIdVec
DebugOut("Start PostProcessMissingComponents()")
For i = 1 To NoOfBladeSystem
NoOfConnectUnitsMonitored = 0
componentNames = "Product Name / Model Name: "
componentInfos = "Admin URLs: "
SysChassisSerialNumber = arrSysChasSerNo(i)
'*** check if the whole enclosure is affected
componentOK = false
For j = 1 To COMPLIST_MAX '*** starting from 1: enclosure is excluded
componentOK = componentOK Or responseMatrix(i,j)
Next
'*** not a single component OK?
enclosureInError = not componentOK
If enclosureInError Then
strEventLogMsg = "Communication failure: enclosure not reachable."
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs/" & SysChassisSerialNumber, 406, ERROR_EVENT, strEventLogMsg)
End If
If (arrDoneMatrix(i,j) = false) Or (responseMatrix(i,j) = false) Then
'*** something to do
ErrorsDetected = true
EnclosureName = arrEnclosureName(i) & "_" & SysChassisSerialNumber
BCIpAddress = arrDiscoveryIp(i)
If j = COMPLIST_ENCLOSURE Then
'*** Add only properties which are needed for creating the instance
Set oInstBC = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']$")
Call oInstBC.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInstBC.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInstBC.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", EnclosureName)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInstBC.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/ConnectState$", "not connected")
Call oDiscoveryData.AddInstance(oInstBC)
Set oInstBC = Nothing
If (insideMP = true) And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "enclosure, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "enclosure, "
End If
End If
'*** If enclosure is missing then other components cannot exist, so skip component handling
Else
If j = COMPLIST_MMBS Then
'*** Add only properties which are needed for creating the instance
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.MMBSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "MMB Units")
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", "N/A")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.MMBSubsystem']/MgmtBladeUnits$", "0")
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "MMB, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "MMB, "
End If
End If
end If
If j = COMPLIST_POWERSUPPLIES Then
'*** Add only properties which are needed for creating the instance
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.PowerSupplySubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Power Supply Units")
'*** Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", "N/A")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.PowerSupplySubsystem']/PowerSupplyUnits$", 0)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "power supply, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "power supply, "
End If
End If
end If
If j = COMPLIST_FANS Then
'*** Add only properties which are needed for creating the instance
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.FanSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Fan Units")
'*** Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", "N/A")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.FanSubsystem']/FanUnits$", 0)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "fans, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "fans, "
End If
End If
end If
If j = COMPLIST_TEMPSENSORS Then
'*** Add only properties which are needed for creating the instance
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.TempSensorSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Temperature Sensors")
'*** Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", "N/A")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.TempSensorSubsystem']/TempSensors$", 0)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "temperature sensors, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "temperature sensors, "
End If
End If
end If
If (j = COMPLIST_CONNECTUNITS) Then
'*** Add only properties which are needed for creating the instance
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.ConnectUnitSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "Connection Units")
'*** Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.HealthCollection']/ServerName$", EnclosureName)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/IpAddress$", "N/A")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
'*** Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.ConnectUnitSubsystem']/ConnectUnits$", 0)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "CCU, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "CCU, "
End If
End If
end If
If j = COMPLIST_KVMUNITS Then
If Not IsFileOutOfDate(SysChassisSerialNumber, ComponentsList(COMPLIST_KVMUNITS), FILETYPE_MON_RESPONSE, MONITORING_TIMEOUT) Then
bladeIdStr = GetBladeDeviceCfgValue(SysChassisSerialNumber, "Enclosure", "KVM")
If Len(bladeIdStr) > 0 Then
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.KVMUnitSubsystem']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "KVM Units")
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.HealthCollection']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
End If
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "KVM, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "KVM, "
End If
End If
end If
If j = COMPLIST_SERVERBLADES Then
'*** Check if there are instances for server blades for this enclosure
If Not IsFileOutOfDate(SysChassisSerialNumber, ComponentsList(COMPLIST_SERVERBLADES), FILETYPE_MON_RESPONSE, MONITORING_TIMEOUT) Then
bladeIdStr = GetBladeDeviceCfgValue(SysChassisSerialNumber, "Enclosure", "ServerBlades")
bladeIdVec = Split(bladeIdStr,", ")
For Each strBladeId In bladeIdVec
If Len(strBladeId) > 0 Then
'*** create instance and set key properties
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.ServerBlade']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BladeId$", strBladeId)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
Next
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "server blades, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "server blades, "
End If
End If
End If
End If
If j = COMPLIST_STORAGEBLADES Then
'*** Check if there are instances for storage blades for this enclosure
If Not IsFileOutOfDate(SysChassisSerialNumber, ComponentsList(COMPLIST_STORAGEBLADES), FILETYPE_MON_RESPONSE, MONITORING_TIMEOUT) Then
bladeIdStr = GetBladeDeviceCfgValue(SysChassisSerialNumber, "Enclosure", "StorageBlades")
bladeIdVec = Split(bladeIdStr,", ")
For Each strBladeId In bladeIdVec
If Len(strBladeId) > 0 Then
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.StorageBlade']$")
Call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='FTSLIB!Fujitsu.ServerView.MonitorService']/PrincipalName$", PrincipalName)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/SysChassisSerialNumber$", SysChassisSerialNumber)
Call oInst.AddProperty("$MPElement[Name='Fujitsu.PRIMERGY.BladeSystem.Enclosure.BladeDevice']/BladeId$", strBladeId)
Call oDiscoveryData.AddInstance(oInst)
Set oInst = Nothing
End If
Next
If insideMP = true And (enclosureInError = false) Then
If arrDoneMatrix(i,j) = false Then
CommunicationErrorFailedComp = CommunicationErrorFailedComp & "storage blades, "
Else
TimeoutErrorFailedComp = TimeoutErrorFailedComp & "storage blades, "
End If
End If
End If
End If
End If
End If
Next
If Len(CommunicationErrorFailedComp) > 0 Then
strEventLogMsg = "Communication error while discovery: no information for the following component(s): " & CommunicationErrorFailedComp
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs/" & SysChassisSerialNumber, 417, ERROR_EVENT, strEventLogMsg)
DebugOut(strEventLogMsg & SysChassisSerialNumber)
End If
If Len(TimeoutErrorFailedComp) > 0 Then
strEventLogMsg = "Timeout failure while discovery: no information for the following component(s): " & TimeoutErrorFailedComp
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs/" & SysChassisSerialNumber, 427, ERROR_EVENT, strEventLogMsg)
DebugOut(strEventLogMsg & SysChassisSerialNumber)
End If
Next
End Sub
'--------------------------------------------------------------------
' Function CheckCommunicationFile(FilePath):
'--------------------------------------------------------------------
Function CheckCommunicationFile(FilePath)
CONST ForReading = 1
Dim FSO, hFile, fileFound
fileFound = false
On Error Resume Next
'*** create FSO-Object
Set FSO = CreateObject("Scripting.FileSystemObject")
'*** open file for reading
If (FSO.FileExists(FilePath)) Then
'*** open file for reading
Set hFile = FSO.OpenTextFile(FilePath, ForReading)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("hFile: [" & hFile & "]")
End If
If Not IsNull(hFile) Then
fileFound = true
hFile.close
End If
End If
On Error Goto 0
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Communication file '" & FilePath & "' found: " & fileFound)
End If
CheckCommunicationFile = fileFound
End Function
'--------------------------------------------------------------------
' Function IsMonitorAgentRunning():
'--------------------------------------------------------------------
Function IsMonitorAgentRunning()
CONST TargetComputer = "."
Dim Services, Service, AgentState, ServiceFound
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Check running Monitor Agent " & BLADESYSTEMMONITORSERVICE)
End If
'### On Error Resume Next
Set Services = GetObject("winmgmts:\\" & TargetComputer & "\root\cimv2").ExecQuery("SELECT * FROM Win32_Service")
AgentState = false
ServiceFound = false
For Each Service in Services
If Service.Name = BLADESYSTEMMONITORSERVICE Then
ServiceFound = true
If BCDebug AND BCDEBUG_FUNC Then
If BCDebug AND BCDEBUG_MAX Then
DebugOut("Service Name: " & Service.Name)
DebugOut("Service DisplayName: " & Service.DisplayName)
DebugOut("Service State: " & Service.State)
DebugOut("Service Status: " & Service.Status)
DebugOut("Service Started: " & Service.Started)
End If
End If
If Service.State = "Running" Then
AgentState = true
End If
Exit For
End If
Next
'### On Error Goto 0
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Service found = " & ServiceFound)
DebugOut("Agent State = " & AgentState)
End If
IsMonitorAgentRunning = AgentState
End Function
'--------------------------------------------------------------------
' Function ProcessEnclosures():
'--------------------------------------------------------------------
'--------------------------------------------------------------------
' Function GetBaseRegistryValue(strName):
'--------------------------------------------------------------------
'--------------------------------------------------------------------
' Function GetBCRegistryValue(strKeyName, strValueName):
'--------------------------------------------------------------------
Function GetBCRegistryValue(strKeyName, strValueName)
Dim regValue, regKey, strValue
'*** strValue = ""
If IsEmpty(Registry) Then
Set Registry = GetObject("winmgmts:{impersonationLevel=impersonate}\\.\root\default:StdRegProv")
End If
If IsEmpty(Registry) Or Err.Number <> 0 Then
DebugOut("#############")
DebugOut("############# Cannot access registry via WMI!")
DebugOut("#############")
Else
regKey = BL_REG_PATH & "\" & strKeyName
regValue = strValueName
Registry.GetStringValue HKEY_LOCAL_MACHINE, regKey, regValue, strValue
End If
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("GetBCRegistryValue(" & strValueName & ") = " & strValue)
End If
GetBCRegistryValue = strValue
End Function
'--------------------------------------------------------------------
' Function GetBladeSystemCommunicationFile():
'--------------------------------------------------------------------
Function GetBladeSystemCommunicationFile()
Dim fileName, filePath, strBladeSystemCommFile
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("GetBladeSystemCommunicationFile()")
End If
If simulationMode = true Then
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Ini file path=[" & strLogIniFileNameAbs & "]")
DebugOut("Communication file in simulation mode:")
End If
fileName = GetOpenIniValue(strLogIniFileNameAbs, INISEC_COMMUNICATIONFILE, KEY_NAME)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Path=[" & filePath & "], Name=[" & fileName & "]")
End If
End If
'*** use normal communication file
If Len(filePath) = 0 Then
filePath = GetMonSvrRegistryValue(REGKEY_MS_COMMFILEPATH)
End If
If Len(fileName) = 0 Then
fileName = GetMonSvrRegistryValue(REGKEY_MS_MANAGEDFILENAME)
End If
If Len(filePath) > 0 And Len(fileName) > 0 Then
strBladeSystemCommFile = filePath & "\" & fileName
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Communication file path: " & strBladeSystemCommFile)
End If
Else
strBladeSystemCommFile = ABSBCCOMMFILE
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Communication file by default: " & strBladeSystemCommFile)
End If
End If
'--------------------------------------------------------------------
' Function GetBladeSystemCommunicationFilePath():
'--------------------------------------------------------------------
Function GetBladeSystemCommunicationFilePath()
Dim filePath, strBladeSystemCommFilePath
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("GetBladeSystemCommunicationFilePath()")
End If
filePath = ""
strBladeSystemCommFilePath = ""
If simulationMode = true Then
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Ini file path=[" & strLogIniFileNameAbs & "]")
DebugOut("Communication file in simulation mode:")
End If
filePath = GetOpenIniValue(strLogIniFileNameAbs, INISEC_COMMUNICATIONFILE, KEY_DIRECTORY)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Path=[" & filePath & "]")
End If
End If
'*** use normal communication file
If Len(filePath) = 0 Then
filePath = GetMonSvrRegistryValue(REGKEY_MS_COMMFILEPATH)
End If
If Len(filePath) > 0 Then
strBladeSystemCommFilePath = filePath
Else
' *** if we do not have the communication file path, we can do nothing - but abort!
strEventLogMsg = "Could not determine communication file path - script ends here!"
If insideMP = true Then
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs/", 406, ERROR_EVENT, strEventLogMsg)
End If
DebugOut(strEventLogMsg)
Wscript.Quit(-1)
End If
If BCDebug AND BCDEBUG_MIN Then
DebugOut("Communication file path = " & strBladeSystemCommFilePath)
End If
'--------------------------------------------------------------------
' Sub InitPropertyArray():
'--------------------------------------------------------------------
Sub InitPropertyArray()
'**** property array for the properties of ONE component instance
PropertyArray = Array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "")
End Sub
'--------------------------------------------------------------------
' Sub InitNameStatusArray():
'--------------------------------------------------------------------
Sub InitNameStatusArray()
'*** 102 (cMAXINDEX) elements in every array available ***
'--------------------------------------------------------------------
' Function GetBC_Properties(BC_number):
'--------------------------------------------------------------------
Function GetBC_Properties(BC_number)
Dim strComponent, strValueKey, strValue, count, index
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("BC Key Value: " & strValueKey & " = " & strValue)
End If
If Len(strValue) > 0 And strValue <> "-1" Then
For index=BC_MIN To BC_MAX
strValueKey = BC_PropertyNameList(index)
strValue = GetXMLComponentsPropertyValue(xmlDoc, BC_number, strComponent, strValueKey, FILETYPE_RESP)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("BC_Key value: " & strValueKey & " = " & strValue)
End If
If Len(strValue) > 0 And strValue <> "-1" Then
PropertyArray(index) = strValue
count = count + 1
End If
Next
End If
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No. of BC keys with value: " & count)
End If
GetBC_Properties = CInt(count)
End Function
'------------------------------------------------------------------------------------------------------------------
' Function GetBCComponent_Properties(BC_Number, ComponentName, ComponentNo, key_property_index, property_maxIndex):
'------------------------------------------------------------------------------------------------------------------
Function GetBCComponent_Properties(BC_Number, ComponentName, ComponentNo, key_property_index, property_maxIndex)
Dim strComponent, strValueKey, strValue, count, index, component_index
count = 0
component_index = key_property_index
strComponent = ComponentName & " " & ComponentNo
strValueKey = PropertyNameList(component_index)
'check the 1st property of component
strValue = GetXMLComponentsPropertyValue(xmlDoc, BC_number, strComponent, strValueKey, FILETYPE_RESP)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Component Key Value: " & strValueKey & " = " & strValue)
End If
If Len(strValue) > 0 And strValue <> "-1" Then
For index=0 To property_maxIndex
strValueKey = PropertyNameList(component_index + index)
strValue = GetXMLComponentsPropertyValue(xmlDoc, BC_number, strComponent, strValueKey, FILETYPE_RESP )
If BCDebug AND BCDEBUG_FUNC Then
DebugOut(strValueKey & " = " & strValue)
End If
If Len(strValue) > 0 And strValue <> "-1" Then
'*** save property value in array
PropertyArray(index) = strValue
count = count + 1
End If
Next
End If
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No. of keys with value: " & count)
End If
GetBCComponent_Properties = count
End Function
'--------------------------------------------------------------------
' Sub GetLogFileIni(FilePathName, Section):
'--------------------------------------------------------------------
Sub GetLogFileIni(FilePathName, Section)
Dim val
val = GetOpenIniValue(FilePathName, Section, INIKEY_DEBUGMODE)
If val = "yes" OR val = "YES" OR val = "1" Then
DebugMode = true
DebugFile = true
BCDebug = GetOpenIniValue(FilePathName, Section, INIKEY_DEBUGLEVEL)
End If
End Sub
'--------------------------------------------------------------------
' Function CheckSimulationMode(FilePathName)
'--------------------------------------------------------------------
Function CheckSimulationMode(FilePathName)
Dim simMode, iniVal
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("CheckSimulationMode(" & FilePathName & ")")
End If
simMode = false
iniVal = UCase(GetOpenIniValue(FilePathName, INISEC_COMMUNICATIONFILE, KEY_SIMULATION))
If iniVal = "YES" Then
simMode = true
DebugOut("*** Simulation mode is active ***")
End If
'### On Error Goto 0
CheckSimulationMode = simMode
End Function
'--------------------------------------------------------------------
' Function GetNoOfBladeSystems(xmlDoc)
'--------------------------------------------------------------------
Function GetNoOfBladeSystems(xmlDoc)
Dim xmlDocElement, xmlServerNode, xmlNoOfSystems, xmlServerComponentsNodes
Dim NoOfBladeSystems
Set xmlDocElement = xmlDoc.documentElement
Set xmlServerNode = xmlDoc.selectNodes("*/Server")
'Set xmlServerComponentsNodes = xmlDoc.selectNodes("*/Server/Components")
Set xmlServerComponentsNodes = xmlDoc.selectNodes("*/Server/Group/Components")
'Read element "NoOfSystems"
Set xmlNoOfSystems = xmlDoc.selectNodes("*/NoOfServers")
NoOfBladeSystems = xmlNoOfSystems.item(0).Text
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No of Blade Systems: " & NoOfBladeSystems)
End If
GetNoOfBladeSystems = NoOfBladeSystems
End Function
'------------------------------------------------------------------------------------------
' Function GetXMLComponentsPropertyValue(xmlDoc, nServerNo, strComponent, strPropertyName, fileType)
'------------------------------------------------------------------------------------------
Function GetXMLComponentsPropertyValue(xmlDoc, nServerNo, strComponent, strPropertyName, fileType)
Dim xmlDocElement, xmlServerNode, xmlServerGroupNode, xmlNoOfSystems, xmlServerComponentsNodes
Dim xmlNameOfComponent, xmlComponentNode, xmlElementListNode
Dim i, j, k, l, xmlName, xmlValue
Dim varPropertyValue
Dim bValueFound, bValueInComponentNode
Dim NodeName, ServerNumber
Dim NoOfBladeSystems
Dim strCompare
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Input args of GetXMLComponentsPropertyValue: " & nServerNo & "/" & strComponent & "/" & strPropertyName)
End If
varPropertyValue = ""
Set xmlDocElement = xmlDoc.documentElement
Set xmlServerNode = xmlDoc.selectNodes("*/Server")
Set xmlServerComponentsNodes = xmlDoc.selectNodes("*/Server/Components")
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No of nodes in Doc: " & xmlDocElement.childNodes.length)
End If
'Read element "NoOfSystems"
'Set xmlNoOfSystems = xmlDoc.selectNodes("*/NoOfServers")
'NoOfBladeSystems = xmlNoOfSystems.item(0).Text
' This was changed. We use 1 file for 1 system. Thus:
NoOfBladeSystems = 1
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No of Blade Systems: " & NoOfBladeSystems)
End If
bValueFound = false
bValueInComponentNode = true
For i=0 To xmlDocElement.childNodes.length-1
NodeName = xmlDocElement.childNodes.item(i).nodeName
'*** We have different evaluations according file types
If fileType = FILETYPE_MNGD_NODES Then
ServerNumber = xmlDocElement.childNodes.item(i).getAttribute("Number")
End If
If BCDebug AND BCDEBUG_FUNC Then
If NodeName = "Server" Then
DebugOut("Blade System No.: " & ServerNumber)
End If
End If
If NodeName = "Server" Then
If (fileType = FILETYPE_MNGD_NODES And ((nServerNo = ServerNumber) Or (nServerNo = CInt(ServerNumber)))) Or fileType <> FILETYPE_MNGD_NODES Then
Set xmlServerNode = xmlDocElement.childNodes.Item(i)
For j=0 To xmlServerNode.childNodes.length-1
If xmlServerNode.childNodes.item(j).nodeName = "Components" Then
xmlNameOfComponent = xmlServerNode.childNodes.item(j).getAttribute("Name")
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Node Components = " & xmlNameOfComponent)
End If
If xmlNameOfComponent = strComponent Then
Set xmlComponentNode = xmlServerNode.childNodes.Item(j)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No of Components subelements: " & xmlComponentNode.childNodes.length)
End If
For k=0 To xmlComponentNode.childNodes.length-1
Set xmlElementListNode = xmlComponentNode.childNodes.Item(k)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("No of ListElements: " & xmlElementListNode.childNodes.length)
End If
varPropertyValue = ""
bValueInComponentNode = false
For l=0 To xmlElementListNode.childNodes.length-1
If xmlElementListNode.childNodes.item(l).childNodes.length > 0 Then
If xmlElementListNode.childNodes.item(l).childNodes.item(0).Text = strPropertyName Then
If BCDebug AND BCDEBUG_FUNC Then
DebugOut(xmlElementListNode.childNodes.item(l).childNodes.item(0).Text & "=[" & _
xmlElementListNode.childNodes.item(l).childNodes.item(1).Text & "]")
End If
varPropertyValue = xmlElementListNode.childNodes.item(l).childNodes.item(1).Text
bValueFound = true
bValueInComponentNode = true
Exit For
End If
End If
Next
If bValueFound = true Or bValueInComponentNode = false Then
Exit For
End If
Next
End If
If bValueFound = true Or bValueInComponentNode = false Then
Exit For
End If
End If
Next
If bValueFound = true Or bValueInComponentNode = false Then
Exit For
End If
End If
End If
If bValueFound = true Or bValueInComponentNode = false Then
Exit For
End If
Next
If BCDebug AND BCDEBUG_MAX Then
If bValueFound = false Then
DebugOut("Property value of key '" & strPropertyName & "' not found")
End If
End If
GetXMLComponentsPropertyValue = varPropertyValue
End Function
'--------------------------------------------------------------------
' Function GetOpenIniValue(FilePathName, Section, KeyValue)
'--------------------------------------------------------------------
Function GetOpenIniValue(FilePathName, Section, KeyValue)
Dim FSO
Dim value
'### On Error Resume Next
value = ""
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("GetOpenIniValue(" & FilePathName & ", " & Section & ", " & KeyValue & ")")
End If
'*** create FSO-Object
Set FSO = CreateObject("Scripting.FileSystemObject")
'*** open ini file for reading
If (FSO.FileExists(FilePathName)) Then
value = GetIniValue(FilePathName, Section, KeyValue)
Else
DebugOut("File " & FilePathName & " does not exist!")
End If
'### On Error Goto 0
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("IniValue = " & value )
End If
GetOpenIniValue = value
End Function
'--------------------------------------------------------------------
' Function GetIniValue(FileName, Section, KeyValue)
'--------------------------------------------------------------------
Function GetIniValue(FileName, Section, KeyValue)
CONST ForReading = 1
Dim FSO, hFile
Dim line, value, char
Dim KeyFound, SectionFound
Dim I
'### On Error Resume Next
value = ""
'*** create FSO-Object
Set FSO = CreateObject("Scripting.FileSystemObject")
'*** open ini file for reading
Set hFile = FSO.OpenTextFile(FileName, ForReading)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("hFile: [" & FileName & "]")
End If
If Not IsNull(hFile) Then
KeyFound = False
'*** loop over whole file
Do While Not hFile.AtEndOfStream
line = hFile.readline
'*** check if it is a section
If left(line,1) = "[" Then
'*** Is this the section we are looking for?
If ucase(mid(line, 2, len(Section))) = ucase(Section) Then
'*** yes
SectionFound = True
Else
'*** no
SectionFound = False
End If
Else
If SectionFound Then
'*** has line the value we are looking for?
If ucase(left(line, len(KeyValue))) = ucase(KeyValue) Then
I = len(KeyValue) + 1
'*** continue until value found
Do While I < len(line)
char = MID(line, I, 1)
'*** check equal sign
If char= "=" Then
'*** get value
value = Right(line, Len(line) - I)
'*** break
I = Len(line)
KeyFound = True
Else
I = I + 1
End If
Loop
End If
End If
End If
Loop
hFile.close
If KeyFound = False Then
value = ""
End If
End If
'### On Error Goto 0
If BCDebug AND BCDEBUG_FUNC Then
DebugOut(FileName & ", " & Section & ", " & KeyValue & " = " & value)
End If
GetIniValue = value
End Function
'--------------------------------------------------------------------
' Sub CreateLogIniFile(LogIniFileDir)
'--------------------------------------------------------------------
Sub CreateLogIniFile(LogIniFileDir)
CONST SVISCOMBLLogIn_ = "SVISCOM-BL.Log.in_"
Dim oFSO 'As Scripting.FileSystemObject
Dim oTextStream 'As Scripting.TextStream
Dim LogIniFilePath
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
LogIniFilePath = LogIniFileDir & "\" & SVISCOMBLLogIn_
If Not (oFSO.FileExists(LogIniFilePath)) Then
If Not oFSO.FolderExists(LogIniFileDir) Then
oFSO.CreateFolder(LogIniFileDir)
End If
Set oTextStream = oFSO.OpenTextFile(LogIniFilePath, 2, True) ' 2 = new file for writing
If Not IsNull(oTextStream) Then
oTextStream.WriteLine "[BladeSystemDiscovery]"
oTextStream.WriteLine "DebugMode=yes"
oTextStream.WriteLine "DebugLevel=15" & vbCrLf
oTextStream.WriteLine "[BladeComponentsMonitor]"
oTextStream.WriteLine "DebugMode=yes"
oTextStream.WriteLine "DebugLevel=15" & vbCrLf
oTextStream.Close
End If
End If
On Error Goto 0
End Sub
'--------------------------------------------------------------------
' Function MonitoringOnDemand()
'--------------------------------------------------------------------
Function MonitoringOnDemand()
CONST strComputer = "."
Dim objWMIService, objItem, objService
Dim colListOfServices, strQuery, strService, result, MonitoringControlCode
Dim CmdBuf, CmdRet, cmdReturnFile
Dim xmlCfgDoc, cfgFileLoaded, xmlCfgDocElem, xmlMonitorNode
Dim strCfgPath, strCfgName, strCfgAbsName
Dim testMCC, checkCount
If Len(MonitoringControlCode) = 0 Then
' can't help it - try DEFAULT
MonitoringControlCode = CONTROLCODE_MONITORING
End If
If BCDebug AND BCDEBUG_MIN OR BCDebug AND BCDEBUG_FUNC Then
DebugOut("MonitoringOnDemand(), ControlCode = " & MonitoringControlCode)
End If
strQuery = "Select * from Win32_Service Where Name=""" & BLADESYSTEMMONITORSERVICE & """"
If BCDebug AND BCDEBUG_FUNC Then
DebugOut(strQuery)
End If
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery (strQuery)
For Each objService in colListOfServices
result = objService.UserControlService(MonitoringControlCode)
Next
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Return code from WMI control command" & BLADESYSTEMMONITORSERVICE & ": " & result)
End If
If result <> 0 Then
'*** if error from service control via WMI try another command
CmdBuf = "SC control " & BLADESYSTEMMONITORSERVICE & " " & MonitoringControlCode
If BCDebug AND BCDEBUG_FUNC Then
DebugOut(CmdBuf)
End If
CmdRet = WshShell.Run("cmd /c " & CmdBuf & " >" & cmdReturnFile, 0, true)
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Return code from SC command: " & CmdRet)
End If
result = CmdRet
End If
MonitoringOnDemand = result
End Function
'--------------------------------------------------------------------
' Sub CreateLogFile(strFileName, isLogFile)
'--------------------------------------------------------------------
Sub CreateLogFile(strFileName, isLogFile)
Dim sMessage, sMPVersion, sLogString
Dim oTextStream 'As Scripting.TextStream
Dim oFSO 'As Scripting.FileSystemObject
Dim systemTime
if isLogFile = TRUE Then
'*** this is a real LOG file script ...
sLogString = ": Start logging script: "
Else
'*** used for ...
sLogString = ": Temporary File for access time comparison: "
End If
systemTime = Time()
sMessage = "********** " & Computer & sLogString & strFileName & " ** " & systemTime & " **********"
sMPVersion = "MP Version: " & MPVERSION
DebugOut(sMessage)
DebugOut(sMPVersion)
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
If not oFSO.FolderExists(oFSO.GetParentFolderName(strFileName)) Then
oFSO.CreateFolder(oFSO.GetParentFolderName(strFileName))
End If
Set oTextStream = oFSO.OpenTextFile(strFileName, 2, True) ' 2 = new file for writing
oTextStream.WriteLine sMessage
oTextStream.WriteLine sMPVersion
oTextStream.Close
DebugFile = true
On Error Goto 0
End Sub
'--------------------------------------------------------------------
' Sub DebugOut(Text)
'--------------------------------------------------------------------
Sub DebugOut(Text)
Dim sMessage
Dim oTextStream 'As Scripting.TextStream
Dim oFSO 'As Scripting.FileSystemObject
Dim TimeSeconds
If (DebugMode = true) AND (DebugConsole = true) Then
sMessage = "***DebugOut: " & Text & vbCrLf
WScript.Echo sMessage
End If
If DebugFile = true Then
TimeSeconds = Time()
sMessage = TimeSeconds & ": " & Text
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTextStream = oFSO.OpenTextFile(strLogFileNameAbs, 8, True) ' 8 = append
oTextStream.WriteLine sMessage
oTextStream.Close
On Error Goto 0
End If
End Sub
'--------------------------------------------------------------------
' Sub DebOut(Text)
'--------------------------------------------------------------------
Sub DebOut(Text)
Dim sMessage
Dim oTextStream 'As Scripting.TextStream
Dim oFSO 'As Scripting.FileSystemObject
Dim TimeSeconds
If DebugFile = true Then
TimeSeconds = Time()
sMessage = TimeSeconds & ": " & Text
On Error Resume Next
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTextStream = oFSO.OpenTextFile(strDebugFilePath, 8, True) ' 8 = append
oTextStream.WriteLine sMessage
oTextStream.Close
On Error Goto 0
End If
End Sub
'--------------------------------------------------------------------
' Sub CreateDiscoveryDoneFile()
'--------------------------------------------------------------------
Sub CreateDiscoveryDoneFile()
Dim strCommand
Dim FSO1
Set FSO1 = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
' '*** create "DISCOVERY done" file to show, DISCOVERY is done
Call CreateLogFile(absDiscoveryDoneFileName, FALSE)
If FSO1.FileExists(absDiscoveryDoneFileName) = FALSE Then
'*** another try ...
Call CreateLogFile(absDiscoveryDoneFileName, FALSE)
If FSO1.FileExists(absDiscoveryDoneFileName) = FALSE Then
DebugOut("HELP and QUIT: Error creating file " & absDiscoveryDoneFileName)
End If
End If
If BCDebug AND BCDEBUG_MAX Then
strCommand = "eventcreate /L " & strBladeSystemErrorLogName & " /T Information /SO " & _
Chr(34) & "SVISCOM-BL Discovery" & Chr(34) & " /ID 498 /D " & Chr(34) & _
"SVISCOM-BL: DISCOVERY cycle done." & Chr(34)
WshShell.Run strCommand
End If
On Error Goto 0
End Sub
'--------------------------------------------------------------------
' Function GetConfigFileEntry(ConfigFileEntry)
'--------------------------------------------------------------------
Function GetConfigFileEntry(ConfigFileEntry)
Dim xmlCfgDoc, cfgFileLoaded, xmlCfgDocElem, xmlMonitorNode
Dim strCfgPath, strCfgName, strCfgAbsName
Dim checkCount
If Len(strCfgPath) > 0 AND Len(strCfgName) > 0 Then
strCfgAbsName = strCfgPath & "\" & strCfgName
If BCDebug AND BCDEBUG_MIN Then
DebugOut("CONFIG file name = " & strCfgAbsName)
End If
'*** (try to) load XML file
Set xmlCfgDoc = CreateObject("Msxml2.DOMDocument")
'disable asynchronous loading
xmlCfgDoc.async = False
checkCount = 3 ' retries - hard coded
cfgFileLoaded = xmlCfgDoc.load(strCfgAbsName)
Do While cfgFileLoaded = false
WScript.Sleep(WAITING_TIME)
checkCount = checkCount - 1
If checkCount = 0 Then
Exit Do
End If
cfgFileLoaded = xmlCfgDoc.load(strCfgAbsName)
Loop
If BCDebug AND BCDEBUG_MIN Then
DebugOut("cfgFileLoaded = " & cfgFileLoaded)
End If
if cfgFileLoaded Then
On Error Resume Next
Set xmlCfgDocElem = xmlCfgDoc.documentElement
Set xmlMonitorNode = xmlCfgDocElem.selectNodes(ConfigFileEntry)
GetConfigFileEntry = xmlMonitorNode.item(0).Text
On Error Goto 0
End If
End If
End Function
'--------------------------------------------------------------------------------------------------
' Function ComposeFilename(ChassisSN, component, fileType)
'--------------------------------------------------------------------------------------------------
Function ComposeFilename(ChassisSN, component, fileType)
Dim tmpFile
Select Case fileType
Case FILETYPE_RESPONSE
tmpFile = BladeSystemCommunicationFilePath & "\Blade_" & ChassisSN & "_" & component & "_" & "comm.xml"
Case FILETYPE_CMD
tmpFile = BladeSystemCommunicationFilePath & "\CMD_" & ChassisSN & "_" & component & ".xml"
Case FILETYPE_MON_RESPONSE
tmpFile = BladeSystemCommunicationFilePath & "\Blade_" & ChassisSN & "_" & component & "Mon_" & "comm.xml"
Case FILETYPE_CMD_TEMPLATE
tmpFile = BladeSystemCommunicationFilePath & "\TEMPLATE\CMD_Template_" & component & ".xml"
Case FILETYPE_CFG_TEMPLATE
tmpFile = BladeSystemCommunicationFilePath & "\TEMPLATE\CFG_Template_" & component & ".xml"
Case FILETYPE_CFG_OUTPUT
tmpFile = BladeSystemCommunicationFilePath & "\CFG_" & ChassisSN & "_" & component & ".xml"
Case Else
'*** wrong file type
End Select
ComposeFilename = tmpFile
End Function
'--------------------------------------------------------------------------------------------------
' Sub GenerateCmdFile(ChassisSN, component, IPaddress)
'--------------------------------------------------------------------------------------------------
Sub GenerateCmdFile(ChassisSN, component, IPaddress)
Dim templFile, outpFile
Dim xmlCMDDoc
Dim server
Dim tmp
DebugOut("Start: GenerateCmdFile()")
Set xmlCMDDoc = CreateObject("Msxml2.DOMDocument")
xmlCMDDoc.async = false
If xmlCMDDoc.parseError.errorCode <> 0 Then
DebugOut("-- GenerateCmdFile: parse error when updating template")
Else
Set server = xmlCMDDoc.selectSingleNode("//Server")
Call server.setAttribute("ChassisSerialNumber",ChassisSN)
tmp = "IpAddress"
Call server.setAttribute(tmp,IPaddress)
outpFile = ComposeFilename(ChassisSN, component, FILETYPE_CMD)
xmlCMDDoc.Save(outpFile)
End If
Set xmlCMDDoc = Nothing
End Sub
'--------------------------------------------------------------------------------------------------
' Sub GenerateBladeDeviceCfgFile(SysChassisSerialNumber, serverCfg, storageCfg)
'--------------------------------------------------------------------------------------------------
Sub GenerateBladeDeviceCfgFile(SysChassisSerialNumber, serverCfg, storageCfg, kvmCfg)
Dim templFile, outpFile
Dim xmlCMDDoc
Dim server
Dim tmp
Set xmlCMDDoc = CreateObject("Msxml2.DOMDocument")
xmlCMDDoc.async = false
If xmlCMDDoc.parseError.errorCode <> 0 Then
DebugOut("-- GetBladeDeviceCfgValue: parse error when updating template")
Else
Set server = xmlCMDDoc.selectSingleNode("//Server")
val = server.getAttribute(valName)
End If
Set xmlCMDDoc = Nothing
GetBladeDeviceCfgValue = val
End Function
'--------------------------------------------------------------------------------------------------
' Sub GenerateDiscoveryCmdFileForAllComp(ChassisSN, IPaddress)
'--------------------------------------------------------------------------------------------------
Sub GenerateDiscoveryCmdFileForAllComp(ChassisSN, IPaddress)
'--------------------------------------------------------------------------------------------------
' Sub GenerateSelectedDiscoveryCmdFile(ChassisSN, IPaddress, CompNum)
'--------------------------------------------------------------------------------------------------
Sub GenerateSelectedDiscoveryCmdFile(ChassisSN, IPaddress, CompNum)
Select Case CompNum
Case COMPLIST_ENCLOSURE
Call GenerateCmdFile(ChassisSN, "EnclosureDis", IPaddress)
Case COMPLIST_MMBS
Call GenerateCmdFile(ChassisSN, "MMBUnitsDis", IPaddress)
Case COMPLIST_POWERSUPPLIES
Call GenerateCmdFile(ChassisSN, "PowerSupplyUnitsDis", IPaddress)
Case COMPLIST_FANS
Call GenerateCmdFile(ChassisSN, "FanUnitsDis", IPaddress)
Case COMPLIST_TEMPSENSORS
Call GenerateCmdFile(ChassisSN, "TempSensorsDis", IPaddress)
Case COMPLIST_CONNECTUNITS
Call GenerateCmdFile(ChassisSN, "ConnectUnitsDis", IPaddress)
Case COMPLIST_KVMUNITS
Call GenerateCmdFile(ChassisSN, "KVMUnitsDis", IPaddress)
Case COMPLIST_SERVERBLADES
Call GenerateCmdFile(ChassisSN, "ServerBladesDis", IPaddress)
Case COMPLIST_STORAGEBLADES
Call GenerateCmdFile(ChassisSN, "StorageBladesDis", IPaddress)
End Select
End Sub
'--------------------------------------------------------------------
' GetBCNumberFromSN(snStr):
'
' Note: it is assumed that xmlDoc li already loaded
'--------------------------------------------------------------------
Function GetChassisSNFromResponeFile(responseFile)
Dim strEventLogMsg
Dim server
Dim sn
sn = ""
Set server = xmlDoc.selectSingleNode("//Server")
sn = server.getAttribute("ChassisSerialNumber")
If (sn = Null) or (Len(sn)) = 0 Then
'*** no valid string found
strEventLogMsg = "XML file invalid, XML-file: " & responseFile
If insideMP = true Then
Call oAPI.LogScriptEvent("PYBladeSystemEnclosureDiscovery.vbs", 409, ERROR_EVENT, strEventLogMsg)
End If
End If
Function SetDoneMatrix(bcNumber, componentNumber, value)
Dim i
Dim done
done = false
i = 0
Do Until (i > BCNUM_MAX_INDEX) or (done = true)
If StrComp(arrSysChasSerNo(i), snStr, 1) = 0 Then
done = true
Else
i = i + 1
End If
Loop
If done = true Then
GetBCNumberFromSN = i
Else
GetBCNumberFromSN = -1
End If
End Function
'--------------------------------------------------------------------------------------------------
' Function FileAge(fileObject)
'--------------------------------------------------------------------------------------------------
Function FileAge(fileObject)
Dim diffsec, acc1, mod1
DebugOut("Start: FileAge")
FileAge = 0
On Error Resume Next
acc1 = fileObject.DateLastAccessed
mod1 = fileObject.DateLastModified
If mod1 > acc1 Then
acc1 = mod1
End If
diffsec = acc1 - StartTime
FileAge = Second(diffsec)
On Error Goto 0
End Function
'--------------------------------------------------------------------------------------------------
' IsFileOutOfDate: checks file timeout
'
' Input Parameter:
' - ChassisSN part of filename
' - component part of filename
' - fileType part of filename
' - timeout timeout in seconds
' Result Parameter: true/false; result is also true if file doesn't exist
'--------------------------------------------------------------------------------------------------
Function IsFileOutOfDate(ChassisSN, component, fileType, timeout)
Dim FSO
Dim tmpFile
Dim fileOutOfDate
Dim diffsec
Dim file1
Dim acc1, mod1
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("Start: IsFileOutOfDate() ...")
End If
Set FSO = CreateObject("Scripting.FileSystemObject")
tmpFile = ComposeFilename(ChassisSN, component, fileType)
If FSO.FileExists(tmpFile) = false Then
fileOutOfDate = true
Else
On Error Resume Next
Set file1 = FSO.GetFile(tmpFile)
acc1 = file1.DateLastAccessed
mod1 = file1.DateLastModified
On Error Goto 0
'*** difference between W2K3 and W2K8 ... take the newest of the two times!
If mod1 > acc1 Then
acc1 = mod1
End If
diffsec = datediff("s",acc1, now())
If diffsec > timeout Then
fileOutOfDate = true
Else
fileOutOfDate = false
End If
End If
IsFileOutOfDate = fileOutOfDate
Set FSO = Nothing
If BCDebug AND BCDEBUG_FUNC Then
DebugOut("IsFileOutOfDate = " & IsFileOutOfDate)
End If
End Function