Discover F5 BIGIP System - HardwareRelations

ABC.F5.BIGIP.Discovery.F5.BIGIP.System.HardwareRelations (Discovery)

Discover F5 System Hardware Relations

Element properties:

TargetMicrosoft.SystemCenter.RootManagementServer
EnabledTrue
Frequency21600
RemotableFalse

Object Discovery Details:

Discovered relationships and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedPowerShell.DiscoveryProvider Default

Source Code:

<Discovery ID="ABC.F5.BIGIP.Discovery.F5.BIGIP.System.HardwareRelations" Target="SC!Microsoft.SystemCenter.RootManagementServer" Enabled="true" ConfirmDelivery="false" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryRelationship TypeID="ABC.F5.BIGIP.SystemHostsCPU"/>
<DiscoveryRelationship TypeID="ABC.F5.BIGIP.SystemHostsDisk"/>
<DiscoveryRelationship TypeID="ABC.F5.BIGIP.SystemHostsMemory"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>21600</IntervalSeconds>
<SyncTime/>
<ScriptName>DiscoverF5SystemHardwareRelations.ps1.ps1</ScriptName>
<ScriptBody><Script><![CDATA[param($sourceId,$managedEntityId,$tempPath)


$classF5MonServerRuntimeInfo = Get-SCOMClass -Name 'ABC.F5.BIGIP.MonitoringServerRuntimeInfo'
$classF5MonServerRuntimeInfoInstance = Get-SCOMClassInstance -Class $classF5MonServerRuntimeInfo
$tempPath = $classF5MonServerRuntimeInfoInstance.'[ABC.F5.BIGIP.MonitoringServerRuntimeInfo].RemotePath'.Value


$api = New-Object -ComObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0,$sourceId,$managedEntityId)

$classF5System = Get-SCOMClass -Name 'ABC.F5.BIGIP.System'
$classF5SystemInstances = Get-SCOMClassInstance -Class $classF5System

$classF5CPU = Get-SCOMClass -Name 'ABC.F5.BIGIP.CPU'
$classF5CPUInstances = Get-SCOMClassInstance -Class $classF5CPU

$classF5Memory = Get-SCOMClass -Name 'ABC.F5.BIGIP.Memory'
$classF5MemoryInstances = Get-SCOMClassInstance -Class $classF5Memory

$classF5Disk = Get-SCOMClass -Name 'ABC.F5.BIGIP.Disk'
$classF5DiskInstances = Get-SCOMClassInstance -Class $classF5Disk


$classF5SystemInstances | ForEach-Object {

$classF5SystemInstance = $_

if ($classF5SystemInstance.'[ABC.F5.BIGIP.System].SystemNodeName'.value -eq '') {

$foo = 'bar'

} else {

$f5SystemNodeName = $classF5SystemInstance.'[ABC.F5.BIGIP.System].SystemNodeName'.Value

$srcInstance = $discoveryData.CreateClassInstance("$MPElement[Name='ABC.F5.BIGIP.System']$")
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/SystemNodeName$", $f5SystemNodeName)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/SystemRelease$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].SystemRelease'.Value)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/SystemName$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].SystemName'.Value)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/ProductDate$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].ProductDate'.Value)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/ProductBuild$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].ProductBuild'.Value)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/ProductName$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].ProductName'.Value)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/ProductVersion$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].ProductVersion'.Value)
$srcInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.System']/IPAddress$", $classF5SystemInstance.'[ABC.F5.BIGIP.System].IPAddress'.Value)
$discoveryData.AddInstance($srcInstance)

$classF5CPUInstances | Where-Object {$_.'[ABC.F5.BIGIP.CPU].SystemNodeName'.Value -eq $f5SystemNodeName} | ForEach-Object {

[string]$cpuID = [string]$($_.'[ABC.F5.BIGIP.CPU].Id'.Value)
[string]$key = [string]$($_.'[ABC.F5.BIGIP.CPU].Key'.Value)

$targetInstance = $discoveryData.CreateClassInstance("$MPElement[Name='ABC.F5.BIGIP.CPU']$")
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.CPU']/Id$", $cpuID)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.CPU']/Key$", $key)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.CPU']/SystemNodeName$", $f5SystemNodeName)
$discoveryData.AddInstance($targetInstance)

$relInstance = $discoveryData.CreateRelationShipInstance("$MPElement[Name='ABC.F5.BIGIP.SystemHostsCPU']$")
$relInstance.Source = $srcInstance
$relInstance.Target = $targetInstance
$discoveryData.AddInstance($relInstance)

}

$classF5DiskInstances | Where-Object {$_.'[ABC.F5.BIGIP.Disk].SystemNodeName'.Value -eq $f5SystemNodeName} | ForEach-Object {

[string]$totalSize = [string]$($_.'[ABC.F5.BIGIP.Disk].TotalSize'.Value)
[string]$key = [string]$($_.'[ABC.F5.BIGIP.Disk].Key'.Value)

$targetInstance = $discoveryData.CreateClassInstance("$MPElement[Name='ABC.F5.BIGIP.Disk']$")
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Disk']/TotalSize$", $totalSize)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Disk']/FullPathAttr$", $_.'[ABC.F5.BIGIP.Disk].FullPathAttr'.Value)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Disk']/Key$", $key)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Disk']/SystemNodeName$", $f5SystemNodeName)
$discoveryData.AddInstance($targetInstance)

$relInstance = $discoveryData.CreateRelationShipInstance("$MPElement[Name='ABC.F5.BIGIP.SystemHostsDisk']$")
$relInstance.Source = $srcInstance
$relInstance.Target = $targetInstance
$discoveryData.AddInstance($relInstance)

}

$classF5MemoryInstances | Where-Object {$_.'[ABC.F5.BIGIP.Memory].SystemNodeName'.Value -eq $f5SystemNodeName} | ForEach-Object {

[string]$memoryTotal = [string]$($_.'[ABC.F5.BIGIP.Memory].MemoryTotal'.Value)
[string]$key = [string]$($_.'[ABC.F5.BIGIP.Memory].Key'.Value)

$targetInstance = $discoveryData.CreateClassInstance("$MPElement[Name='ABC.F5.BIGIP.Memory']$")
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Memory']/MemoryTotal$", $memoryTotal)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Memory']/Key$", $key)
$targetInstance.AddProperty("$MPElement[Name='ABC.F5.BIGIP.Memory']/SystemNodeName$", $f5SystemNodeName)
$discoveryData.AddInstance($targetInstance)

$relInstance = $discoveryData.CreateRelationShipInstance("$MPElement[Name='ABC.F5.BIGIP.SystemHostsMemory']$")
$relInstance.Source = $srcInstance
$relInstance.Target = $targetInstance
$discoveryData.AddInstance($relInstance)

}

}

}

$discoveryData]]></Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</Discovery>