'*** LogScriptEvent: Creates an entry in OM eventlog
Function LogScriptEvent(EventID, EventType, sMessage)
Select Case EventType
Case ERROR_EVENT DebugOut MPScript & " ERROR_EVENT_" & EventID & ": " & sMessage, DBG_ALL
Case WARNING_EVENT DebugOut MPScript & " WARNING_EVENT_" & EventID & ": " & sMessage, DBG_ALL
Case INFORMATIONAL_EVENT DebugOut MPScript & " INFORMATIONAL_EVENT_" & EventID & ": " & sMessage, DBG_ALL
End Select
If insideMP = true Then
Call oAPI.LogScriptEvent(MPScript, EventID, EventType, sMessage)
End If
End Function
Function WMIQuery(TargetComputer, sNamespace, sQuery, bErrorFlag)
Dim oInst, wmiNameSpace, waitMS, retry, ErrorNumber
Dim wbemFlagReturnWhenComplete: wbemFlagReturnWhenComplete = 0
DebugOut "WMIQuery: TargetComputer=" & TargetComputer & " Namespace=" & sNamespace & " Query=" & sQuery, DBG_DESC
WMIInstanceValid = FALSE
wmiNameSpace = "winmgmts:{impersonationLevel=impersonate}\\" & "." & sNamespace
On Error Resume Next
For retry=0 To wmiRetries-1
Err.Clear()
' make sure ExecQuery is executed synchronously
Set oInst = GetObject(wmiNameSpace).ExecQuery(sQuery, "WQL", wbemFlagReturnWhenComplete)
' Check if WMI returned data.
' Parallel WMI access sometimes results in incomplete/corrupted data which will crash the object count.
' We use this to set Err.Number, which will otherwise be 0
DebugOut "WMIQuery: Got " & oInst.Count & " instances from WMI", DBG_DESC
ErrorNumber = Err.Number
If IsEmpty(oInst) Or ErrorNumber <> 0 Then
If retry < wmiRetries-1 Then
DebugOut "WMIQuery: Got no Data from WMI class '" & sNamespace & "\" & sInstance &"', " & retry+1 & ". Retry.", DBG_DESC
Randomize
waitMS = Int((waitTimeMax - waitTimeMin + 1) * Rnd) + waitTimeMin ' wait random time span in preconfigured range
DebugOut "WMIQuery: Waiting " & waitMS & " milliseconds", DBG_DATA
'*** do one retry after a short wait ...
WScript.Sleep waitMS
Else 'no retry left, we are done
DebugOut "WMIQuery: Still no Data from WMI, give up", DBG_DATA
If bErrorFlag = True Then
LogScriptEvent 130, ERROR_EVENT, "Class '" & sNameSpace & "\" & sInstance & "' returned invalid data."
End If
End If
Else
Set WMIQuery = oInst
WMIInstanceValid = TRUE
Exit For
End If
Next
Function GetScciData(opCode, opCodeExt, objIndex, cabID)
Dim scciValue, ret
If IsObject(oSwitch) = true Then
On Error Resume Next
scciValue = oSwitch.VBRequest(opCode, opCodeExt, objIndex, cabID, 0, 0, 0, ret)
If ret <> 0 Then
' this SCCI value does not exist
DebugOut "GetScciData: No Data for opCode=0x" & Hex(opCode) & " opCodeExt=0x" & Hex(opCodeExt) & " objIndex=" & objIndex & " cabID=" & cabID, DBG_DESC
scciValue = Null
End If
On Error Goto 0
Else
scciValue = Null
End If
If ret = 0 Then
If VarType(scciValue) < 8000 Then
DebugOut "GetScciData: opCode=0x" & Hex(opCode) & " opCodeExt=0x" & Hex(opCodeExt) & " objIndex=" & objIndex & " cabID=" & cabID & " -> scciValue = '" & scciValue & "'", DBG_DESC
Else
DebugOut "GetScciData: opCode=0x" & Hex(opCode) & " opCodeExt=0x" & Hex(opCodeExt) & " objIndex=" & objIndex & " cabID=" & cabID & " -> scciValue = '[Array]'", DBG_DESC
End If
End If
Function GetScciProperty(opCode, opCodeExt, objIndex, cabID, strProperty)
Dim scciValue, ret
If IsObject(oSwitch) = true Then
On Error Resume Next
scciValue = oSwitch.VBRequest(opCode, opCodeExt, objIndex, cabID, "" & strProperty, Len(strProperty)+1, 0, ret)
If ret <> 0 Then
' this SCCI value does not exist
DebugOut "GetScciProperty: No Data for opCode=0x" & Hex(opCode) & " opCodeExt=0x" & Hex(opCodeExt) & " objIndex=" & objIndex & " cabID=" & cabID & " '" & strProperty & "' " & Len(strProperty)+1 & " 0", DBG_DESC
scciValue = Null
End If
On Error Goto 0
Else
scciValue = Null
End If
If ret = 0 Then
If VarType(scciValue) < 8000 Then
DebugOut "GetScciProperty: opCode=0x" & Hex(opCode) & " opCodeExt=0x" & Hex(opCodeExt) & " objIndex=" & objIndex & " cabID=" & cabID & " '" & strProperty & "' " & Len(strProperty)+1 & " 0 -> scciValue = '" & scciValue & "'", DBG_DESC
Else
DebugOut "GetScciProperty: opCode=0x" & Hex(opCode) & " opCodeExt=0x" & Hex(opCodeExt) & " objIndex=" & objIndex & " cabID=" & cabID & " '" & strProperty & "' " & Len(strProperty)+1 & " 0 -> scciValue = '[Array]'", DBG_DESC
End If
End If
' main functionality from here:
' https://blogs.msdn.microsoft.com/dsadsi/2009/02/12/working-with-the-microsoft_ipmi-driver-class-to-retrieve-driver-specific-information-part-1/
Function doIpmiRequest(oIPMI, oClass, NetFunc, Lun, RAddr, Cmd, rData, outParams)
Dim inParams, rDataItem, rDataSize, i
rDataSize = UBound(rData) + 1
DebugOut "doIpmiRequest (" & NetFunc & ", " & Lun & ", " & RAddr & ", " & Cmd & ", Array(" & rDataSize & "))", DBG_INFO
Set inParams = oClass.Methods_("RequestResponse").InParameters.SpawnInstance_
inParams.networkfunction = NetFunc
inParams.lun = Lun
inParams.responderaddress = RAddr
inParams.command = Cmd
inParams.RequestDataSize = rDataSize
inParams.RequestData = rData
For i=0 To rDataSize-1
DebugOut "inParams.RequestData(" & i & "): 0x" & Right("00" & Hex(Data(i)), 2), DBG_DESC
Next
'DebugOut "Number of ResponseData: " & outParams.ResponseDataSize, DBG_INFO
For i=0 To outParams.ResponseDataSize-1
DebugOut "OutParams.ResponseData(" & i & "): 0x" & Right("00" & Hex(outParams.ResponseData(i)), 2), DBG_DESC
Next
'DebugOut "Completion Code: " & outParams.CompletionCode, DBG_INFO
doIpmiRequest = outParams.CompletionCode
End Function
'DebugLevel options are defined in bits and may be combined using binary Or
Const DBG_NO = 0 ' 0000: print no debug lines
Const DBG_INFO = 1 ' 0001: print informational debug lines
Const DBG_DATA = 2 ' 0010: print SCCI/CIM data related debug lines
Const DBG_DESC = 4 ' 0100: print lines relevant for documentation document
Const DBG_SCOM = 8 ' 1000: print SCOM related information
Const DBG_ALL = 3 ' 0011: standard output
Dim oFSO, oLogStream, lineCounter
Dim LogFileDir, LogFilePath, LogFileDirBase
Sub PrepareLogging(TargetComputer, LogFileName, SectionIni, Component)
' get the system environment variable TEMP (usually: C:\Windows\TEMP), depending on e.g. partition
Dim WshShell, EnvVar, TEMP, SYSTEMDRIVE
Dim LogFileTemp, SVISCOMLogIni, SVISCOMLogIn_
' Shell object for system access
Set WshShell = WScript.CreateObject("WScript.Shell")
Set EnvVar = WshShell.Environment("PROCESS")
' get the system environment variable TEMP (usually: C:\Windows\TEMP), depending on e.g. partition
TEMP = EnvVar.Item("TEMP")
SYSTEMDRIVE = EnvVar.Item("SYSTEMDRIVE")
If Len(TEMP) > 0 Then
' use this system temp directory
LogFileTemp = TEMP
Else
If Len(SYSTEMDRIVE) > 0 Then
LogFileTemp = SYSTEMDRIVE & "\temp"
Else
' can't help it - try:
LogFileTemp = "C:\temp"
End If
End If
LogFileDir = LogFileTemp & "\SVISCOM\" & SVISCOMName
LogFileDirBase = LogFileTemp & "\SVISCOM"
SVISCOMLogIni = LogFileDir & SVISCOMLogIniName
SVISCOMLogIn_ = LogFileDir & SVISCOMLogIn_Name
LogFilePath = LogFileDir & LogFileName & ".log"
If Component = "" Then
LogFilePath = LogFileDir & LogFileName & TargetComputer & ".log"
Else
LogFilePath = LogFileDir & LogFileName & TargetComputer & "_" & Component & ".log"
End If
' get setting for DebugMode and DebugFile
If DebugMode = false Then
Call GetLogFileIni(SVISCOMLogIni, SectionIni, "")
' Default DebugLevel: All
If DebugLevel = DBG_NO Then DebugLevel = DBG_ALL End If
End If
' set log file name and create file; only now logging to file can start
If DebugFile = true Then
CreateLogFile(TargetComputer)
End If
DebugOut "TEMP = " & TEMP, DBG_INFO
DebugOut "SYSTEMDRIVE = " & SYSTEMDRIVE, DBG_INFO
DebugOut "LogFileDirBase = " & LogFileDirBase, DBG_INFO
DebugOut "LogFileDir = " & LogFileDir, DBG_INFO
DebugOut "SVISCOMLogIni = " & SVISCOMLogIni, DBG_INFO
DebugOut "SVISCOMLogIn_ = " & SVISCOMLogIn_, DBG_INFO
DebugOut "TargetComputer = " & TargetComputer, DBG_INFO
DebugOut "LogFileName = " & LogFileName, DBG_INFO
DebugOut "LogFilePath = " & LogFilePath, DBG_INFO
DebugOut "DebugMode = " & DebugMode, DBG_INFO
DebugOut "OverWrite = " & DebugOverWrite, DBG_INFO
DebugOut "DebugLevel = " & DebugLevel, DBG_INFO
DebugOut "DebugTest = " & DebugTest, DBG_INFO
End Sub
Sub CreateLogFile(TargetComputer)
Dim sMessage, sMPVersion
Dim currentDate, diffDays, baseName, extName, logFolder
Dim FileDate, thisLine, thisLineLen
If DebugFile = true Then
lineCounter = 0
sMessage = "********** " & TargetComputer & ": Start logging script: " & LogFilePath & " ** " & Time() & " **********"
sMPVersion = "MP Version: *** " & MPVERSION & " ***"
On Error Resume Next
If Not oFSO.FolderExists(LogFileDir) Then
oFSO.CreateFolder(LogFileDir)
End If
If oFSO.FolderExists(LogFileDir) Then
If oFSO.FileExists(LogFilePath) Then
'*** read file date (file properties do not work properly)
Set oLogStream = oFSO.OpenTextFile(LogFilePath, 1, True) ' 1 = read
Do While Not oLogStream.AtEndOfStream
thisLine = oLogStream.ReadLine
If InStr(thisLine, "SYSTEMDRIVE") > 0 Then
thisLineLen = Len(thisLine)
thisLine = Right(thisLine, thisLineLen - 4)
thisLine = Left(thisLine, InStr(thisLine, "SYSTEMDRIVE") - 3)
fileDate = CDate(thisLine)
Exit Do
End If
Loop
oLogStream.Close
currentDate = Now()
diffDays = DateDiff("d", fileDate, currentDate)
logFolder = Year(currentDate) & Right("00" & Month(currentDate), 2) & Right("00" & Day(currentDate), 2)
If CLng(diffDays) >= CLng(DBG_LOGDAYSOLD) Then
baseName = oFSO.GetBaseName(LogFilePath)
extName = oFSO.GetExtensionName(LogFilePath)
DebugOut "Log file '" & baseName & "' is " & diffDays & " days old, older than " & DBG_LOGDAYSOLD & " days. Move to folder '" & logFolder & "'.", DBG_INFO
If Not oFSO.FolderExists(LogFileDir & "\" & logFolder) Then
oFSO.CreateFolder(LogFileDir & "\" & logFolder)
End If
oLogStream.Close
'Use copy & delete, as move fails when a file already esists
oFSO.CopyFile LogFilePath, LogFileDir & "\" & logFolder & "\" & baseName & "." & extName, True
oFSO.DeleteFile LogFilePath, True
Else
oLogStream.Close
End If
End If
If DebugOverWrite = true Then
Set oLogStream = oFSO.OpenTextFile(LogFilePath, 2, True) ' 2 = open new for writing
Else
Set oLogStream = oFSO.OpenTextFile(LogFilePath, 8, True) ' 8 = append
oLogStream.WriteLine ""
End If
lineCounter = lineCounter + 1
oLogStream.WriteLine "[" & lineCounter & "] " & sMessage
lineCounter = lineCounter + 1
oLogStream.WriteLine "[" & lineCounter & "] " & sMPVersion
Else
' if we come here, the discovery script may have been run by hand without running the server discovery:
If DebugMode = true Then
DebugOut "Warning: LogFileDirectory could not be created - 'DebugFile' is turned OFF!", DBG_ALL
End If
DebugFile = false
End If
Sub GetLogFileIni(FilePathName, Section, Component)
Dim thisVal
On Error Resume Next
DebugOut "Get INI file values from '" & FilePathName & "', section '" & Section & "'", DBG_INFO
If oFSO.FileExists(FilePathName) Then
DebugOut "IniFile [" & FilePathName & "]", DBG_INFO
thisVal = GetIniValue(FilePathName, Section, "DebugMode" & Component)
DebugMode = false
DebugFile = false
If thisVal = "YES" Or thisVal = "TRUE" Or thisVal = "1" Then
DebugMode = true
DebugFile = true
End If
DebugOut "DebugMode = " & DebugMode, DBG_INFO
thisVal = GetIniValue(FilePathName, Section, "OverWrite")
DebugOverWrite = True
If thisVal = "NO" Or thisVal = "FALSE" Or thisVal = "0" Then
DebugOverWrite = false
End If
DebugOut "DebugOverWrite = " & DebugOverWrite, DBG_INFO
thisVal = GetIniValue(FilePathName, Section, "DebugLevel")
If (DebugLevel = "" Or DebugLevel = 0) And thisVal <> "" Then
DebugLevel = thisVal
End If
DebugOut "DebugLevel = " & DebugLevel, DBG_INFO
thisVal = GetIniValue(FilePathName, Section, "DebugTest")
If DebugTest = "" And thisVal <> "" Then
DebugTest = thisVal
End If
DebugOut "DebugTest = " & DebugTest, DBG_INFO
Else
DebugOut "INI file '" & FilePathName & "' does not exist.", DBG_INFO
End If
Function GetIniValue(FilePathName, Section, KeyValue)
Dim thisLine, thisVal
Dim pos
Dim IniFile
On Error Resume Next
thisVal = ""
'*** open ini file for reading
Set IniFile = oFSO.OpenTextFile(FilePathName, 1) ' 1 = for reading
'*** loop over whole file
Do While Not IniFile.AtEndOfStream
thisLine = Trim(UCase(IniFile.ReadLine))
'*** check if it is a section
If Left(thisLine, 1) = "[" Then
'*** Is this the section we are looking for?
If InStr(thisLine, UCase(Section)) > 0 Then
If Not IniFile.AtEndOfStream Then
thisLine = Trim(UCase(IniFile.ReadLine))
End If
'Loop through the lines of the section
Do While Left(thisLine, 1) <> "["
'*** has line the value we are looking for?
If InStr(thisLine, UCase(KeyValue)) > 0 Then
pos = InStr(thisLine, "=")
If pos > 0 Then
thisVal = Trim(Mid(thisLine, pos+1))
Exit Do
End If
End If
If Not IniFile.AtEndOfStream Then
thisLine = Trim(UCase(IniFile.ReadLine))
Else
Exit Do
End If
Loop
End If
End If
Loop
If Level And DebugLevel Then 'bitwise logic
If DebugMode = true Then
sMessage = Text
WScript.Echo sMessage
End If
If DebugFile = true And isObject(oLogStream) Then
lineCounter = lineCounter + 1
sMessage = "[" & lineCounter & "] " & Date() & " " & Time() & ": " & Text
Function GetSVAgentPath()
Dim SVAgentsPath, regSVAgentsPath
On Error Resume Next
Err.Clear()
Registry.GetStringValue HKEY_LOCAL_MACHINE, regRootSVUUIDPath, regRootSVAgentsPathname, regSVAgentsPath
If Err.Number <> 0 Or IsNull(regSVAgentsPath) Then
SVAgentsPath = ""
DebugOut "Registry Root SV-Agents Path not found", DBG_INFO
Else
DebugOut "regRootSV-Agents Path: " & regSVAgentsPath, DBG_INFO
regSVAgentsPath = regSVAgentsPath & "\STATUS_MIB\CurrentVersion"
Err.Clear()
Registry.GetStringValue HKEY_LOCAL_MACHINE, regSVAgentsPath, SVAgentsPathname, SVAgentsPath
If Err.Number <> 0 Or IsNull(SVAgentsPath) Then
SVAgentsPath = ""
End If
End If
On Error Goto 0
DebugOut "SV-Agents Path: " & SVAgentsPath, DBG_INFO
Function IsSVAgentRunning(TargetComputer)
Dim Services, Service, SVAgentState
Dim sQuery
Dim wbemFlagReturnWhenComplete: wbemFlagReturnWhenComplete = 0
DebugOut "Check running ServerView Agent via WMI", DBG_INFO
' make sure ExecQuery is executed synchronously
sQuery = "SELECT * FROM Win32_Service WHERE Name = 'SrvCtrl'"
DebugOut "WMIQuery: TargetComputer=. Namespace=" & cimv2NS & " Query=" & sQuery, DBG_DATA
Set Services = GetObject("winmgmts:\\." & cimv2NS).ExecQuery(sQuery, "WQL", wbemFlagReturnWhenComplete)
SVAgentState = false
On Error Resume Next
For Each Service in Services
If Service.Name = "SrvCtrl" Then
DebugOut Service.DisplayName & " (" & Service.Name & "): " & Service.State & " / " & Service.Status & " / " & Service.Started, DBG_INFO
If Service.State = "Running" Then
SVAgentState = true
End If
DebugOut cimv2NS & ":" & "Win32_Service" & ".Name: " & Service.Name, DBG_DESC
DebugOut cimv2NS & ":" & "Win32_Service" & ".DisplayName: " & Service.DisplayName, DBG_DESC
DebugOut cimv2NS & ":" & "Win32_Service" & ".State: " & Service.State, DBG_DESC
Exit For
End If
Next
On Error Goto 0
DebugOut "ServerView Agent Service found running = " & SVAgentState, DBG_INFO
For each i in RaidRegistryList
Err.Clear()
Registry.GetStringValue HKEY_LOCAL_MACHINE, i, regRaidVersion, RaidVersion
If Err.Number = 0 And Len(RaidVersion) > 0 Then
Exit For
Else
RaidVersion = ""
End If
Next
On Error Goto 0
If Len(RaidVersion) > 0 Then
DebugOut "ServerView RAID Version: " & RaidVersion, DBG_INFO
Else
DebugOut "ServerView RAID NOT installed", DBG_INFO
End If
Function GetPYServerData(strValueName)
Dim strValue
strValue = ""
On Error Resume Next
Err.Clear()
Registry.GetStringValue HKEY_LOCAL_MACHINE, SVISCOMregPath, strValueName, strValue
If Err.Number <> 0 Or IsNull(strValue) Then
strValue = ""
Err.Clear()
End If
On Error Goto 0
DebugOut "GetPYServerData: " & strValueName & ": '" & strValue & "'", DBG_INFO
Function SavePYServerData(strValueName, strValue)
Dim RetVal, regPath, ErrorNumber
regPath = SVISCOMregPath
On Error Resume Next
Err.Clear()
SavePYServerData = 0
RetVal = Registry.CreateKey(HKEY_LOCAL_MACHINE, regPath)
If (RetVal = 0) And (Err.Number = 0) Then
Err.Clear()
RetVal = Registry.SetStringValue(HKEY_LOCAL_MACHINE, regPath, strValueName, strValue)
ErrorNumber = Err.Number
If (RetVal <> 0) Then
DebugOut "Error on writing " & strValueName & ": RetVal " & RetVal, DBG_INFO
ElseIf (ErrorNumber <> 0) Then
DebugOut "Error on writing " & strValueName & ": ErrorNumber" & ErrorNumber, DBG_INFO
Else
DebugOut strValueName & ": '" & strValue & "' saved", DBG_INFO
SavePYServerData = strValue
End If
Else
DebugOut "Error on creating RegPath '" & regPath & "'", DBG_INFO
End If
Registry.GetStringValue HKEY_LOCAL_MACHINE, SVISCOMregPath, strValueName, strValue
If Not IsNull(strValue) Then
DebugOut "DeletePYServerData: Delete '" & strValueName & "' from PYServerData", DBG_INFO
Registry.DeleteValue HKEY_LOCAL_MACHINE, SVISCOMregPath, strValueName
Else
DebugOut "DeletePYServerData: Registry value '" & strValueName & "' does not exist.", DBG_INFO
End If
Function SVhasCIMProvider(SVAgentVersion)
Const regMSCurrentVersion = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
Dim hasProvider
Dim WindowsVersion
' ServerView CIM Providers need
' - agents version SVCIMVERSION_MIN or higher
' - Windows Server 2008 R2 (6.1) or Windows Server 2012 (6.2)
Sub Main()
Dim oArgs, oDiscoveryData, oDiscoveryEmptyData, oInst, oServer, oRelationship, serverClass
Dim colItems, objItem, WMIVersion
Dim SourceType, SourceID, ManagedEntityId, PrincipalName, TargetComputer, NetworkName
Dim ManufacturerShort, Manufacturer, FTSServerName, ModelName, ChassisModel, ChassisModelShort
Dim netServerName, OSServerName, OSName, OSVersion
Dim SavedManufacturer, SavedModelName
Dim SerialNumber, ChassisID, ModelNamePRIMERGY, ModelNamePRIMERGYModelGroup
Dim Cabinets, cabData, cabString
Dim componentSubSystemType
Dim intComponentValue, strComponentValue, cabID, devID
Dim devType(50), devNo(50)
Dim SCCIIndex, index, i, j
Dim totalMemory, totalMemoryUnit, totalDiskSpace
Dim SVRaidVersion
Dim SVAgentPath, SVAgentClass, SVNamespace, SCOMAgentVersion, MonitoringAgents, RaidManager
Dim SystemFirmware, BIOSVersion
Dim iRMCName, BMCIPv4Addr, BMCIPv6Addr, iRMCDNSName, IPAddress
Dim CIMProvider, ret
Set oArgs = WScript.Arguments
If insideMP = true And oArgs.Count < 4 Then
DebugOut "Not enough arguments -> Server discovery script exits with error!", DBG_INFO
WScript.Quit -1
End If
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
PrincipalName = oArgs(2)
TargetComputer = oArgs(3)
If oArgs.Count > 4 Then
If IsNumeric(oArgs(4)) Then
DebugLevel = CInt(oArgs(4))
If oArgs.Count > 5 Then DebugTest = oArgs(5) End If
Else
DebugOut "!!", DBG_INFO
DebugOut "!! Ignoring all debug options! Use: ... <DebugLevel> <DebugTest>", DBG_INFO
DebugOut "!!", DBG_INFO
End If
End If
DebugOut "Args: " & SourceId & " " & ManagedEntityId & " " & PrincipalName & " " & TargetComputer & " " & DebugLevel & " " & DebugTest, DBG_INFO
' Shell object for system access
Set oFSO = CreateObject("Scripting.FileSystemObject")
PrepareLogging TargetComputer, LogFileName, SectionIni, ""
DebugOut "Server Discovery Version is: *** " & MPVERSION & " ***", DBG_ALL
' move all files from old log folder to new log folder
On Error Resume Next
If Not oFSO.FolderExists(LogFileDir) Then
If Not oFSO.FolderExists(LogFileDirBase) Then oFSO.CreateFolder(LogFileDirBase) End If
oFSO.CreateFolder(LogFileDir)
Dim FileCollection, LogFolderOld, File
Set LogFolderOld = oFSO.GetFolder(LogFileDirBase)
Set FileCollection = LogFolderOld.Files
For Each File in FileCollection
'Use copy & delete, as move fails when a file already esists
oFSO.CopyFile File, LogFileDir & "\" & File.Name, True
oFSO.DeleteFile File, True
Next
End If
On Error Goto 0
If insideMP = true Then
SourceType = 0
On Error Resume Next
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oDiscoveryData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
Set oDiscoveryEmptyData = oAPI.CreateDiscoveryData(SourceType, SourceId, ManagedEntityId)
On Error Goto 0
If Not isObject(oAPI) Then insideMP = false End If
End If
' initialize Registry
On Error Resume Next
Set Registry = GetObject("winmgmts:{impersonationLevel=impersonate}\\.\root\default:StdRegProv")
If IsEmpty(Registry) Or Err.Number <> 0 Then
DebugOut "#############", DBG_INFO
DebugOut "############# Cannot access WMI on PRIMERGY Server " & TargetComputer & "!", DBG_INFO
DebugOut "#############", DBG_INFO
LogScriptEvent 110, ERROR_EVENT, "Unable to connect to WMI: /root/default:StdRegProv. Check if the WMI service is enabled on " & TargetComputer & "."
Else
DebugOut "Access to registry via WMI initialised.", DBG_INFO
WMIVersion = GetWMIVersion(TargetComputer)
End If
On Error Goto 0
CreateLogIniFile(LogFileDir) '*** create the Log Ini File "<TEMP>\SVISCOMLog.in_" (if not available)
If Len(SVAgentPath) = 0 Then
DebugOut "#############", DBG_INFO
DebugOut "############# ServerView Agent is not installed on PRIMERGY Server " & TargetComputer & "!", DBG_INFO
DebugOut "############# Quit.", DBG_INFO
DebugOut "#############", DBG_INFO
If insideMP = true Then
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
End If
WScript.Quit(0)
End If
SVAgentRunning = IsSVAgentRunning(TargetComputer)
If SVAgentRunning = false Then
DebugOut "#############", DBG_INFO
DebugOut "############# ServerView Agent is not running on PRIMERGY Server " & TargetComputer & "!", DBG_INFO
DebugOut "#############", DBG_INFO
Else
On Error Resume Next
Set oSwitch = WScript.CreateObject("RSwitch.RSwitch.1")
If IsObject(oSwitch) = false Then
WScript.Sleep SCCISLEEPTIME
Set oSwitch = WScript.CreateObject("RSwitch.RSwitch.1")
End If
If IsObject(oSwitch) = true Then
'*** give a hint to agents, who accesses them (in case of DEBUG / trace)
oSwitch.ClientName = "SVISCOM.vbs"
' request ServerView Agent version to check whether SCCI is possible
' Note: ServerView Agentless service seems to indicate ServerView Agents running but does not support SCCI
MonitoringAgents = "N/A"
SVAgentVersion = oSwitch.VBRequest(&HC00, &HA806, 0, -1, 0, 0, 0, ret)
if ret <> 0 Then
DebugOut "oSwitch: No Data for opCode=0x" & Hex(&HC00) & " opCodeExt=0x" & Hex(&HA806) & " objIndex=" & 0 & " cabID=" & -1, DBG_DESC
DebugOut "#############", DBG_INFO
DebugOut "############# ServerView SCCI not supported " & TargetComputer & "!", DBG_INFO
DebugOut "#############", DBG_INFO
oSwitch = Null
SVAgentRunning = false
SVASRunning = true
Else
DebugOut "oSwitch: opCode=0x" & Hex(&HC00) & " opCodeExt=0x" & Hex(&HA806) & " objIndex=" & 0 & " cabID=" & -1 & " -> scciValue = '" & SVAgentVersion & "'", DBG_DESC
SVAgentVersion = GetSVAgentVersion()
MonitoringAgents = SVAgentName & " V" & SVAgentVersion
If Len(SVAgentVersion) = 0 Or SVAgentVersion < SVAGENTVERSION_MIN Then
LogScriptEvent 111, WARNING_EVENT, "ServerView Agent Version V" & SVAgentVersion & " too old! Use at least V" & SVAGENTVERSION_MIN & "!"
End If
SVASRunning = false
End If
End If
On Error Goto 0
End If
If SVASRunning = true Then
DebugOut "**** ServerView Agentless Service is running. *** Quit. ****", DBG_ALL
If insideMP = true Then
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
End If
WScript.Quit(0)
End If
CIMProvider = SVhasCIMProvider(SVAgentVersion)
DebugOut "This system has CIMProvider = " & CIMProvider, DBG_INFO
' check whether the script was forced to CIM/SCCI
If DebugTest <> "" Then
If Not StrComp(DebugTest, "SCCI", 1) Then
CIMProvider = False
Else
CIMProvider = True
End If
End If
DebugOut "This system has CIMProvider = " & CIMProvider, DBG_INFO
If CIMProvider = False Then SVNamespace = cimv2NS End If
If CIMProvider = True Then SVNamespace = svsNS End If
If SVAgentRunning = true Then
Cabinet = GetScciData(&HE204, &H0, &H0, -1)
DebugOut "Main Cabinet ID = " & Cabinet, DBG_INFO
End If
' Determine Cabinet Number(s) for SCCI
'--------------------------------------------------------------
If SVAgentRunning = true Then
i = GetScciData(&H0C00, &H0108, 0, Cabinet)
Cabinets = "Main: " & Cabinet & " (" & i & ")"
If VarType(cabData) = 2 Or VarType(cabData) = 3 Then
cabString = CabinetLongToString(cabData)
Else
cabString = CabinetByteArrayToString(cabData)
End If
index = 1
Do While cabString <> ""
cabData = Right(cabString, 4)
CabinetArray(index) = CInt("&H" & cabData)
cabString = Replace(cabString, cabData, "")
index = index + 1
Loop
If index > 1 Then Cabinets = Cabinets & ", Extension: " End If
index = 0
For Each cabData in CabinetArray
If index > 0 And cabData <> "" Then
i = GetScciData(&H0C00, &H0108, 0, cabData)
DebugOut "CabinetID " & index & ": " & cabData & "(" & i & ")", DBG_DATA
Cabinets = Cabinets & ", " & cabData & " (" & i & ")"
End If
index = index + 1
Next
End If
DebugOut "Cabinets: [" & Cabinets & "]", DBG_INFO
' do not create an error message here (last arg = 'False') in case this is not a FUJITSU system!
If CIMProvider = True Then
SVAgentClass = "SVS_PGYChassis"
Set colItems = WMIQuery(TargetComputer, SVNamespace, "SELECT * FROM " & SVAgentClass, False)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
' Check that we really get our cabinet (relevant for BX and CX)
If CInt("&H" & objItem.Tag) = CInt(Cabinet) Then
Manufacturer = objItem.Manufacturer
ModelName = objItem.Model
ChassisModel = objItem.Name
SerialNumber = objItem.SerialNumber
End If
DebugOut SVNamespace & ":" & SVAgentClass & ".Tag: " & objItem.Tag, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".Manufacturer: " & objItem.Manufacturer, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".Model: " & objItem.Model, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".Name: " & objItem.Name, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".SerialNumber: " & objItem.SerialNumber, DBG_DESC
Next
On Error Goto 0
End If
Else
If SVAgentRunning = true Then
Manufacturer = GetScciData(&HC00, &H150A, &H0, Cabinet)
ModelName = GetScciData(&HC00, &H608, &H0, Cabinet)
SerialNumber = GetScciData(&HC00, &H600, &H0, Cabinet)
ChassisModel = GetScciData(&HC00, &H108, &H0, Cabinet)
End If
End If
' If Agents are not running but the Seed Discovery found that this is a Fujitsu server
' (we would not be here otherwise), let's try to find out who we are
' start with PYServerData
If SVAgentRunning = false Then
Manufacturer = SavedManufacturer
ModelName = SavedModelName
ChassisModel = GetPYServerData("ChassisModel")
SerialNumber = GetPYServerData("SerialNumber")
End If
DebugOut "Manufacturer: [" & Manufacturer & "]", DBG_INFO
DebugOut "Model Name: [" & ModelName & "]", DBG_INFO
DebugOut "Chassis Model: [" & ChassisModel & "]", DBG_INFO
DebugOut "Chassis Model Short: [" & ChassisModelShort & "]", DBG_INFO
DebugOut "Serial Number: [" & SerialNumber & "]", DBG_INFO
DebugOut "Model Name PRIMERGY: [" & ModelNamePRIMERGY & "]", DBG_INFO
DebugOut "PRIMERGY Model Group: [" & ModelNamePRIMERGYModelGroup & "]", DBG_INFO
' Calculate the total memory size using CIM_PhysicalMemory
'-------------------------------------------------
' totalMemory must be taken from CIM_PhysicalMemory, as Win32_ComputerSystem gives 'memory avail to OS'
SVAgentClass = "CIM_PhysicalMemory"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, True)
totalMemory = 0
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
DebugOut "Memory size (module): " & objItem.Capacity, DBG_INFO
DebugOut cimv2NS & ":" & SVAgentClass & ".Capacity: " & objItem.Capacity, DBG_DESC
If objItem.Capacity > 0 Then totalMemory = totalMemory + objItem.Capacity End If
Next
On Error Goto 0
End If
DebugOut "Memory size (overall): " & totalMemory, DBG_INFO
totalMemoryUnit = ConvertToMatchingUnit(totalMemory)
DebugOut "Memory size (overall): " & totalMemoryUnit, DBG_INFO
'*** Get ServerName from Win32_ComputerSystem
'-------------------------------------------------
SVAgentClass = "Win32_ComputerSystem"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
FTSServerName = objItem.Name
DebugOut cimv2NS & ":" & SVAgentClass & ".Name: " & objItem.Name, DBG_DESC
DebugOut "ServerName: [" & FTSServerName & "]", DBG_INFO
Next
On Error Goto 0
End If
' Get OS Name from Win32_OperatingSystem
'-------------------------------------------------
OSName = ""
OSVersion = ""
OSServerName = ""
SVAgentClass = "Win32_OperatingSystem"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
OSName = objItem.Caption
OSVersion = objItem.Version
OSServerName = objItem.CSName
DebugOut cimv2NS & ":" & SVAgentClass & ".Caption: " & objItem.Caption, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".Version: " & objItem.Version, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".CSName: " & objItem.CSName, DBG_DESC
Next
On Error Goto 0
End If
DebugOut "OSName: " & OSName, DBG_INFO
DebugOut "OSVersion: " & OSVersion, DBG_INFO
DebugOut "OSServerName: " & OSServerName, DBG_INFO
If Len(FTSServerName) = 0 Then
If Len(OSServerName) = 0 Then
' yet another try: the network name ...
On Error Resume Next
Dim objNetwork
Set objNetwork = WScript.CreateObject("WScript.Network")
netServerName = objNetwork.ComputerName
DebugOut "OS-NetworkName: " & netServerName, DBG_INFO
If IsNull(netServerName) = FALSE And Len(netServerName) > 0 Then
FTSServerName = netServerName
End If
On Error Goto 0
Else
FTSServerName = OSServerName
End If
End If
' Check the PRIMERGY model using Win32_ComputerSystemProduct
'--------------------------------------------------------
' In case we did not get Manufacturer and ModelName from FTS classes, try Win32_ComputerSystemProduct
If Len(Manufacturer) = 0 Or Len(ModelName) = 0 Then
SVAgentClass = "Win32_ComputerSystemProduct"
Set colItems = WMIQuery(TargetComputer, cimv2Ns, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
If Len(Manufacturer) = 0 Then
Manufacturer = objItem.Vendor
DebugOut cimv2NS & ":" & SVAgentClass & ".Vendor: " & objItem.Vendor, DBG_DESC
DebugOut "Manufacturer: [" & Manufacturer & "]", DBG_INFO
End If
If Len(ModelName) = 0 Then
ModelName = objItem.Name
DebugOut cimv2NS & ":" & SVAgentClass & ".Name: " & objItem.Name, DBG_DESC
ModelNamePRIMERGYModelGroup = UCase(Left(objItem.Name, 11))
ModelNamePRIMERGY = UCase(Left(objItem.Name, 8))
DebugOut "ModelName: [" & ModelName & "]", DBG_INFO
DebugOut "ModelNamePRIMERGY: [" & ModelNamePRIMERGY & "]", DBG_INFO
DebugOut "ModelNamePRIMERGYModelGroup: [" & ModelNamePRIMERGYModelGroup & "]", DBG_INFO
End If
If Len(ChassisModel) = 0 Then
ChassisModel = "Unknown"
End If
Next
On Error Goto 0
End If
End If
'*** check if this is a valid ModelName
If Len(SavedModelName) > 0 And SavedModelName <> ModelName Then
DebugOut "Use saved PY Server data:", DBG_INFO
ModelName = SavedModelName
ModelNamePRIMERGY = UCase(Left(ModelName, 8))
Manufacturer = SavedManufacturer
ModelNamePRIMERGYModelGroup = UCase(Left(ModelName, 11))
ChassisModel = GetPYServerData("ChassisModel")
ChassisModelShort = Left(ChassisModel, 6)
DebugOut "ModelName: [" & ModelName & "]", DBG_INFO
DebugOut "ModelNamePRIMERGY: [" & ModelNamePRIMERGY & "]", DBG_INFO
DebugOut "ModelNamePRIMERGYModelGroup: [" & ModelNamePRIMERGYModelGroup & "]", DBG_INFO
DebugOut "Chassis Model: [" & ChassisModel & "]", DBG_INFO
DebugOut "Manufacturer: [" & Manufacturer & "]", DBG_INFO
End If
ManufacturerShort = UCase(Left(Manufacturer, 7))
DebugOut "ManufacturerShort: [" & Manufacturer & "]", DBG_INFO
serverClass = ""
If ManufacturerShort = "FUJITSU" Or ManufacturerShort = "FSC" Then
DebugOut "ModelNamePRIMERGY: [" & ModelNamePRIMERGY & "]", DBG_INFO
If ModelNamePRIMERGY = "PRIMERGY" Then
DebugOut "ModelNamePRIMERGYModelGroup: [" & ModelNamePRIMERGYModelGroup & "]", DBG_INFO
If ModelNamePRIMERGYModelGroup = "PRIMERGY TX" Or ChassisModelShort = "EC100F" Or ChassisModelShort = "EC200F" Then
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: TX-Model", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.TXServer']$"
ElseIf ModelNamePRIMERGYModelGroup = "PRIMERGY CX" Then
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: CX-Model", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.CXServer']$"
ElseIf ModelNamePRIMERGYModelGroup = "PRIMERGY RX" Or ChassisModelShort = "EC230R" Then
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: RX-Model", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RXServer']$"
ElseIf ModelNamePRIMERGYModelGroup = "PRIMERGY SX" Then
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: SX-Model", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.SXServer']$"
ElseIf ModelNamePRIMERGYModelGroup = "PRIMERGY BX" Then
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: BX-Model", DBG_INFO
ChassisID = ChassisModel & "." & SerialNumber
DebugOut "ChassisID: " & ChassisID, DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.BXServer']$"
Else
'Not an uptodate PRIMERGY model
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: Other PRIMERGY Model", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.XXServer']$"
End If
ElseIf ModelNamePRIMERGY = "PRIMEQUE" Then
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: PRIMEQUEST Partition", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.PQPartition']$"
Else
'Not a modern PRIMERGY model
DebugOut TargetComputer & " / " & ModelName & " inserted in ModelNamePRIMERGYModelGroup: Other PRIMERGY Model", DBG_INFO
serverClass = "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.XXServer']$"
End If
'*** save ModelName
If Len(SavedModelName) = 0 And Len(ModelName) > 0 Then
Call SavePYServerData("ModelName", ModelName)
Call SavePYServerData("ChassisModel", ChassisModel)
Call SavePYServerData("Manufacturer", Manufacturer)
End If
Call SavePYServerData("OSVersion", OSVersion)
If ModelName = "" Then ModelName = "Unknown" End If
If ChassisModel = "" Then ChassisModel = "Unknown" End If
If ChassisID = "" Then ChassisID = "N/A" End If
If Manufacturer = "" Then Manufacturer = "Fujitsu Technology Solutions" End If
DebugOut "PrincipalName = " & PrincipalName, DBG_INFO
DebugOut "FTSServerName = " & FTSServerName, DBG_INFO
DebugOut "TargetComputer = " & TargetComputer, DBG_INFO
DebugOut "ModelName = " & ModelName, DBG_INFO
DebugOut "ChassisModel = " & ChassisModel, DBG_INFO
' Check PrincipalName (from SCOM) against FTSServerName (from hardware) to eliminate cluster ressources
If insideMP = true Then
'*** does not work with: PrincipalName = "."
If Len(PrincipalName) > 2 Then
Dim Name1, Name2, Name3, Name4, tmpPos
'*** cut off domain name, if it exists
Name1 = Ucase(PrincipalName)
tmpPos = InStr(Name1, ".")
If tmpPos > 1 then
Name3 = Left(Name1, tmpPos-1)
Else
Name3 = Name1
End If
'*** cut off domain name, if it exists
Name2 = Ucase(FTSServerName)
tmpPos = InStr(Name2, ".")
If tmpPos > 1 then
Name4 = Left(Name2, tmpPos-1)
Else
Name4 = Name2
End If
DebugOut "Principal-base = " & Name3, DBG_INFO
DebugOut "FTSServer-base = " & Name4, DBG_INFO
If Name3 <> Name4 Then
'*** FTSServerName is different from PrincipalName!
'*** This is the case e.g. for a cluster resource = NO SERVER!
DebugOut "#############", DBG_INFO
DebugOut "############# PrincipalName (base) <> FTSServerName (base)!", DBG_INFO
DebugOut "############# (base = checked without domain name extension)", DBG_INFO
DebugOut "#############", DBG_INFO
DebugOut "############# This is no SERVER to monitor!", DBG_INFO
DebugOut "#############", DBG_INFO
DebugOut "############# Return empty DISCOVERY data and quit script.", DBG_INFO
DebugOut "#############", DBG_INFO
If insideMP = true Then
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
End If
DebugOut "WScript.Quit(0)", DBG_INFO
WScript.Quit(0)
Else
DebugOut "PrincipalName (base) = FTSServerName (base). This is no cluster ressource.", DBG_INFO
End If
Else
DebugOut "#############", DBG_INFO
DebugOut "############# WARNING:", DBG_INFO
DebugOut "#############", DBG_INFO
DebugOut "############# 'insideMP = true' and PrincipalName has two or less characters??????", DBG_INFO
DebugOut "#############", DBG_INFO
End If
End If
Else
DebugOut "**** Not a system of Fujitsu Technology Solutions. *** Quit. ****", DBG_ALL
If insideMP = true Then
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
End If
WScript.Quit(0)
End If
' check whether a customer wants to skip Monitoring
ret = GetPYServerData("NoMonitor")
If Not Len(ret) = 0 And StrComp(LCase(ret), "true") = 0 Then
DebugOut "**** Found noMonitor flag in Registry. *** Quit. ****", DBG_ALL
If insideMP = true Then
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
End If
WScript.Quit(0)
End If
If Len(serverClass) = 0 Then
If insideMP = true Then
DebugOut "**** Did not get any Discovery Data. *** Quit. ****", DBG_ALL
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
End If
WScript.Quit(0) ' got no Discovery Data
End If
' get server IP adress(es)
'---------------------------------------
IPAddress = ""
SVAgentClass = "Win32_NetworkAdapterConfiguration"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass & " WHERE MACAddress > ''", False)
index = 0
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem In colItems
If IsArray(objItem.IPAddress) Then
If IPAddress <> "" Then
IPAddress = IPAddress & ", "
End If
strComponentValue = "IP Address(es) " & index & ": "
For i=0 To UBound(objItem.IPAddress)
If i = 0 Then
If objItem.IPAddress(i) <> "" Then
IPAddress = IPAddress & objItem.IPAddress(i)
strComponentValue = strComponentValue & objItem.IPAddress(i)
End If
End If
If i = 1 Then
If objItem.IPAddress(i) <> "" Then
IPAddress = IPAddress & "/" & objItem.IPAddress(i)
strComponentValue = strComponentValue & " / " & objItem.IPAddress(i)
End If
End If
DebugOut strComponentValue, DBG_INFO
Next
index = index + 1
End If
Next
On Error Goto 0
End If
DebugOut "IP Address: " & IPAddress, DBG_INFO
' calculate total local disk space
'---------------------------------------
Dim TotalLocalDisk, TotalLocalDiskUnit, TotalLocalDiskNo
TotalLocalDisk = 0
TotalLocalDiskNo = 0
' Changed from Win32_LogicalDisk to Win32_DiskDrive as Win32_LogicalDisk fails on servers where
' the RAID controller is configured to SCSI (or some such)
SVAgentClass = "Win32_DiskDrive"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, False)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
If InStr(objItem.MediaType, "Removable") Then
DebugOut "Skipping removable media '" & objItem.Caption & "'.", DBG_INFO
ElseIf InStr(objItem.MediaType, "External") Then
DebugOut "Skipping external media '" & objItem.Caption & "'.", DBG_INFO
Else
DebugOut "Disk " & objItem.Caption & ", Type " & objItem.MediaType & ", Size: " & objItem.Size, DBG_INFO
If Not (IsNull(objItem.Size) Or Len(objItem.Size) = 0) Then
TotalLocalDisk = TotalLocalDisk + objItem.Size
TotalLocalDiskNo = TotalLocalDiskNo + 1
End If
End If
DebugOut cimv2NS & ":" & SVAgentClass & ".Caption: " & objItem.Caption, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".MediaType: " & objItem.MediaType, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".Size: " & objItem.Size, DBG_DESC
Next
On Error Goto 0
End If
TotalLocalDiskUnit = ConvertToMatchingUnit(TotalLocalDisk)
DebugOut "TotalLocalDiskSize: " & TotalLocalDiskUnit, DBG_INFO
DebugOut "TotalLocalDiskNo: " & TotalLocalDiskNo, DBG_INFO
' get BMC IP addresses
'---------------------------------------
BMCIPv4Addr = "N/A"
BMCIPv6Addr = "N/A"
iRMCDNSName = "N/A"
If CIMProvider = True Then
SVAgentClass = "SVS_PGYComputerSystem"
Set colItems = WMIQuery(TargetComputer, SVNamespace, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
If Not objItem.AdminUrlIPv4 = "" Then BMCIPv4Addr = objItem.AdminUrlIPv4 End If
If Not objItem.AdminUrlIPv6 = "" Then BMCIPv6Addr = objItem.AdminUrlIPv6 End If
If Not objItem.AdminUrlDNS = "" Then iRMCDNSName = objItem.AdminUrlDNS End If
DebugOut SVNamespace & ":" & SVAgentClass & ".AdminUrlIPv4: " & objItem.AdminUrlIPv4, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".AdminUrlIPv6: " & objItem.AdminUrlIPv6, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".AdminUrlDNS: " & objItem.AdminUrlDNS, DBG_DESC
Exit For '***** only one instance possible
Next
On Error Goto 0
End If
Else
If SVAgentRunning = true Then
' check for iRMC
iRMCName = GetScciData(&HC00, &H508, &H0, Cabinet)
If InStr(LCase(iRMCName), "irmc") > 0 Then
BMCIPv4Addr = GetScciData(&HE205, &H0, &H0, Cabinet)
BMCIPv6Addr = GetScciData(&HE205, &H1, &H0, Cabinet)
If IsNull(BMCIPv4Addr) Or IsEmpty(BMCIPv4Addr) Or BMCIPv4Addr = "" Or Len(BMCIPv4Addr) = 0 Then BMCIPv4Addr = "N/A" End If
If IsNull(BMCIPv6Addr) Or IsEmpty(BMCIPv6Addr) Or BMCIPv6Addr = "" Or Len(BMCIPv6Addr) = 0 Then BMCIPv6Addr = "N/A" End If
If Not BMCIPv4Addr = "N/A" Then iRMCDNSName = GetiRMCDNSName End If
Else
End If
End If
End If
If iRMCDNSName = "N/A" Then iRMCDNSName = BMCIPv4Addr End If
DebugOut "BMC Address IPv4: " & BMCIPv4Addr, DBG_INFO
DebugOut "BMC Address IPv6: " & BMCIPv6Addr, DBG_INFO
DebugOut "BMC DNS name: " & iRMCDNSName, DBG_INFO
' get the System Firmware informations
'-------------------------------------------
SystemFirmware = "N/A"
SVAgentClass = "Win32_BIOS"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
SystemFirmware = Trim(objItem.SMBIOSBIOSVersion)
DebugOut cimv2NS & ":" & SVAgentClass & ".SMBIOSBIOSVersion: " & objItem.SMBIOSBIOSVersion, DBG_DESC
Exit For
Next
On Error Goto 0
End If
DebugOut "SystemFirmware: " & SystemFirmware, DBG_INFO
'ServerView RAID
'-------------------------------------------
SVRaidVersion = GetSVRaidVersion()
RaidManager = "N/A"
'If Len(SVRaidVersion) > 0 And SVRaidVersion >= SVRAIDVERSION_BASE Then
If Len(SVRaidVersion) > 0 Then
RaidManager = SVRaidName & " V" & SVRaidVersion
End If
'***** Create instance of Health Collections
DebugOut "Create Health Collections instance: " & "Fujitsu.HealthCollections", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.CollectionsHost']$")
AddObjectData oInst, "Fujitsu.HealthCollections", PrincipalName
Call oDiscoveryData.AddInstance(oInst)
'If Len(SVRaidVersion) > 0 And SVRaidVersion >= SVRAIDVERSION_BASE Then
If Len(SVRaidVersion) > 0 Then
DebugOut "Create RAIDManagement instance: " & SVRaidName, DBG_SCOM
'***** Create instance of ServerView RAID component
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidManagement']$")
AddSoftwareData oInst, SVRaidName, "Service 'amService.exe'", SVRaidVersion, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
DebugOut "Create " & SVRaidVersionString & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ServerViewRaidVersion']$")
AddSoftwareVersionData oInst, SVRaidVersionString, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ServerViewRaidVersion']/Version$", SVRaidVersion
Call oDiscoveryData.AddInstance(oInst)
End If
Else
Call oAPI.Return(oDiscoveryEmptyData)
If DebugMode = True Then WScript.Echo "" End If
DebugOut "***** Return oDiscoveryEmptyData to OM; Normal exit *****", DBG_ALL
WScript.Quit(1)
End If
End If
' check saved PRIMERGY Server Data
'--------------------------------------------------------------
SCOMAgentVersion = GetPYServerData("AgentVersion")
' No SVAgent Version means, all component data have been deleted or this is a new server
index = 0
if SCOMAgentVersion = "" Then
For Each objItem In ComponentsStateList
ComponentsPYServerData(index) = -1
ComponentsPYServerDataValid(index) = ""
index = index + 1
Next
Else
For Each objItem In ComponentsStateList
i = GetPYServerData(objItem)
If i <> "" Then
ComponentsPYServerData(index) = CStr(i)
Else
ComponentsPYServerData(index) = 0
End If
ComponentsPYServerDataValid(index) = GetPYServerData(objItem & "Valid")
index = index + 1
Next
End If
' save SVAgent Version if necessary
if SCOMAgentVersion = "" Or SCOMAgentVersion <> SVAgentVersion Then
Call SavePYServerData("AgentVersion", SVAgentVersion)
End If
' Management Controller
'---------------------------------------------------------------
componentSubSystemType = MGMTCTRL
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
Dim iRMCFirmware
If CIMProvider = True Then
SVAgentClass = "SVS_PGYManagementController"
Set colItems = WMIQuery(TargetComputer, SVNamespace, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
iRMCName = objItem.ElementName
DebugOut SVNamespace & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".HealthState: " & objItem.HealthState, DBG_DESC
DebugOut ComponentsList(componentSubSystemType) & ": '" & iRMCName & "', [" & SCOM_HealthState(objItem.HealthState) & "]", DBG_INFO
' Some of our servers do have some sort of BMC, but it is no proper iRMC. Skip these.
If (IsEmpty(objItem.ElementName) Or IsNull(objItem.ElementName)) And objItem.HealthState = 0 Then
DebugOut "Found some minor BMC which cannot be monitored. Skip.", DBG_INFO
Else
componentNameArray(index) = objItem.ElementName
componentStatusArray(index) = SCOM_HealthState(objItem.HealthState)
' BMC really does not have a health state. Assume OK if not OK (as with PQ).
If componentStatusArray(index) = STATUS_UNKNOWN Then componentStatusArray(index) = STATUS_OK End If
End If
If index >= cMAXINDEX Then
Exit For
End If
index = index + 1
Next
On Error Goto 0
End If
index = 0
SVAgentClass = "SVS_PGYSoftwareIdentity"
Set colItems = WMIQuery(TargetComputer, SVNamespace, "SELECT * FROM " & SVAgentClass & " WHERE ElementName = '" & iRMCName & "'", True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
'*** VBS runs into the loop, even if "WMISet = Nothing"
On Error Resume Next
For Each objItem in colItems
If Not (InStr(LCase(objItem.ElementName), "irmc") = 0) Then
DebugOut "Firmware Version: " & objItem.VersionString, DBG_INFO
DebugOut SVNamespace & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".VersionString: " & objItem.VersionString, DBG_DESC
iRMCFirmware = objItem.VersionString
componentInfoArray(index) = "Firmware Version: " & iRMCFirmware
index = 1
Exit For
End If
Next
On Error Goto 0
End If
Else
If iRMCName <> "" Then
' BMC does not have its own health state. Assume OK.
iRMCName = GetScciData(&HC00, &H508, &H0, Cabinet)
iRMCFirmware = GetScciData(&HC00, &H506, &H0, Cabinet)
DebugOut ComponentsList(componentSubSystemType) & ": '" & iRMCName & "', [" & STATUS_OK & "]", DBG_INFO
DebugOut "Firmware Version: " & iRMCFirmware, DBG_INFO
componentNameArray(index) = iRMCName
componentStatusArray(index) = STATUS_OK
componentInfoArray(index) = "Firmware Version: " & iRMCFirmware
index = 1
End If
End If
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance: " & componentNameArray(0), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ManagementController']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ManagementController']/FirmwareVersion$", iRMCFirmware
Call oDiscoveryData.AddInstance(oInst)
DebugOut "Create relationship ServerContainsManagementController", DBG_SCOM
Set oRelationship = oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ServerContainsManagementController']$")
oRelationship.Source = oServer
oRelationship.Target = oInst
Call oDiscoveryData.AddInstance(oRelationship)
End If
Call CheckSavedComponents(componentSubSystemType, index)
End If
'*** Processor
'-------------------------------------
componentSubSystemType = PROCESSOR
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
SCCIIndex = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
DebugOut "Number of Processors: " & SCCIIndex, DBG_INFO
If CIMProvider = True Then
If SCCIIndex > 0 Then
index = 0
SVAgentClass = "SVS_PGYProcessor"
Set colItems = WMIQuery(TargetComputer, svsNS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
componentNameArray(index) = objItem.ElementName
componentInfoArray(index) = objItem.Name
DebugOut SVNamespace & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".Name: " & objItem.Name, DBG_DESC
'DebugOut "Processor " & index & ": '" & componentNameArray(index) & "', Type: '" & componentInfoArray(index) & "'"
index = index + 1
Next
On Error Goto 0
End If
SVAgentClass = "SVS_PGYProcessorCapabilities"
index = 0
Set colItems = WMIQuery(TargetComputer, svsNS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
DebugOut SVNamespace & ":" & SVAgentClass & ".NumberOfProcessorEnabledCores: " & objItem.NumberOfProcessorEnabledCores, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".NumberOfHardwareEnabledThreads: " & objItem.NumberOfHardwareEnabledThreads, DBG_DESC
If objItem.NumberOfProcessorEnabledCores > 0 Then
componentInfoArray(index) = componentInfoArray(index) & " / Enabled Cores: " & objItem.NumberOfProcessorEnabledCores
End If
If objItem.NumberOfHardwareEnabledThreads > 0 Then
componentInfoArray(index) = componentInfoArray(index) & ", Enabled Threads: " & objItem.NumberOfHardwareEnabledThreads
End If
DebugOut "Processor " & index & ": '" & componentNameArray(index) & "', Type: '" & componentInfoArray(index) & "'", DBG_INFO
index = index + 1
Next
On Error Goto 0
End If
End If
index = SCCIIndex
Else
If SVAgentRunning = true Then
index = SCCIIndex
If SCCIIndex > 0 Then
For i=0 To SCCIIndex-1
'componentNameArray(i) = "CPU " & i
componentInfoArray(i) = GetScciData(&H605, &H0, i, Cabinet) ' CPU Model Name
If componentNameArray(i) <> "" Then
intComponentValue = GetScciData(&H606, &H0, i, Cabinet) ' No. of logical CPUs (Cores)
If intComponentValue > 0 Then
componentInfoArray(i) = componentInfoArray(i) & " / Logical Cores: " & intComponentValue
End If
End If
DebugOut "Processor " & i & ": '" & componentNameArray(i) & "', Type: '" & componentInfoArray(i) & "'", DBG_INFO
Next
End If
End If
End If
componentNames = "Processors: " & index
componentInfos = ""
If componentCountEmpty > 0 Then componentInfos = "Not populated Processors: " & componentCountEmpty End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.Processors']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "Processor" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.Processor']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.Processor']/ProcInfo$", componentInfoArray(i)
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Memory
'-------------------------------------------
componentSubSystemType = MEMORY
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
totalMemory = 0
SCCIIndex = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
DebugOut "Number of Memory Modules: " & SCCIIndex, DBG_INFO
If CIMProvider = True Then
SVAgentClass = "SVS_PGYPhysicalMemory"
If SCCIIndex > 0 Then
Set colItems = WMIQuery(TargetComputer, svsNS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
index = 0
j = 0
For i=0 To SCCIIndex-1
For Each objItem in colItems
If componentNameArray(j) = objItem.Caption Then
' skip any memory without capacity. something is wrong with it
If objItem.Capacity > 0 Then
DebugOut SVNamespace & ":" & SVAgentClass & ".Caption: " & objItem.Caption, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".Capacity: " & objItem.Capacity, DBG_DESC
componentNameArray(index) = componentNameArray(j)
totalMemory = totalMemory + objItem.Capacity
devProperty1(index) = ConvertToMatchingUnit(objItem.Capacity)
devProperty2(index) = objItem.Manufacturer
devProperty3(index) = objItem.PartNumber
devProperty4(index) = objItem.SerialNumber
componentInfoArray(index) = devProperty1(index)
DebugOut "Memory " & index & ": '" & componentNameArray(index) & "', size: " & objItem.Capacity & " (" & componentInfoArray(index) & ")", DBG_INFO
index = index + 1
End If
j = j + 1
End If
Next
Next
On Error Goto 0
End If
End If
Else
If SVAgentRunning = true Then
If SCCIIndex > 0 Then
SCCIIndex = GetScciData(&H700, &H0, &H0, Cabinet)
index = 0
j = 0
For i=0 To SCCIIndex-1
strComponentValue = GetScciData(&H702, &H0, i, Cabinet)
If componentNameArray(j) = strComponentValue Then
intComponentValue = GetScciData(&H70A, &H0, i, Cabinet)
If intComponentValue > 0 Then
intComponentValue = intComponentValue * 1024 * 1024 '*** Size in GB
componentInfoArray(index) = ConvertToMatchingUnit(intComponentValue) ' Size
devProperty1(index) = componentInfoArray(index)
devProperty2(index) = GetScciData(&HC00, &H030A, i, Cabinet) ' Manufacturer
devProperty3(index) = GetScciData(&HC00, &H0301, i, Cabinet) ' PartNumber
devProperty4(index) = GetScciData(&HC00, &H0300, i, Cabinet) ' SerialNumber
totalMemory = totalMemory + intComponentValue
DebugOut "Memory " & index & ": '" & componentNameArray(index) & "', size: " & intComponentValue & " (" & componentInfoArray(index) & ")", DBG_INFO
index = index + 1
End If
j = j + 1
End If
Next
End If
End If
End If
totalMemory = ConvertToMatchingUnit(totalMemory)
DebugOut "Physical Memory: " & totalMemory, DBG_INFO
componentNames = "Memory Modules: " & index
componentInfos = "Overall Memory: " & totalMemory
For i=0 To 50
devType(i) = ""
devNo(i) = 0
Next
For j=0 To SCCIIndex - 1
For i=0 To 50
If devType(i) = "" Then
devType(i) = componentInfoArray(j)
devNo(i) = 1
Exit For
ElseIf componentInfoArray(j) = devType(i) Then
devNo(i) = devNo(i) + 1
Exit For
End If
Next
Next
componentInfos = componentInfos & "; "
For i=0 To 50
If Not devType(i) = "" Then
componentInfos = componentInfos & "'" & devType(i) & "': " & devNo(i) & ", "
End If
Next
componentInfos = Left(componentInfos, Len(componentInfos) - 2)
If componentCountEmpty > 0 Then componentInfos = componentInfos & "; Not populated Memory Modules: " & componentCountEmpty End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
'DoDiscoveryData(componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName)
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.Memory']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "MemoryModule" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.MemoryModule']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.MemoryModule']/Capacity$", componentInfoArray(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.MemoryModule']/Manufacturer$", devProperty2(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.MemoryModule']/PartNumber$", devProperty3(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.MemoryModule']/SerialNumber$", devProperty4(i)
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
totalDiskSpace = 0
index = 0
SVAgentClass = "Win32_DiskDrive"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
DebugOut cimv2NS & ":" & SVAgentClass & ".MediaType: " & objItem.MediaType, DBG_DESC
If InStr(objItem.MediaType, "Removable") Then
DebugOut "Skipping removable media '" & objItem.Caption & "'.", DBG_INFO
ElseIf InStr(objItem.MediaType, "External") Then
DebugOut "Skipping external media '" & objItem.Caption & "'.", DBG_INFO
Else
componentNameArray(index) = objItem.Caption
DebugOut cimv2NS & ":" & SVAgentClass & ".Caption: " & objItem.Caption, DBG_DESC
If objItem.Size > 0 Then
totalDiskSpace = totalDiskSpace + objItem.Size
DebugOut cimv2NS & ":" & SVAgentClass & ".Size: " & objItem.Size, DBG_DESC
componentInfoArray(index) = ConvertToMatchingUnit(objItem.Size)
devProperty1(index) = componentInfoArray(index)
devProperty3(index) = objItem.Model
devProperty5(index) = objItem.InterfaceType
' these two are only available for OS > W2K3
If CInt(Left(OSVersion, 1)) > 5 Then
devProperty2(index) = objItem.FirmwareRevision
devProperty4(index) = objItem.SerialNumber
End If
End If
DebugOut "Storage " & index & ": '" & componentNameArray(index) & "', size: " & objItem.Size & " (" & componentInfoArray(index) & ")", DBG_INFO
If index >= cMAXINDEX Then
DebugOut "Max. no. of storage instances reached/exceeded", DBG_INFO
Exit For
End If
index = index + 1
End If
Next
DebugOut "Number of Storage Devices: " & index, DBG_INFO
On Error Goto 0
End If
totalDiskSpace = ConvertToMatchingUnit(totalDiskSpace)
DebugOut "Disk Space: " & totalDiskSpace, DBG_INFO
componentNames = "Storage Disks: " & index
componentInfos = "Overall Disk Space: " & totalDiskSpace
For i=0 To 50
devType(i) = ""
devNo(i) = 0
Next
For j=0 To SCCIIndex - 1
For i=0 To 50
If devType(i) = "" Then
devType(i) = componentInfoArray(j)
devNo(i) = 1
Exit For
ElseIf componentInfoArray(j) = devType(i) Then
devNo(i) = devNo(i) + 1
Exit For
End If
Next
Next
componentInfos = componentInfos & "; "
For i=0 To 50
If Not devType(i) = "" Then
componentInfos = componentInfos & "'" & devType(i) & "': " & devNo(i) & ", "
End If
Next
componentInfos = Left(componentInfos, Len(componentInfos) - 2)
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ServerStorage']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "StorageDisk" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.StorageDisk']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.StorageDisk']/Size$", componentInfoArray(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.StorageDisk']/FirmwareRevision$", devProperty2(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.StorageDisk']/ModelName$", devProperty3(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.StorageDisk']/SerialNumber$", devProperty4(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.StorageDisk']/InterfaceType$", devProperty5(i)
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Network Adapter (Ethernet)
'-------------------------------------------
componentSubSystemType = NETWORK
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
SVAgentClass = "Win32_NetworkAdapter"
Set colItems = WMIQuery(TargetComputer, cimv2NS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
i = 0
For Each objItem in colItems
DebugOut cimv2NS & ":" & SVAgentClass & ".ProductName: " & objItem.ProductName, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".AdapterType: " & objItem.AdapterType, DBG_DESC
'DebugOut "Network Device: " & objItem.ProductName, DBG_INFO
' Skip JAPANESE STRING! 'AND InStr(objItem.AdapterType, "Ethernet 802.3") > 0 _
If objItem.ProductName <> "" _
And InStr(objItem.ProductName, "Microsoft") = 0 _
And InStr(objItem.AdapterType, " 802.3") > 0 Then
'AND objItem.NetConnectionStatus <> "0" AND objItem.NetConnectionStatus <> "" _
DebugOut cimv2NS & ":" & SVAgentClass & ".Name: " & objItem.Name, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".NetConnectionStatus: " & objItem.NetConnectionStatus, DBG_DESC
DebugOut cimv2NS & ":" & SVAgentClass & ".MACAddress: " & objItem.MACAddress, DBG_DESC
componentNameArray(index) = objItem.Name & " (" & index & ")"
If Len(objItem.NetConnectionStatus) = 0 Then ' unknown connection state, communication is monitored elsewhere so assume OK
componentStatusArray(index) = STATUS_OK
Else
If objItem.NetConnectionStatus = 6 Then ' hardware malfunction
componentStatusArray(index) = STATUS_ERROR
ElseIf objItem.NetConnectionStatus = 2 Then ' Adapter is connected
componentStatusArray(index) = STATUS_OK
Else ' Adapter is NOT connected
componentStatusArray(index) = STATUS_OK
End If
Select Case objItem.NetConnectionStatus
case 0: componentStatusArray(index) = STATUS_OK ' Disconnected: 0
case 1: componentStatusArray(index) = STATUS_OK ' Connecting: 1
case 2: componentStatusArray(index) = STATUS_OK ' Connected: 2
case 3: componentStatusArray(index) = STATUS_OK ' Disconnecting: 3
case 4: componentStatusArray(index) = STATUS_OK ' Hardware Not Present: 4
case 5: componentStatusArray(index) = STATUS_OK ' Hardware Disabled: 5
i = i + 1
case 6: componentStatusArray(index) = STATUS_ERROR ' Hardware Malfunction: 6
case 7: componentStatusArray(index) = STATUS_OK ' Media Disconnected: 7
case 8: componentStatusArray(index) = STATUS_OK ' Authenticating: 8
case 9: componentStatusArray(index) = STATUS_OK ' Authentication Succeeded: 9
case 10: componentStatusArray(index) = STATUS_OK ' Authentication Failed: 10
case 11: componentStatusArray(index) = STATUS_DEGRADED ' Invalid Address: 11
case 12: componentStatusArray(index) = STATUS_OK ' Credentials Required: 12
End Select
End If
componentInfoArray(index) = "N/A"
componentInfoArray(index) = ""
If Len(objItem.MACAddress) > 0 Then
componentInfoArray(index) = objItem.MACAddress
End If
DebugOut "Network " & index & ": '" & componentNameArray(index) & "' (" & objItem.ServiceName & "), [" & componentStatusArray(index) & "], " & componentInfoArray(index), DBG_INFO
If index >= cMAXINDEX Then
DebugOut "Max. no. of Network Adapter/Port instances reached/exceeded", DBG_INFO
Exit For
End If
index = index + 1
End If
Next
On Error Goto 0
End If
DebugOut "Number of Network Devices: " & index, DBG_INFO
DebugOut "Number of Disabled Network Devices: " & i, DBG_INFO
componentNames = "Network Devices: " & index
If i > 0 Then componentInfos = "Disabled Network Devices: " & i End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ServerNetworks']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "NetworkDevice" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.NetworkDevice']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.NetworkDevice']/MacAddress$", componentInfoArray(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.NetworkDevice']/NetConnectionID$", devProperty1(i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.NetworkDevice']/ServiceName$", devProperty2(i)
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Fans
'---------------------------------------------
componentSubSystemType = FANS
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
index = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
DebugOut "Number of Fans: " & index, DBG_INFO
componentNames = "Fan Devices: " & index
componentInfos = ""
If componentCountEmpty > 0 Then componentInfos = "Not populated Fans: " & componentCountEmpty End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.Fans']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "Fan" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.Fan']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Temperatures
'---------------------------
componentSubSystemType = TEMPERATURE
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
SCCIIndex = 0
index = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
DebugOut "Number of Temperature Sensors: " & index, DBG_INFO
componentNames = "Temperature Sensors: " & index
componentInfos = ""
If componentCountEmpty > 0 Then componentInfos = "Not populated Temperature Sensors: " & componentCountEmpty End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.TemperatureSensors']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "TemperatureSensor" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.TemperatureSensor']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Voltages
'---------------------------
componentSubSystemType = VOLTAGES
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
index = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
DebugOut "Number of Voltage Sensors: " & index, DBG_INFO
componentNames = "Voltage Sensors: " & index
componentInfos = ""
If componentCountEmpty > 0 Then componentInfos = "Not populated Voltage Sensors: " & componentCountEmpty End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.VoltageSensors']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "VoltageSensor" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.VoltageSensor']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Power Supplies
'-----------------------------
componentSubSystemType = POWERSUPPLY
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
index = 0
SCCIIndex = 0
index = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
DebugOut "Number of Power Supplies: " & index, DBG_INFO
If CIMProvider = True Then
SVAgentClass = "SVS_PGYPowerProductionSensor"
If index > 0 Then
Set colItems = WMIQuery(TargetComputer, svsNS, "SELECT * FROM " & SVAgentClass, True)
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
j = 0
For i=0 To index-1
For Each objItem in colItems
If Not StrComp(componentNameArray(j), Replace(objItem.DeviceID, "-", "/") & " " & objItem.ElementName) Then
DebugOut SVNamespace & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".HealthState: " & objItem.HealthState, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".DeviceID: " & objItem.DeviceID, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".NominalReading: " & objItem.NominalReading, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".CurrentReading: " & objItem.CurrentReading, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".UnitModifier: " & objItem.UnitModifier, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".RateUnits: " & objItem.RateUnits, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".BaseUnits: " & objItem.BaseUnits, DBG_DESC
If objItem.NominalReading > 0 Then
devProperty1(j) = objItem.NominalReading & "W" ' Nominal Reading
devProperty2(j) = objItem.CurrentReading * (10 ^ objItem.UnitModifier) & "W" ' Current Reading
Else
devProperty1(j) = "N/A"
devProperty2(j) = ""
End If
DebugOut "PSU " & j & ": '" & componentNameArray(j) & "', Nominal Power: " & devProperty1(j) & ", Current Power: " & devProperty2(j), DBG_INFO
j = j + 1
End If
Next
Next
On Error Goto 0
End If
End If
Else
If SVAgentRunning = true Then
Dim cab, l
If index > 0 Then
SCCIIndex = GetScciData(&H500, &H0, &H0, Cabinet)
j = 0
cab = 0
l = 0
For i=0 To SCCIIndex-1
strComponentValue = oSwitch.VBRequest(&H504, &H0, l, CabinetArray(cab), 0, 0, 0, ret)
if ret <> 0 Then
DebugOut "oSwitch: No Data for opCode=0x" & Hex(&H504) & " opCodeExt=0x" & Hex(&H0) & " objIndex=" & l & " cabID=" & CabinetArray(cab), DBG_DESC
cab = cab + 1
l = 0
Else
DebugOut "oSwitch: opCode=0x" & Hex(&H504) & " opCodeExt=0x" & Hex(&H0) & " objIndex=" & l & " cabID=" & CabinetArray(cab) & " -> scciValue = '" & strComponentValue & "'", DBG_DESC
End If
If Not StrComp(componentNameArray(j), CabinetArray(cab) & "/" & l & " " & strComponentValue) Then
devProperty1(j) = GetScciData(&H507, &H0, l, CabinetArray(cab))
If devProperty1(j) > 0 Then
devProperty1(j) = devProperty1(j) & "W"
devProperty2(j) = GetScciData(&H506, &H0, l, CabinetArray(cab)) & "W"
Else
devProperty1(j) = "N/A"
End If
DebugOut "PSU " & j & ": '" & componentNameArray(j) & "', Nominal Power: " & devProperty1(j) & ", Current Power: " & devProperty2(j), DBG_INFO
j = j + 1
End If
l = l + 1
Next
End If
End If
End If
componentNames = "Power Supplies: " & index
componentInfos = ""
If componentCountEmpty > 0 Then componentInfos = "Not populated Power Supplies: " & componentCountEmpty End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.PowerSupplies']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
For i=0 To index-1
DebugOut "Create " & "PowerSupply" & " instance: " & componentNameArray(i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.PowerSupply']$")
AddSimpleDeviceData oInst, componentNameArray(i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.PowerSupply']/Nominal$", devProperty1(i)
Call oDiscoveryData.AddInstance(oInst)
Next
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** Power Consumption
'-----------------------------
componentSubSystemType = POWERCONSUMP
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
Dim PCPowerControlModeSet, PCPowerControlModePerformed
InitStatus()
index = 0
If CIMProvider = True Then
SVAgentClass = "SVS_PGYPowerConsumptionSensor"
Set colItems = WMIQuery(TargetComputer, SVNamespace, "SELECT * FROM " & SVAgentClass, True)
index = 0
If WMIInstanceValid = FALSE Then
DebugOut "'" & SVAgentClass & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
' Info: ServerView Agents SCCI only supply the 'Total Power' sensor (#E0) with sensible values.
' Ignore all others here
DebugOut SVNamespace & ":" & SVAgentClass & ".Name: " & objItem.Name, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".DeviceID: " & objItem.DeviceID, DBG_DESC
DebugOut SVNamespace & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
If Instr(LCase(objItem.DeviceID), "e0") Then
If InStr(objItem.ElementName, "Total Power") Then
If InStr(objItem.ElementName, "Out") Then
DebugOut "Do not use OutPut PowerConsumption Sensor " & objItem.ElementName, DBG_INFO
Else
DebugOut "PowerConsumption Sensor " & objItem.ElementName & ", CurrentState '" & objItem.CurrentState & "', Status " & objItem.HealthState & " [" & SCOM_HealthState(objItem.HealthState) & "]", DBG_INFO
componentNameArray(index) = "Power Level"
componentInfoArray(index) = "Sensor: " & objItem.ElementName
index = index + 1
End If
Else
DebugOut "Skip PowerConsumption Sensor " & objItem.ElementName , DBG_INFO
End If
Else
DebugOut "Ignore PowerConsumption Sensor " & objItem.ElementName , DBG_INFO
End If
Next
On Error Goto 0
End If
Else
If SVAgentRunning = true Then
Dim PCIndex, PCDesignation, PCCurrentVal, PCLimitStatus
Dim PCComponentClass, PCComponentArray
PCComponentClass = Array(&H00, &H1D, &H20, &H03, &H0A, &HE0)
PCComponentArray = Array("All", "Fan", "Memory", "CPU", "Power Supply", "Total")
' Info: ServerView Agents SCCI only supply the 'Total Power' sensor with sensible values.
' Ignore all others here for now and only request Total Power
On Error Resume Next
PCIndex = 5
' For PCIndex=1 To Ubound(PCComponentClass)
SCCIindex = GetScciData(&H0531, PCComponentClass(PCIndex), &H0, Cabinet)
If IsNull(SCCIIndex) Or Len(SCCIIndex) = 0 Then SCCIIndex = 0 End If
DebugOut "PowerConsumptionClassComponents '" & PCComponentArray(PCIndex) & "' Number: " & SCCIindex , DBG_DESC
For i=0 To SCCIindex-1
PCDesignation = GetScciData(&H0532, PCComponentClass(PCIndex), i, Cabinet)
If PCComponentClass(PCIndex) = &HE0 Then
If InStr(PCDesignation, "Out") Then
DebugOut "Do not use OutPut PowerConsumption Sensor " & PCDesignation, DBG_INFO
Else
DebugOut "PowerConsumption Sensor '" & PCIndex & "/" & i & "' (0x" & Hex(PCComponentClass(PCIndex)) & ") '" & PCDesignation & "'", DBG_INFO
componentNameArray(index) = "Power Level"
componentInfoArray(index) = "Sensor: " & PCDesignation
index = index + 1
End If
Else
DebugOut "Ignore PowerConsumption Sensor " & PCDesignation, DBG_INFO
End If
Next
' Next
On Error Goto 0
End If
End If
DebugOut "Number of Power Consumption Sensors: " & index, DBG_INFO
If index > 0 Then
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.PowerConsumption']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
DebugOut "Create relationship ServerContainsPowerConsumption", DBG_SCOM
Set oRelationship = oDiscoveryData.CreateRelationshipInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.ServerContainsPowerConsumption']$")
oRelationship.Source = oServer
oRelationship.Target = oInst
Call oDiscoveryData.AddInstance(oRelationship)
End If
Call CheckSavedComponents(componentSubSystemType, index)
Else
DebugOut "Did not find any components of type '" & ComponentsList(componentSubSystemType) & "'", DBG_INFO
End If
'*** RAID Subsystem
'-----------------------------
componentSubSystemType = RAIDSUBSYSTEM
DebugOut "***** " & ComponentsList(RAIDSUBSYSTEM) & " *****", DBG_ALL
DebugOut "***** " & ComponentsList(LOGICALDRIVE) & " *****", DBG_ALL
DebugOut "***** " & ComponentsList(PHYSICALDISK) & " *****", DBG_ALL
Dim ldIndexAll, pdIndexAll
Dim ldInfos, pdInfos
Dim pos
If SVAgentRunning = true Then
ctrlIndex = 0
ldIndexAll = 0
pdIndexAll = 0
ctrlIndex = GetScciData(&H2110, 0, 0, Cabinet)
DebugOut "Number of RAID controllers: " & ctrlIndex, DBG_INFO
If Len(ctrlIndex) > 0 And ctrlIndex > 0 Then
For pos=0 To ctrlIndex - 1
strComponentValue = GetScciData(&H2111, &H0, pos, Cabinet)
If Len(strComponentValue) > 0 Then
adapterNameArray(pos) = strComponentValue
Else
adapterNameArray(pos) = "Adapter " & pos
End If
intComponentValue = GetScciData(&H2112, &H0, pos, Cabinet)
Select Case intComponentValue
case 0: adapterInfoArray(pos) = "SCSI"
case 1: adapterInfoArray(pos) = "ATAPI"
case 2: adapterInfoArray(pos) = "PATA"
case 3: adapterInfoArray(pos) = "Firewire IEEE 1394"
case 4: adapterInfoArray(pos) = "SSA"
case 5: adapterInfoArray(pos) = "Fibre"
case 6: adapterInfoArray(pos) = "USB"
case 7: adapterInfoArray(pos) = "SATA"
case 8: adapterInfoArray(pos) = "SAS"
case 9: adapterInfoArray(pos) = "RAID"
case 10: adapterInfoArray(pos) = "MMC"
case 11: adapterInfoArray(pos) = "SD card bus"
End Select
DebugOut "RAID Controller " & pos & ", Name " & adapterNameArray(pos) & ", " & adapterInfoArray(pos), DBG_INFO
devProperty1(pos) = GetScciProperty(&H211D, &H0, pos, Cabinet, "Vendor")
devProperty2(pos) = GetScciProperty(&H211D, &H0, pos, Cabinet, "SerialNumber")
strComponentValue = GetScciProperty(&H211D, &H0, pos, Cabinet, "DriverName")
If Len(strComponentValue) > 0 Then
devProperty3(pos) = strComponentValue & ", V" & GetScciProperty(&H211D, &H0, pos, Cabinet, "DriverVersion")
Else
devProperty3(pos) = ""
End If
devProperty4(pos) = GetScciProperty(&H211D, &H0, pos, Cabinet, "FirmwareVersion")
ldIndex(pos) = 0
ldIndex(pos) = GetScciData(&H2150, pos, 0, Cabinet)
If Len(ldIndex(pos)) > 0 And ldIndex(pos) > 0 Then
DebugOut "Number of Log. Drives on RAID Adapter " & adapterNameArray(pos) & ": " & ldIndex(pos), DBG_INFO
On Error Resume next
For i=0 To ldIndex(pos)-1
strComponentValue = GetScciData(&H2152, pos, i, Cabinet)
intComponentValue = GetScciData(&H2155, pos, i, Cabinet)
If Len(strComponentValue) > 0 Then
j = InStr(strComponentValue, " (")
If j > 0 Then
strComponentValue = Left(strComponentValue, j-1)
End If
LDperCtrlNameArray(pos, i) = strComponentValue & " (" & pos & "/" & i & ")"
Else
LDperCtrlNameArray(pos, i) = "Logical Drive (" & pos & "/" & i & ")"
End If
If Len(intComponentValue) > 0 Then
LDperCtrlInfoArray(pos, i) = intComponentValue
'Else
'LDperCtrlInfoArray(pos, i) = "None"
End If
LDProperty1(pos, i) = GetScciData(&H2153, pos, i, Cabinet)
If VarType(LDProperty1(pos, i)) = 2 Or VarType(LDProperty1(pos, i)) = 3 Then
cabString = CabinetLongToString(LDProperty1(pos, i))
Else
cabString = CabinetByteArrayToString(LDProperty1(pos, i))
End If
LDProperty1(pos, i) = ConvertToMatchingUnit(CLng("&H" & cabString) * 1024 * 1024)
DebugOut "LDProperty1(" & pos & "," & i & "): '" & LDProperty1(pos, i) & "'", DBG_INFO
LDProperty2(pos, i) = GetScciData(&H2154, pos, i, Cabinet)
If VarType(LDProperty2(pos, i)) = 2 Or VarType(LDProperty2(pos, i)) = 3 Then
cabString = CabinetLongToString(LDProperty2(pos, i))
Else
cabString = CabinetByteArrayToString(LDProperty2(pos, i))
End If
LDProperty2(pos, i) = ConvertToMatchingUnit(CLng("&H" & cabString) * 1024 * 1024)
DebugOut "LDProperty2(" & pos & "," & i & "): '" & LDProperty2(pos, i) & "'", DBG_INFO
DebugOut "Log. Drive " & pos & "/" & i & ": " & LDperCtrlNameArray(pos, i) & " " & LDperCtrlInfoArray(pos, i), DBG_INFO
ldIndexAll = ldIndexAll + 1
Next
On Error Goto 0
Else
ldIndex(pos) = 0
End If
pdIndex(pos) = 0
pdIndex(pos) = GetScciData(&H2130, pos, 0, Cabinet)
If Len(pdIndex(pos)) > 0 And pdIndex(pos) > 0 Then
DebugOut "Number of Phys. Disks on RAID Adapter " & adapterNameArray(pos) & ": " & pdIndex(pos), DBG_INFO
For i=0 To pdIndex(pos)-1
strComponentValue = GetScciData(&H2133, pos, i, Cabinet)
intComponentValue = GetScciData(&H2135, pos, i, Cabinet) * 1024 * 1024
If Len(strComponentValue) > 0 Then
j = InStr(strComponentValue, " (")
If j > 0 Then
strComponentValue = Left(strComponentValue, j-1)
End If
PDperCtrlNameArray(pos, i) = strComponentValue & " (" & pos & "/" & i & ")"
Else
PDperCtrlNameArray(pos, i) = "Physical Disk (" & pos & "/" & i & ")"
End If
DebugOut "Phys. Disk " & pos & "/" & i & ": " & PDperCtrlNameArray(pos, i) & " " & PDperCtrlInfoArray(pos, i), DBG_INFO
pdIndexAll = pdIndexAll + 1
Next
Else
pdIndex(pos) = 0
End If
Next
Else
ctrlIndex = 0
End If
End If
DebugOut "Number of RAID Controllers: " & ctrlIndex, DBG_INFO
DebugOut "Number of Log. Drives: " & ldIndexAll, DBG_INFO
DebugOut "Number of Phys. Disks: " & pdIndexAll, DBG_INFO
For i=0 To 50
devType(i) = ""
devNo(i) = 0
Next
For pos=0 To ctrlIndex - 1
For i=0 To ldIndex(pos)-1
For index=0 To 50
If devType(index) = "" Then
devType(index) = LDperCtrlInfoArray(pos, i)
devNo(index) = 1
Exit For
ElseIf LDperCtrlInfoArray(pos, i) = devType(index) Then
devNo(index) = devNo(index) + 1
Exit For
End If
Next
Next
Next
ldInfos = ""
For i=0 To 50
If Not devType(i) = "" Then
ldInfos = ldInfos & "'" & devType(i) & "': " & devNo(i) & ", "
End If
Next
If Len(ldInfos) > 2 Then
ldInfos = Left(ldInfos, Len(ldInfos) - 2)
End If
For i=0 To 50
devType(i) = ""
devNo(i) = 0
Next
For pos=0 To ctrlIndex - 1
For i=0 To pdIndex(pos)-1
For index=0 To 50
If devType(index) = "" Then
devType(index) = PDperCtrlInfoArray(pos, i)
devNo(index) = 1
Exit For
ElseIf PDperCtrlInfoArray(pos, i) = devType(index) Then
devNo(index) = devNo(index) + 1
Exit For
End If
Next
Next
Next
pdInfos = ""
For i=0 To 50
If Not devType(i) = "" Then
pdInfos = pdInfos & "'" & devType(i) & "': " & devNo(i) & ", "
End If
Next
If Len(pdInfos) > 2 Then
pdInfos = Left(pdInfos, Len(pdInfos) - 2)
End If
componentNames = "RAID Controllers: " & ctrlIndex
componentInfos = "Logical Drives: " & ldIndexAll
If ldInfos <> "" Then componentInfos = componentInfos & ", " & ldInfos End If
componentInfos = componentInfos & "; Physical Disks: " & pdIndexAll
If pdInfos <> "" Then componentInfos = componentInfos & ", " & pdInfos End If
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If ctrlIndex > 0 Then
If insideMP = true Then
DebugOut "Create " & "RaidComponents" & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidComponents']$")
AddComponentData oInst, RAIDSUBSYSTEM, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
DebugOut "Create " & SVRaidOverallState & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.SVRaidOverallState']$")
AddOtherDeviceData oInst, SVRaidOverallState, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
' *** loop though controllers
For pos=0 To ctrlIndex-1
DebugOut "Create " & "RAID Controller " & pos & " instance: " & adapterNameArray(pos), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidController']$")
AddRaidControllerData oInst, "RAID Controller " & pos, adapterNameArray(pos), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidController']/Type$", adapterInfoArray(pos)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidController']/Vendor$", devProperty1(pos)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidController']/SerialNumber$", devProperty2(pos)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidController']/Driver$", devProperty3(pos)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidController']/FirmwareVersion$", devProperty4(pos)
Call oDiscoveryData.AddInstance(oInst)
If ldIndex(pos) > 0 Then
DebugOut "Create " & ComponentsList(LOGICALDRIVE) & " " & pos & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidLogicalDrives']$")
AddRaidDeviceGroupData oInst, ComponentsList(LOGICALDRIVE) & " " & pos, adapterNameArray(pos), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
For i=0 To ldIndex(pos)-1
DebugOut "Create " & "RAID Logical Drive " & pos & "/" & i & " instance: " & LDperCtrlNameArray(pos, i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidLogicalDrive']$")
AddRaidDeviceData oInst, "RAID Logical Drive " & pos & "/" & i, adapterNameArray(pos), LDperCtrlNameArray(pos, i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidLogicalDrive']/Type$", LDperCtrlInfoArray(pos, i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidLogicalDrive']/Size$", LDProperty1(pos, i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidLogicalDrive']/PhysicalSize$", LDProperty2(pos, i)
Call oDiscoveryData.AddInstance(oInst)
Next
Else
DebugOut "Did not find any components of type '" & ComponentsList(LOGICALDRIVE) & "' on " & ComponentsList(RAIDSUBSYSTEM) & " " & pos & " instance (" & adapterNameArray(pos) & ")", DBG_SCOM
End If
' *** handle physical disks per controller
If pdIndex(pos) > 0 Then
DebugOut "Create " & ComponentsList(PHYSICALDISK) & " " & pos & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisks']$")
AddRaidDeviceGroupData oInst, ComponentsList(PHYSICALDISK) & " " & pos, adapterNameArray(pos), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
For i=0 To pdIndex(pos)-1
DebugOut "Create " & "RAID Physical Disk " & pos & "/" & i & " instance: " & PDperCtrlNameArray(pos, i), DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisk']$")
AddRaidDeviceData oInst, "RAID Physical Disk " & pos & "/" & i, adapterNameArray(pos), PDperCtrlNameArray(pos, i), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisk']/Size$", PDperCtrlInfoArray(pos, i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisk']/FirmwareRevision$", PDProperty1(pos, i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisk']/ModelName$", PDProperty2(pos, i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisk']/SerialNumber$", PDProperty3(pos, i)
AddMPElement oInst, "$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.RaidPhysicalDisk']/VendorName$", PDProperty4(pos, i)
Call oDiscoveryData.AddInstance(oInst)
Next
Else
DebugOut "Did not find any components of type '" & ComponentsList(PHYSICALDISK) & "' on " & ComponentsList(RAIDSUBSYSTEM) & " " & pos & " instance (" & adapterNameArray(pos) & ")", DBG_INFO
End If
Next
End If
Call CheckSavedComponents(RAIDSUBSYSTEM, ctrlIndex)
Call CheckSavedComponents(LOGICALDRIVE, ldIndexAll)
Call CheckSavedComponents(PHYSICALDISK, pdIndexAll)
Else
DebugOut "Did not find any components of type '" & ComponentsList(RAIDSUBSYSTEM) & "'", DBG_INFO
DebugOut "Did not find any components of type '" & ComponentsList(LOGICALDRIVE) & "'", DBG_INFO
DebugOut "Did not find any components of type '" & ComponentsList(PHYSICALDISK) & "'", DBG_INFO
End If
'*** Other
'-----------------------------
componentSubSystemType = OTHER
DebugOut "***** " & ComponentsList(componentSubSystemType) & " *****", DBG_ALL
InitStatus()
If Len(SVAgentVersion) > 0 Then
If SVAgentRunning = false Then
componentNameArray(0) = SVAgentOverallState
componentInfoArray(0) = ""
componentNameArray(1) = SVCommunicationMonitor
componentInfoArray(1) = ""
index = 3
Else
index = GetComponents(CIMProvider, TargetComputer, componentSubSystemType)
End If
DebugOut "Number of Other components: " & index, DBG_INFO
componentNames = "Other Components: " & index
DebugOut "Discovered Components: " & componentNames, DBG_INFO
DebugOut "Discovered Component Infos: " & componentInfos, DBG_INFO
If insideMP = true Then
DebugOut "Create " & ComponentsList(componentSubSystemType) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.OtherComponents']$")
AddComponentData oInst, componentSubSystemType, PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName, MonitoringAgents, RaidManager
Call oDiscoveryData.AddInstance(oInst)
If index > 0 Then
DebugOut "Create " & componentNameArray(0) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.SVOverallState']$")
AddOtherDeviceData oInst, componentNameArray(0), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
End If
If index > 1 Then
DebugOut "Create " & componentNameArray(1) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.CommunicationMonitor']$")
AddOtherDeviceData oInst, componentNameArray(1), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
End If
If index > 2 Then
DebugOut "Create " & componentNameArray(2) & " instance", DBG_SCOM
Set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name='Fujitsu.Servers.PRIMERGY.Windows.BiosSelftest']$")
AddOtherDeviceData oInst, componentNameArray(2), PrincipalName, TargetComputer, BMCIPv4Addr, iRMCDNSName
Call oDiscoveryData.AddInstance(oInst)
End If
End If
Call CheckSavedComponents(componentSubSystemType, index)
End If
'*** Send the data to OpsMgr
'------------------------------------------------
If insideMP = true Then
DebugOut "***** Return oDiscoveryData to OM; Normal exit *****", DBG_ALL
Call oAPI.Return(oDiscoveryData) ' Submit the data
If DebugMode = True Then WScript.Echo "" End If
End If
DebugOut "***** Normal end of script. *****", DBG_ALL
If DebugFile = True Then
If IsObject(oLogStream) Then oLogStream.Close() End If
End If
Function GetComponents(CIMProvider, TargetComputer, SubSystemNumber)
Dim componentHealthState, componentHealthStateNumber, SVAgentClass
Dim colItems, objItem, index, ret
Dim sysNo, subsysNo, subsyscompNo, subsyscompWord, scciState, scciName, scciDesc
Dim i, j, k, l
Dim SubSystem, scciText, cab
Dim DevCabinet, DevIndex
componentCount = 0
componentCountEmpty = 0
If CIMProvider = True Then
SVAgentClass = "SVS_PGYHealthStateComponent"
SubSystem = cimHealthStateSubsystem(SubSystemNumber)
If SubSystemNumber = OTHER Then
DebugOut "GetComponents for '" & SubSystem & "'", DBG_DATA
Set colItems = WMIQuery(TargetComputer, svsNS, "SELECT * FROM " & SVAgentClass & " WHERE Caption='" & Subsystem & "'", True)
If WMIInstanceValid = FALSE Then
DebugOut SVAgentClass & " for '" & SubSystem & "' delivered no data.", DBG_DATA
Else
On Error Resume Next
For Each objItem in colItems
DebugOut svsNS & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut svsNS & ":" & SVAgentClass & ".HealthState: " & objItem.HealthState, DBG_DESC
componentNameArray(componentCount) = SVAgentOverallState
DebugOut "Component " & componentCount & ": '" & componentNameArray(componentCount) & "', " & objItem.HealthState & " [" & SCOM_HealthState(objItem.HealthState) & "]", DBG_DATA
componentCount = componentCount + 1
componentNameArray(componentCount) = SVCommunicationMonitor
DebugOut "Component " & componentCount & ": " & componentNameArray(componentCount) & ": " & objItem.HealthState & " [" & componentStatusArray(componentCount) & "]", DBG_DATA
componentCount = componentCount + 1
Next
On Error Goto 0
End If
SubSystem = cimHealthStateSubsystem(SELFTEST)
End If
DebugOut "GetComponents for '" & SubSystem & "'", DBG_DATA
Set colItems = WMIQuery(TargetComputer, svsNS, "SELECT * FROM " & SVAgentClass & " WHERE Caption LIKE '%" & SubSystem & "%'", True)
If WMIInstanceValid = FALSE Then
DebugOut SVAgentClass & " for '" & SubSystem & "' delivered no data.", DBG_DATA
Else
index = 0
DevCabinet = Cabinet
On Error Resume Next
For Each objItem in colItems
If SubSystemNumber = OTHER Then
DebugOut svsNS & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut svsNS & ":" & SVAgentClass & ".HealthState: " & objItem.HealthState, DBG_DESC
componentNameArray(componentCount) = objItem.ElementName
DebugOut "Component " & index & ": '" & componentNameArray(componentCount) & "', " & objItem.HealthState & " [" & SCOM_HealthState(objItem.HealthState) & "]", DBG_DATA
componentCount = componentCount + 1 ' we only count existing components
End If
' It is an actual component if the InstanceID is something like '0-0-0-0'
' Except for PowerConsumption where we need to request the '0-0-0' Level
DebugOut svsNS & ":" & SVAgentClass & ".Caption: " & objItem.Caption, DBG_DESC
DebugOut svsNS & ":" & SVAgentClass & ".InstanceID: " & objItem.InstanceID, DBG_DESC
If UBound(Split(objItem.InstanceID, "-")) > 2 Or (SubSystemNumber = POWERCONSUMP And UBound(Split(objItem.InstanceID, "-")) > 1) Then
DebugOut svsNS & ":" & SVAgentClass & ".Presence: " & objItem.Presence, DBG_DESC
DebugOut svsNS & ":" & SVAgentClass & ".ElementName: " & objItem.ElementName, DBG_DESC
DebugOut svsNS & ":" & SVAgentClass & ".HealthState: " & objItem.HealthState, DBG_DESC
If SubSystemNumber = FANS Or SubSystemNumber = TEMPERATURE Or SubSystemNumber = POWERSUPPLY Then
DebugOut svsNS & ":" & SVAgentClass & ".AssociationKey: " & objItem.AssociationKey, DBG_DESC
DevIndex = CInt("&H" & Mid(objItem.AssociationKey,6,4))
If Len(objItem.AssociationKey) > 9 Then
DevCabinet = CInt("&H" & Mid(objItem.AssociationKey,16,4))
End If
componentNameArray(componentCount) = DevCabinet & "/" & DevIndex & " " & objItem.ElementName
Else
componentNameArray(componentCount) = objItem.ElementName
End If
If objItem.Presence = 1 Then
DebugOut "Component " & index & ": '" & componentNameArray(componentCount) & "', " & objItem.HealthState & " [" & SCOM_HealthState(objItem.HealthState) & "]", DBG_DATA
componentCount = componentCount + 1 ' we only count existing components
Else
componentCountEmpty = componentCountEmpty + 1
componentNameArray(componentCount) = ""
End If
index = index + 1
End If
Next
On Error Goto 0
End If
Else
If SVAgentRunning = true Then
SubSystem = scciHealthStateSubsystem(SubSystemNumber)
DebugOut "GetComponents for '" & SubSystem & "'", DBG_DATA
scciText = Split(SubSystem, " - ")
If SubSystemNumber = OTHER Then
componentNameArray(componentCount) = SVAgentOverallState
DebugOut "Component " & componentCount & ": " & componentNameArray(componentCount), DBG_DATA
componentCount = componentCount + 1 ' we only count existing components
componentNameArray(componentCount) = SVCommunicationMonitor
DebugOut "Component " & componentCount & ": " & componentNameArray(componentCount), DBG_DATA
componentCount = componentCount + 1
scciText = Split(scciHealthStateSubsystem(SELFTEST), " - ")
End If
sysNo = GetScciData(&H2300, 0, 0, Cabinet)
DebugOut "Got " & sysNo & " Status Tree Subsystems", DBG_DESC
For i=0 To sysNo-1
scciName = GetScciData(&H2302, i, 0, Cabinet)
DebugOut i & " Subsystem: " & scciName, DBG_DESC
If scciText(0) = scciName Then
subsysNo = GetScciData(&H2305, i, 0, Cabinet)
DebugOut " Got " & subsysNo & " Status Tree Subsys Classes", DBG_DESC
For j=0 To subsysNo-1
scciName = GetScciData(&H2307, i, j, Cabinet)
DebugOut " " & i & "/" & j & " SubsystemClass: " & scciName, DBG_DESC
If scciText(1) = scciName Then
subsyscompWord = i * &H10000 + j
subsyscompNo = GetScciData(&H2320, subsyscompWord, 0, Cabinet)
DebugOut " Got " & subsyscompNo & " Status Tree Subsys Components", DBG_DESC
cab = 0
l = 0
For k=0 To subsyscompNo-1
If k > cMAXINDEX Then
DebugOut "Max. no. of '" & scciName & "' instances (" & cMAXINDEX & ") reached/exceeded", DBG_DESC
Exit For
End If
scciState = oSwitch.VBRequest(&H2322, subsyscompWord, l, CabinetArray(cab), 0, 0, 0, ret)
if ret <> 0 Then
DebugOut "oSwitch: No Data for opCode=0x" & Hex(&H2322) & " opCodeExt=0x" & Hex(subsyscompWord) & " objIndex=" & l & " cabID=" & CabinetArray(cab), DBG_DESC
cab = cab + 1
l = 0
scciState = oSwitch.VBRequest(&H2322, subsyscompWord, l, CabinetArray(cab), 0, 0, 0, ret)
if ret <> 0 Then
DebugOut "oSwitch: No Data for opCode=0x" & Hex(&H2322) & " opCodeExt=0x" & Hex(subsyscompWord) & " objIndex=" & l & " cabID=" & CabinetArray(cab), DBG_DESC
Else
DebugOut "oSwitch: opCode=0x" & Hex(&H2322) & " opCodeExt=0x" & Hex(subsyscompWord) & " objIndex=" & l & " cabID=" & CabinetArray(cab) & " -> scciValue = '" & scciState & "'", DBG_DESC
End If
Else
DebugOut "oSwitch: opCode=0x" & Hex(&H2322) & " opCodeExt=0x" & Hex(subsyscompWord) & " objIndex=" & l & " cabID=" & CabinetArray(cab) & " -> scciValue = '" & scciState & "'", DBG_DESC
End If
scciDesc = GetScciData(&H2324, subsyscompWord, l, CabinetArray(cab))
If SubSystemNumber = FANS Or SubSystemNumber = TEMPERATURE Or SubSystemNumber = POWERSUPPLY Then
componentNameArray(componentCount) = CabinetArray(cab) & "/" & l & " " & scciDesc
ElseIf SubSystemNumber = OTHER Then
componentNameArray(componentCount) = GetScciData(&H2308, i, j, cab)
ElseIf SubSystemNumber = POWERCONSUMP Then
componentNameArray(componentCount) = "Power Level"
Else
componentNameArray(componentCount) = scciDesc
End If
If scciState < 0 Or scciState > 5 Then
componentStatusArray(componentCount) = STATUS_INVALID
Else
componentStatusArray(componentCount) = scciHealthStateString(scciState)
End If
If componentStatusArray(componentCount) <> STATUS_NOTPRESENT Then
DebugOut " " & i & "/" & j & "/" & k & ": SubSystemComponent: '" & componentNameArray(componentCount) & "', '" & scciState & "' [" & componentStatusArray(componentCount) & "]", DBG_DATA
componentCount = componentCount + 1 ' we only count existing components
Else
componentCountEmpty = componentCountEmpty + 1
componentNameArray(componentCount) = ""
componentStatusArray(componentCount) = ""
End If
l = l + 1
Next
j = subsysNo
i = sysNo
End If
Next
End If
Next
Else
DebugOut "Agent is *** NOT *** running ...", DBG_DATA
End If
End If
Function CheckSavedComponents(componentSubSystemType, componentNumber)
DebugOut "Found '" & componentNumber & "' instances of component '" & ComponentsStateList(componentSubSystemType) & "' (was " & ComponentsPYServerData(componentSubSystemType) & ")", DBG_INFO
If CInt(ComponentsPYServerData(componentSubSystemType)) = CInt("-1") Then
componentNumber = SavePYServerData(ComponentsStateList(componentSubSystemType), componentNumber)
DebugOut "Added '" & componentNumber & "' *NEW* '" & ComponentsStateList(componentSubSystemType) & "' instances to discovered components.", DBG_INFO
Else
If CInt(componentNumber) < CInt(ComponentsPYServerData(componentSubSystemType)) Then
If ComponentsPYServerDataValid(componentSubSystemType) <> "" Then
DebugOut "Missing '" & ComponentsPYServerData(componentSubSystemType) - componentNumber & "' instances of '" & ComponentsStateList(componentSubSystemType) & "' (expected '" & ComponentsPYServerData(componentSubSystemType) & "', found '" & componentNumber & "')!", DBG_INFO
' Do not save the new number of components.
' Admin must manually reset all saved component data to acknowledge missing components.
LogScriptEvent 250, ERROR_EVENT, "Missing '" & ComponentsPYServerData(componentSubSystemType) - componentNumber & "' instances of '" & ComponentsStateList(componentSubSystemType) & "' (expected '" & ComponentsPYServerData(componentSubSystemType) & "', found '" & componentNumber & "')!"
Else
DebugOut "*MAYBE* missing '" & ComponentsPYServerData(componentSubSystemType) - componentNumber & "' instances of '" & ComponentsStateList(componentSubSystemType) & "' (expected '" & ComponentsPYServerData(componentSubSystemType) & "', found '" & componentNumber & "')! Wait for next discovery to be sure.", DBG_INFO
SavePYServerData ComponentsStateList(componentSubSystemType) & "Valid", "yes"
End If
componentNumber = ComponentsPYServerData(componentSubSystemType)
Else
If CInt(componentNumber) > CInt(ComponentsPYServerData(componentSubSystemType)) Then
DebugOut "Found '" & componentNumber - ComponentsPYServerData(componentSubSystemType) & "' *ADDITIONAL* instances of '" & ComponentsStateList(componentSubSystemType) & "'.", DBG_INFO
LogScriptEvent 200, INFORMATIONAL_EVENT, "Found '" & componentNumber - ComponentsPYServerData(componentSubSystemType) & "' *ADDITIONAL* instances of '" & ComponentsStateList(componentSubSystemType) & "' (expected '" & ComponentsPYServerData(componentSubSystemType) & "', found '" & componentNumber & "')."
End If
If ComponentsPYServerDataValid(componentSubSystemType) <> "" Then
DeletePYServerData(ComponentsStateList(componentSubSystemType) & "Valid")
End If
End If
DebugOut "Keep '" & componentNumber & "' '" & ComponentsStateList(componentSubSystemType) & "' instances for discovered components.", DBG_INFO
End If
CheckSavedComponents = componentNumber
End Function
Function GetiRMCDNSName
Dim BMCHttpPort, BMCHttpsPort, BMCHttpsEnabled
Dim BMCUseBmcName, BMCAddSerial, BMCAddExt, BMCNameExt, BMCBoardSerial, BMCMACAddrArr, BMCMACAddr
Dim BMCBmcName, iRMCDNSName, BMCDNSDomain
Dim i, Status, BMCError
If BMCHttpsEnabled Then
BMCHttpsPort = GetScciData(&HE001, &H1421, &H0, Cabinet)
DebugOut "BMC Https Port: " & BMCHttpsPort, DBG_INFO
Else
BMCHttpPort = GetScciData(&HE001, &H1420, &H0, Cabinet)
DebugOut "BMC Http Port: " & BMCHttpPort, DBG_INFO
End If
BMCError = 0
BMCUseBmcName = GetScciData(&HE001, &H1431, &H0, Cabinet)
If IsNull(BMCUseBmcName) Or Len(BMCUseBmcName) = 0 Then
BMCError = BMCError + 1
BMCUseBmcName = 0 'set to a defined / usable value
End If
DebugOut "Use Bmc Name = " & isEnabled(BMCUseBmcName), DBG_INFO
BMCAddSerial = GetScciData(&HE001, &H1433, &H0, Cabinet)
If IsNull(BMCAddSerial) Or Len(BMCAddSerial) = 0 Then
BMCError = BMCError + 1
BMCAddSerial = 0 'set to a defined / usable value
End If
DebugOut "Add Serial = " & isEnabled(BMCAddSerial), DBG_INFO
If isEnabled(BMCAddSerial) = true Then
BMCMACAddrArr = oSwitch.VBRequest(&HE001, &H1445, 0, Cabinet, 0, 0, 0, Status)
If Status = 0 Then
DebugOut "oSwitch: opCode=0x" & Hex(&HE001) & " opCodeExt=0x" & Hex(&H1445) & " objIndex=" & 0 & " cabID=" & Cabinet & " -> scciValue = '[Array]'", DBG_DESC
BMCMACAddr = ByteArrayToMAC(BMCMACAddrArr)
DebugOut "MAC address = " & BMCMACAddr, DBG_INFO
BMCBoardSerial = ByteArrayToiRMCMACSerial(BMCMACAddrArr)
DebugOut "MAC 'serial' = " & BMCBoardSerial, DBG_INFO
Else
DebugOut "oSwitch: No Data for opCode=0x" & Hex(&HE001) & " opCodeExt=0x" & Hex(&H1445) & " objIndex=" & 0 & " cabID=" & Cabinet, DBG_DESC
DebugOut "Err.Number = " & Err.Number, DBG_DATA
DebugOut "Status = " & Status, DBG_DATA
BMCError = BMCError + 1
BMCAddSerial = false
End If
End If
BMCAddExt = GetScciData(&HE001, &H1434, &H0, Cabinet)
If IsNull(BMCAddExt) Or Len(BMCAddExt) = 0 Then
BMCError = BMCError + 1
BMCAddExt = 0 'set to a defined / usable value
End If
DebugOut "Add Ext = " & isEnabled(BMCAddExt), DBG_INFO
If isEnabled(BMCAddExt) = true Then
BMCNameExt = GetScciData(&HE001, &H1432, 0, Cabinet)
If IsNull(BMCNameExt) Or Len(BMCNameExt) = 0 Then
BMCError = BMCError + 1
BMCAddExt = false
BMCAddExt = ""
End If
DebugOut "BMC network name extension = " & BMCNameExt, DBG_INFO
End If
If isEnabled(BMCUseBmcName) = true Then
BMCBmcName = GetScciData(&HE001, &H1430, 0, Cabinet)
If IsNull(BMCBmcName) Or Len(BMCBmcName) = 0 Then
BMCError = BMCError + 1
BMCBmcName = ""
End If
DebugOut "BMC network name = " & BMCBmcName, DBG_INFO
Else
' misuse same variable holding the result ...
BMCBmcName = GetScciData(&HE001, &H0201, 0, Cabinet)
If IsNull(BMCBmcName) Or Len(BMCBmcName) = 0 Then
BMCError = BMCError + 1
BMCBmcName = ""
End If
DebugOut "system's node name = " & BMCBmcName, DBG_INFO
End If
If BMCError > 1 Then
GetiRMCDNSName = "N/A"
Else
' Strip whitespaces from Hostname
BMCBmcName = Trim(BMCBmcName)
BMCBmcName = Replace(BMCBmcName," ","-")
BMCBmcName = Replace(BMCBmcName,vbTab,"-")
' // Find "." in Hostname and terminate
i = inStr(BMCBmcName, ".")
If i = 0 Then
i = lenb(BMCBmcName)
End If
BMCBmcName = Left(BMCBmcName, i)
DebugOut "BMC name = '" & BMCBmcName & "'", DBG_INFO
If isEnabled(BMCAddSerial) = true Then
iRMCDNSName = BMCBmcName & Trim(BMCBoardSerial)
Else
iRMCDNSName = BMCBmcName
End If
If isEnabled(BMCAddExt) = true Then
iRMCDNSName = iRMCDNSName & Trim(BMCNameExt)
End If
DebugOut "BMC DNS name = '" & iRMCDNSName & "'", DBG_INFO
BMCDNSDomain = GetScciData(&HE001, &H144D, 0, Cabinet)
If IsNull(BMCDNSDomain) Or Len(BMCDNSDomain) = 0 Then
DebugOut "BMC domain name not set!", DBG_INFO
BMCDNSDomain = ""
Else
iRMCDNSName = iRMCDNSName & "." & BMCDNSDomain
DebugOut "BMC DNS name = '" & iRMCDNSName & "'", DBG_INFO
End If
If BMCHttpsEnabled = 0 Then
If BMCHttpPort <> "" Then
GetiRMCDNSName = "http://" & iRMCDNSName & ":" & BMCHttpPort
Else
GetiRMCDNSName = "http://" & iRMCDNSName
End If
Else
If BMCHttpsPort <> "" Then
GetiRMCDNSName = "https://" & iRMCDNSName & ":" & BMCHttpsPort
Else
GetiRMCDNSName = "https://" & iRMCDNSName
End If
End If
End If
J = lenb(bytearray)
For I=1 to J
B(I-1) = right("0" & hex(AscB(MidB(bytearray,I,1))),2)
Next
ByteArrayToMAC = B(0)
For I=2 to J
ByteArrayToMAC = ByteArrayToMAC & ":" & B(I-1)
Next
J = lenb(bytearray)
For I=1 to J
B(I-1) = right("0" & hex(AscB(MidB(bytearray,I,1))),2)
Next
ByteArrayToiRMCMACSerial = B(3)
For I=5 to J
ByteArrayToiRMCMACSerial = ByteArrayToiRMCMACSerial & B(I-1)
Next
LogIniFilePath = LogIniFileDir & "\" & SVISCOMLogIn_
If Not (oFSO.FileExists(LogIniFilePath)) Then
DebugOut LogIniFilePath & " is not available.", DBG_INFO
If Not oFSO.FolderExists(LogIniFileDir) Then
DebugOut "Create " & LogIniFileDir, DBG_INFO
oFSO.CreateFolder(LogIniFileDir)
Else
DebugOut LogIniFileDir & " is available.", DBG_INFO
End If
If Not (oFSO.FolderExists(LogIniFileDir)) Then
DebugOut "Log file folder " & LogIniFileDir & " could not be created. Abort logging to file.", DBG_ALL
DebugFile = false
Else
pathOK = True
End If
Else
DebugOut LogIniFilePath & " is available.", DBG_INFO
pathOK = True
Set oTextStream = oFSO.OpenTextFile(LogIniFilePath, 1, True)
Do While Not oTextStream.AtEndOfStream
thisLine = oTextStream.ReadLine
if InStr(thisLine, MPVERSION) Then
DebugOut "Found " & MPVersion & " in IN_ file.", DBG_INFO
fileOK = true
Exit Do
End If
Loop
oTextStream.Close
End If
' write new SVISCOMlog.in_ file
versionLine = "; SVISCOM Debug INI file for Windows MP Version " & MPVERSION
If pathOK = true And fileOK = False Then
' we write a new SVISCOMLog.in_ file, every time the MP is changed to make sure all INI-Values
' are documented for use by the customer if anything changes.
Set oTextStream = oFSO.OpenTextFile(LogIniFilePath, 2, True) ' 2 = new file for writing
DebugOut "Create " & LogIniFilePath, DBG_INFO
If Not IsNull(oTextStream) Then
DebugOut "Write values to " & LogIniFilePath, DBG_INFO
oTextStream.WriteLine versionLine
oTextStream.WriteLine "; "
oTextStream.WriteLine "; With this file logging for all scripts within the management pack can be enabled."
oTextStream.WriteLine "; Each of the Sections in this file represents a script."
oTextStream.WriteLine "; DebugMode enables logging (true|yes|1) or "
oTextStream.WriteLine "; disables logging (false|no|0)"
oTextStream.WriteLine "; OverWrite defines continuous logging (false|no|0) or"
oTextStream.WriteLine "; single script run logging (true|yes|1)"
oTextStream.WriteLine "; To avoid huge log files the files are moved to a folder with the actual date as"
oTextStream.WriteLine "; name every 30 days if Overwrite is set to 'false'." & vbCrLf
oTextStream.WriteLine "; Server Discovery Section"
oTextStream.WriteLine SEC_ServerDiscovery
oTextStream.WriteLine KEYVAL_DEBUGMODE
oTextStream.WriteLine KEYVAL_OVERWRITE & vbCrLf
oTextStream.WriteLine "; Component Monitor Section"
oTextStream.WriteLine SEC_ComponentsMonitor
oTextStream.WriteLine KEYVAL_DEBUGMODEALL
oTextStream.WriteLine KEYVAL_OVERWRITE & vbCrLf
oTextStream.WriteLine "; Fibre Channel Event Monitor Section"
oTextStream.WriteLine SEC_FCEvents
oTextStream.WriteLine KEYVAL_DEBUGMODE
oTextStream.WriteLine KEYVAL_OVERWRITE & vbCrLf
oTextStream.WriteLine "; Reset PRIMERGY Server Data Section"
oTextStream.WriteLine SEC_ResetPYServerData
oTextStream.WriteLine KEYVAL_DEBUGMODE
oTextStream.WriteLine KEYVAL_OVERWRITE & vbCrLf
oTextStream.WriteLine "; Performance Monitor Section"
oTextStream.WriteLine SEC_PerfMonMonitor
oTextStream.WriteLine KEYVAL_DEBUGMODE
oTextStream.WriteLine KEYVAL_OVERWRITE & vbCrLf
oTextStream.Close
End If
End If
' this means a new SVISCOM MP has just been installed (SVISCOMlog.in_ had a other version)
If fileOK = False Then
DebugOut "New MPVersion V" & MPVersion, DBG_INFO
'*** delete old FSC 32-bit reg path
Registry.GetStringValue HKEY_LOCAL_MACHINE, regPath32_FSC, "Manufacturer", strValue
If strValue <> "" Then
DebugOut "Found PY data in old FSC 32-bit registry path. Delete: " & regPath32_FSC, DBG_INFO
Registry.DeleteKey HKEY_LOCAL_MACHINE, regPath32_FSC
Registry.DeleteKey HKEY_LOCAL_MACHINE, regPath32_SCOMINTEG
End If
'*** delete old FSC 64-bit reg path
Registry.GetStringValue HKEY_LOCAL_MACHINE, regPath64_FSC, "Manufacturer", strValue
If strValue <> "" Then
DebugOut "Found PY data in old FSC 64-bit registry path. Delete: " & regPath64_FSC, DBG_INFO
Registry.DeleteKey HKEY_LOCAL_MACHINE, regPath64_FSC
Registry.DeleteKey HKEY_LOCAL_MACHINE, regPath64_SCOMINTEG
End If
'*** delete old V7 32-bit reg path
Registry.GetStringValue HKEY_LOCAL_MACHINE, regPath32_V7, "Manufacturer", strValue
If strValue <> "" Then
DebugOut "Found PY data in old V7 32-bit registry path. Delete: " & regPath32_V7, DBG_INFO
Registry.DeleteKey HKEY_LOCAL_MACHINE, regPath32_V7
End If
'*** delete old V7 64-bit reg path
Registry.GetStringValue HKEY_LOCAL_MACHINE, regPath64_V7, "Manufacturer", strValue
If strValue <> "" Then
DebugOut "Found PY data in old V7 64-bit registry path. Delete: " & regPath64_V7, DBG_INFO
Registry.DeleteKey HKEY_LOCAL_MACHINE, regPath64_V7
End If
' check for version in SVISCOMLog.ini and adapt if necessary
If oFSO.FileExists(LogIniFileDir & "\" & SVISCOMLogIniName) Then
DebugOut LogIniFileDir & "\" & SVISCOMLogIniName & " is available.", DBG_INFO
oFSO.CopyFile LogIniFileDir & "\" & SVISCOMLogIniName, LogIniFileDir & "\" & SVISCOMLogIniName & "_copy", 1
Set oTextStream = oFSO.OpenTextFile(LogIniFileDir & "\" & SVISCOMLogIniName & "_copy", 1, True)
Set wTextStream = oFSO.OpenTextFile(LogIniFileDir & "\" & SVISCOMLogIniName, 2, True)
wTextStream.WriteLine versionLine
Do While Not oTextStream.AtEndOfStream
thisLine = oTextStream.ReadLine
' make sure to catch V7 typo "SVSICOM"
if InStr(thisLine, "SVISCOM") Or InStr(thisLine, "SVSICOM") Then
if InStr(thisLine, MPVersion) Then
DebugOut "Found correct " & MPVersion & " in INI file.", DBG_INFO
fileOK = true
End If
Else
wTextStream.WriteLine thisLine
End If
Loop
wTextStream.Close
oTextStream.Close
oFSO.DeleteFile LogIniFileDir & "\" & SVISCOMLogIniName & "_copy", 1
' this really is a new MP
If fileOK = False Then
' Re-Initialize PY server data
DebugOut "Re-initialize PYServerData for V" & MPVersion, DBG_INFO
For Each objItem In ComponentsStateList
Call SavePYServerData(objItem, -1)
Next
End If
End If
End If
Sub AddMPElement(oInst, elementName, elementValue)
DebugOut "AddMPElement: '" & elementName & "' = '" & elementValue & "'", DBG_SCOM
Call oInst.AddProperty(elementName, "" & elementValue)
End Sub
Sub AddObjectData(oInst, displayName, PrincipalName)
DebugOut "AddObjectData for '" & displayName & "' / '" & PrincipalName & "'", DBG_SCOM
AddMPElement oInst, "$MPElement[Name='System!System.Entity']/DisplayName$", displayName
AddMPElement oInst, "$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", PrincipalName
End Sub