HewlettPackard.OneView.ProliantServer.UnitMonitor.DS (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsHewlettPackard.OneView.RunAsProfile
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.CommandExecuterPropertyBagSource Default

Overrideable Parameters:

IDParameterTypeSelector
Intervalint$Config/PeriodInSeconds$

Source Code:

<DataSourceModuleType ID="HewlettPackard.OneView.ProliantServer.UnitMonitor.DS" Accessibility="Public" Batching="false" RunAs="HOL!HewlettPackard.OneView.RunAsProfile">
<Configuration>
<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="PeriodInSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="SyncTime" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter Selector="$Config/PeriodInSeconds$" ParameterType="int" ID="Interval"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.CommandExecuterPropertyBagSource">
<IntervalSeconds>$Config/PeriodInSeconds$</IntervalSeconds>
<ApplicationName>%windir%\System32\WindowsPowerShell\v1.0\PowerShell.exe</ApplicationName>
<WorkingDirectory/>
<CommandLine>"&amp; '$file/Hewlett-PackardProliantServerHealthMonitor.ps1$' $Config/SessionID$ $Config/HostAddress$"</CommandLine>
<TimeoutSeconds>300</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>Hewlett-PackardProliantServerHealthMonitor.ps1</Name>
<Contents><Script>

#-------------------------------------------------------------------
# &lt;company&gt;Hewlett-Packard&lt;/company&gt;
# &lt;copyright&gt;Copyright (c) Hewlett Packard Enterprise Company 2015-2016&lt;/copyright&gt;
# &lt;summary&gt;
# Monitor HPE OneView Proliant Server Health Monitor
# &lt;/summary&gt;
#-------------------------------------------------------------------
function LoadSnapIn
{
add-pssnapin "HPOneView.ManagedDevicesCmdLets"
}

function Main
{
Param ([string]$SessionID, [string]$HostAddress)

$OpsMgr = new-object -ComObject "MOM.ScriptAPI"


$ServerStatus = Get-ListOneViewServerHardwaresHealth -SessionID $SessionID -Address $HostAddress
if(($ServerStatus -ne $null) -and ($ServerStatus.Count -gt 0))
{ $OpsMgr.LogScriptEvent("Script",77,0, "total count is " + $ServerStatus.Count)
foreach ($status in $ServerStatus)
{
$PropertyBag = $OpsMgr.CreatePropertyBag()
$PropertyBag.AddValue("Server.ErrorCode" , "NOERROR")
$PropertyBag.AddValue("Server." + $status.ObjectID + ".HealthState" , $status.Status)
#$OpsMgr.LogScriptEvent("Script",75,0, "Server---&gt;&gt;" + "Server." + $status.ObjectID + ".HealthState" + $status.Status)

foreach ($statusStorage in $status.ServerStorageHealth)
{
$PropertyBag.AddValue("Server." + $statusStorage.ObjectID + ".HealthState" , $statusStorage.Status)
#$OpsMgr.LogScriptEvent("Script",76,0, "Server." + $statusStorage.ObjectID + ".HealthState" + $statusStorage.Status)
}
foreach ($statusSLD in $status.ServerStorageLogicalDriveHealth)
{
$PropertyBag.AddValue("Server." + $statusSLD.ObjectID + ".HealthState" , $statusSLD.Status)
#$OpsMgr.LogScriptEvent("Script",79,0, "Server." + $statusSLD.ObjectID + ".HealthState" + $statusSLD.Status)
}
foreach ($statusSLDDD in $status.ServerStorageLogicalDriveDataDriveHealth)
{
$PropertyBag.AddValue("Server." + $statusSLDDD.ObjectID + ".HealthState" , $statusSLDDD.Status)
#$OpsMgr.LogScriptEvent("Script",80,0, "Server." + $statusSLDDD.ObjectID + ".HealthState" + $statusSLDDD.Status)
}
foreach ($statusSPD in $status.ServerStoragePhysicalDriveHealth)
{
$PropertyBag.AddValue("Server." + $statusSPD.ObjectID + ".HealthState" , $statusSPD.Status)
#$OpsMgr.LogScriptEvent("Script",81,0, "Server." + $statusSPD.ObjectID + ".HealthState" + $statusSPD.Status)
}
foreach ($statusPM in $status.ServerPhysicalMemoryHealth)
{
$PropertyBag.AddValue("Server." + $statusPM.ObjectID + ".HealthState" , $statusPM.Status)
#$OpsMgr.LogScriptEvent("Script",82,0, "Server." + $statusPM.ObjectID + ".HealthState" + $statusPM.Status)
}

$OpsMgr.AddItem($PropertyBag)
clear-variable -name PropertyBag
}
}
else
{
$PropertyBag = $OpsMgr.CreatePropertyBag()
$PropertyBag.AddValue("Server.ErrorCode" , "ERROR")
$OpsMgr.AddItem($PropertyBag)
clear-variable -name PropertyBag
}

$OpsMgr.ReturnItems()
}

if ($args.Length -eq 2)
{
LoadSnapIn
Main $args[0] $args[1]
}

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