HPE OneView Storage Group Discovery Data Source

HewlettPackard.OneView.Storage.HPStorageGroup.Discovery.DS (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityInternal
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.CommandExecuterDiscoveryDataSource Default

Overrideable Parameters:

IDParameterTypeSelector
Intervalint$Config/Interval$

Source Code:

<DataSourceModuleType ID="HewlettPackard.OneView.Storage.HPStorageGroup.Discovery.DS" Accessibility="Internal" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="Interval" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="SyncTime" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="SessionID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="HostAddress" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="DomainID" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="DomainName" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter Selector="$Config/Interval$" ParameterType="int" ID="Interval"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterDiscoveryDataSource">
<IntervalSeconds>$Config/Interval$</IntervalSeconds>
<ApplicationName>%windir%\System32\WindowsPowerShell\v1.0\PowerShell.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>"&amp; '$file/Hewlett-PackardOneViewStorageGroupDiscovery.ps1$' '$MPElement$' '$Target/Id$' $Config/SessionID$ $Config/HostAddress$ $Config/DomainID$ $Config/DomainName$"</CommandLine>
<TimeoutSeconds>1200</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>Hewlett-PackardOneViewStorageGroupDiscovery.ps1</Name>
<Contents><Script>


#-------------------------------------------------------------------
# &lt;company&gt;Hewlett-Packard&lt;/company&gt;
# &lt;copyright&gt;Copyright (c) Hewlett-Packard Company 2014-2015&lt;/copyright&gt;
# &lt;summary&gt;
# Discover HPE OneView Storage Components
# &lt;/summary&gt;
#-------------------------------------------------------------------
function LoadSnapIn
{
add-pssnapin "HPOneView.ManagedDevicesCmdLets"
}

function Main
{
Param ([string]$SourceId,[string]$ManagedEntityId,[string]$SessionID,[string]$HostAddress,[string]$DomainID,[string]$DomainName)

$OpsMgr = new-object -ComObject "MOM.ScriptAPI"
$DiscoveryData = $OpsMgr.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)

$SSL = Get-ListOneViewStorageSystems -Address $HostAddress -SessionID $SessionID

$HostAddressAPIVersion = $HostAddress.Split("_")
$HostAddressOnly = $HostAddressAPIVersion[0]
$HostSoftwareVersion = $HostAddressAPIVersion[1]
$SSHostAddress = $HostAddressOnly

$SSDomainName = $DomainName

if(($SSL -ne $null) -and ($SSL.Count -gt 0))
{
foreach($SS in $SSL)
{
$systemSerialNo = $SS.deviceSpecificAttributes.SerialNumber
$InstanceSS = $DiscoveryData.CreateClassInstance("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystem']$")
$InstanceSS.AddProperty("$MPElement[Name="HOL!HewlettPackard.OneView.ApplianceCredential"]/ID$", $DomainID)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/AllocatedCapacity$", $SS.allocatedCapacity)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Category$", $SS.Category)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Description$", $SS.Description)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Firmware$", $SS.deviceSpecificAttributes.firmware)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/FreeCapacity$", $SS.FreeCapacity)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/ManagedDomain$", $SS.deviceSpecificAttributes.ManagedDomain)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Model$", $SS.deviceSpecificAttributes.Model)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Name$", $SS.Name)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/SerialNumber$", $systemSerialNo)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/State$", $SS.State)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Status$", $SS.Status)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/TotalCapacity$", $SS.TotalCapacity)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Type$", $SS.Type)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Uri$", $SS.Uri)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/Wwn$", $SS.deviceSpecificAttributes.Wwn)
$InstanceSS.AddProperty("$MPElement[Name="HewlettPackard.OneView.Storage.HPStorageSystem"]/OneViewIP$", $SSHostAddress)

$InstanceSS.AddProperty("$MPElement[Name="System!System.Entity"]/DisplayName$", $SS.Name)


