Storage Subsystem Discovery

IBMStorageSubsystem.StorageSubsystemDiscovery (Discovery)

The discovery type where the agent systems finds any attached Storage Subsystems.

Element properties:

TargetIBMStorageSubsystem.Seed
EnabledTrue
Frequency901
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DiscoveryProbe DataSource IBMStorageSubsystem.DiscoveryDataSrcType Default

Source Code:

<Discovery ID="IBMStorageSubsystem.StorageSubsystemDiscovery" Enabled="true" Target="IBMStorageSubsystem.Seed" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="IBMStorageSubsystem.StorageSubsystem">
<Property TypeID="IBMStorageSubsystem.StorageSubsystem" PropertyID="GUID"/>
<Property TypeID="IBMStorageSubsystem.StorageSubsystem" PropertyID="IpAddress1"/>
<Property TypeID="IBMStorageSubsystem.StorageSubsystem" PropertyID="IpAddress2"/>
<Property TypeID="IBMStorageSubsystem.StorageSubsystem" PropertyID="MonitoringSystem"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
<Property TypeID="IBMStorageSubsystem.StorageSubsystem" PropertyID="FriendlyName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DiscoveryProbe" TypeID="IBMStorageSubsystem.DiscoveryDataSrcType">
<IntervalSeconds>901</IntervalSeconds>
<TimeoutSeconds>300</TimeoutSeconds>
<ScriptName>IBMStorageSubsystemDiscoviery.ps1</ScriptName>
<Arguments>0</Arguments>
<ScriptBody><Script>param ([Boolean]$Trace)

# Script variables
$private:scriptName = "IBMStorageSubsystemDiscovery.ps1"
$private:E_LVL_ERROR = 2
$private:E_LVL_WARNING = 1
$private:E_LVL_INFO = 0
$private:E_NBR_TRACE = 3702

$SnapinName = (Get-ItemProperty HKLM:\Software\IBM\MP PSSnapinName).PSSnapinName

$SourceId = "$MPElement$"
$ManagedEntityId = "$Target/Id$"
$ManagingSystem = "$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/NetworkName$"

# Script varaibles for SCOM
$private:api = New-Object -ComObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)
if ($Trace)
{
$api.LogScriptEvent($ScriptName, $E_NBR_TRACE, $E_LVL_INFO, 'Storage Subsystem Discovery In Process')
$api.LogScriptEvent($ScriptName, $E_NBR_TRACE, $E_LVL_INFO, 'params: ' + $ManagedEntityId + ' and ' + $ManagingSystem + ' and ' + $SnapinName)
}

if ( (Get-PSSnapin -Name $SnapinName -ErrorAction SilentlyContinue) -eq $null )
{
Add-PsSnapin $SnapinName
}
# Get Disk System Data
$DSCredentials = @(Get-SDCredential -All)
foreach ($cxn in $DSCredentials)
{
$DS = Get-StorageDevice -Credentials $cxn
if ($Trace)
{
$api.LogScriptEvent($ScriptName, $E_NBR_TRACE, $E_LVL_INFO, 'Found credential for '+$DS.FriendlyName+' '+$DS.WWN)
}

$instance = $discoveryData.CreateClassInstance("$MPElement[Name='IBMStorageSubsystem.StorageSubsystem']$")
$instance.AddProperty("$MPElement[Name='IBMStorageSubsystem.StorageSubsystem']/GUID$", $DS.WWN)

$private:FriendlyName = ""
if($DS.FriendlyName -ne $null)
{
$FriendlyName = $DS.FriendlyName
}
$instance.AddProperty("$MPElement[Name='IBMStorageSubsystem.StorageSubsystem']/FriendlyName$", $FriendlyName)
$instance.AddProperty("$MPElement[Name='IBMStorageSubsystem.StorageSubsystem']/IpAddress1$", $DS.IP1)
$instance.AddProperty("$MPElement[Name='IBMStorageSubsystem.StorageSubsystem']/IpAddress2$", $DS.IP2)
$instance.AddProperty("$MPElement[Name='IBMStorageSubsystem.StorageSubsystem']/MonitoringSystem$", $ManagingSystem)
$instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $FriendlyName)
$discoveryData.AddInstance($instance)

# add 'hidden' relationship causing the health service on the
# managing computer to monitor the health of this StorageSubsystem

$healthSvc = $discoveryData.CreateClassInstance( "$MPElement[Name='SC!Microsoft.SystemCenter.HealthService']$" )
$healthSvc.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $ManagingSystem )

$discoveryData.AddInstance($healthSvc)

$hsvcManagesSSubsystemRel = $discoveryData.CreateRelationshipInstance("$MPElement[Name='SC!Microsoft.SystemCenter.HealthServiceShouldManageEntity']$")
$hsvcManagesSSubsystemRel.Source = $healthSvc
$hsvcManagesSSubsystemRel.Target = $instance

$discoveryData.AddInstance($hsvcManagesSSubsystemRel)
}

if($Trace)
{
$api.LogScriptEvent($ScriptName, $E_NBR_TRACE, $E_LVL_INFO, 'Storage Subsystem Discovery Completed')
}

# Send Discovery.Data to the output pipeline.
$api.Return($discoveryData)</Script></ScriptBody>
</DataSource>
</Discovery>