$DiscoveryData.AddInstance($InstanceSS)
if($HostSoftwareVersion -eq "300")
{
$managedPools = Get-ListOneViewStoragePools -Address $HostAddress -SessionID $SessionID | Where {$_.storageSystemUri -eq $SS.Uri}
}
else
{
$managedPools = Get-ListOneViewStoragePools -Address $HostAddress -SessionID $SessionID | Where {($_.storageSystemUri -eq $SS.Uri) -and ($_.IsManaged -eq $true)}
}
if(($managedPools -ne $null) -and ($managedPools.Count -gt 0))
{
foreach($Pool in $managedPools)
{
$InstancePool = $DiscoveryData.CreateClassInstance("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']$")
$InstancePool.AddProperty("$MPElement[Name='HOL!HewlettPackard.OneView.ApplianceCredential']/ID$", $DomainID)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystem']/SerialNumber$", $systemSerialNo)
$PoolUri = $Pool.Uri
$PoolUriPart = "/rest/storage-pools/"
$PoolObjectID = $PoolUri.Substring($PoolUriPart.Length)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Uri$", $PoolUri)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/ObjectID$", $PoolObjectID)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Name$", $Pool.Name)
$allocatedCapObj = $Pool.deviceSpecificAttributes.allocatedCapacity
if($allocatedCapObj -ne $null)
{
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/AllocatedCapacity$", $allocatedCapObj.totalAllocatedCapacity)
}
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Category$", $Pool.Category)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/DeviceSpeed$", $Pool.deviceSpecificAttributes.DeviceSpeed)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/DeviceType$", $Pool.deviceSpecificAttributes.DeviceType)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Domain$", $Pool.deviceSpecificAttributes.Domain)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/FreeCapacity$", $Pool.FreeCapacity)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/State$", $Pool.State)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Status$", $Pool.Status)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/StorageSystemUri$", $Pool.StorageSystemUri)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/SupportedRAIDLevel$", $Pool.deviceSpecificAttributes.SupportedRAIDLevel)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/TotalCapacity$", $Pool.TotalCapacity)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Type$", $Pool.Type)
$InstancePool.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/OneViewIP$", $SSHostAddress)
$InstancePool.AddProperty("$MPElement[Name="System!System.Entity"]/DisplayName$", $Pool.Name)

$DiscoveryData.AddInstance($InstancePool)

$PoolUrl = $Pool.Uri
$VolList = Get-ListOneViewStorageVolumesOfAPool -Address $HostAddress -SessionID $SessionID -PoolURL $PoolUrl

if(($VolList -ne $null) -and ($VolList.Count -gt 0))
{
$InstanceVolGroup = $DiscoveryData.CreateClassInstance("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemVolumeGroups']$")
$InstanceVolGroup.AddProperty("$MPElement[Name='HOL!HewlettPackard.OneView.ApplianceCredential']/ID$", $DomainID)
$InstanceVolGroup.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystem']/SerialNumber$", $systemSerialNo)
$InstanceVolGroup.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Uri$", $PoolUri)
$InstanceVolGroup.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemVolumeGroups']/Name$", "Volumes")
$InstanceVolGroup.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemVolumeGroups']/TotalVolumes$", $VolList.Count)
$InstanceVolGroup.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemVolumeGroups']/Description$", "Lists only Warning/Critical Volumes. Healthy Volumes are not shown.")
$DiscoveryData.AddInstance($InstanceVolGroup)
foreach($Vol in $VolList)
{
$VolUrl = $Vol.Uri
$VolUriPart = "/rest/storage-volumes/"
$VolObjectID = $VolUrl.Substring($VolUriPart.Length)
$SnapshotList = Get-ListOneViewStorageSnapshotsOfAVolume -Address $HostAddress -SessionID $SessionID -VolumeURL $VolUrl
if($Vol.status -ne $null -And $Vol.status.ToLower() -ne "ok")
{
$InstanceVol = $DiscoveryData.CreateClassInstance("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']$")
$InstanceVol.AddProperty("$MPElement[Name='HOL!HewlettPackard.OneView.ApplianceCredential']/ID$", $DomainID)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystem']/SerialNumber$", $systemSerialNo)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Uri$", $PoolUri)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemVolumeGroups']/Name$", "Volumes")
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Wwn$", $Vol.lunWwn)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Name$", $Vol.Name)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/AllocatedCapacity$", $Vol.AllocatedCapacity)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Category$", $Vol.Category)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/DeviceVolumeName$", $Vol.DeviceVolumeName)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/IsPermanent$", $Vol.IsPermanent)

$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/NumberOfSnapshots$", $SnapshotList.Count)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/ObjectID$", $VolObjectID)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/ProvisionType$", $Vol.provisioningType)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/ProvisionedCapacity$", $Vol.ProvisionedCapacity)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Shareable$", $Vol.isShareable)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/State$", $Vol.State)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Status$", $Vol.Status)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/StoragePoolUri$", $Vol.StoragePoolUri)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/StorageSystemUri$", $SS.Uri)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Type$", $Vol.Type)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/Uri$", $VolUrl)
$InstanceVol.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVVolumes']/OneViewIP$", $SSHostAddress)
$InstanceVol.AddProperty("$MPElement[Name="System!System.Entity"]/DisplayName$", $Vol.Name)
$DiscoveryData.AddInstance($InstanceVol)
}


$VolName = $Vol.Name
if(($SnapshotList -ne $null) -and ($SnapshotList.Count -gt 0))
{
$InstanceSnapshot = $DiscoveryData.CreateClassInstance("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemSnapshotGroups']$")
$InstanceSnapshot.AddProperty("$MPElement[Name='HOL!HewlettPackard.OneView.ApplianceCredential']/ID$", $DomainID)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystem']/SerialNumber$", $systemSerialNo)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Uri$", $PoolUri)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemSnapshotGroups']/Name$", "Snapshots")
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemSnapshotGroups']/TotalSnapshots$", $SnapshotList.Count)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemSnapshotGroups']/Description$", "Lists only Warning/Critical Snapshots. Healthy Snapshots are not shown.")
$DiscoveryData.AddInstance($InstanceSnapshot)
foreach($Snapshot in $SnapshotList)
{
if($Snapshot.status -ne $null -And $Snapshot.status.ToLower() -ne "ok")
{
$InstanceSnapshot = $DiscoveryData.CreateClassInstance("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']$")
$InstanceSnapshot.AddProperty("$MPElement[Name='HOL!HewlettPackard.OneView.ApplianceCredential']/ID$", $DomainID)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystem']/SerialNumber$", $systemSerialNo)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemPools']/Uri$", $PoolUri)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemSnapshotGroups']/Name$", "Snapshots")
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/Category$", $Snapshot.category)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/DeviceSnapshotName$", $Snapshot.deviceName)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/Name$", $Snapshot.name)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/IsReadOnly$", $Snapshot.deviceSpecificAttributes.readOnly)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/ParentVolumeName$", $VolName)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/SnapshotType$", $Snapshot.deviceSpecificAttributes.snapshotType)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/State$", $Snapshot.state)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/Status$", $Snapshot.status)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/StoragePoolUri$", $PoolUrl)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/StorageSystemUri$", $SS.Uri)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/StorageVolumeUri$", $Snapshot.storageVolumeUri)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/Type$", $Snapshot.type)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/Uri$", $Snapshot.uri)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/Wwn$", $Snapshot.deviceSpecificAttributes.wwn)
$InstanceSnapshot.AddProperty("$MPElement[Name='HewlettPackard.OneView.Storage.HPStorageSystemOVSnapshots']/OneViewIP$", $SSHostAddress)
$InstanceSnapshot.AddProperty("$MPElement[Name="System!System.Entity"]/DisplayName$", $Snapshot.name)
$DiscoveryData.AddInstance($InstanceSnapshot)
}
}
}

}
}
}
}
}
}
$OpsMgr.Return($DiscoveryData)
}
if ($args.Length -eq 6)
{
LoadSnapIn
Main $args[0] $args[1] $args[2] $args[3] $args[4] $args[5]
}




</Script></Contents>
</File>
</Files>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>