Fujitsu ETERNUS Probe Action Module CA Script

Fujitsu.Storage.ETERNUS.ProbeActionModule.CAScript (ProbeActionModuleType)

Element properties:

TypeProbeActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
PSScript ProbeAction Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe Default

Source Code:

<ProbeActionModuleType ID="Fujitsu.Storage.ETERNUS.ProbeActionModule.CAScript" Accessibility="Public" Batching="false" PassThrough="false">
<Configuration/>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<ProbeAction ID="PSScript" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe">
<ScriptName>CAScript.ps1</ScriptName>
<ScriptBody><Script>

write-eventLog -LogName ETERNUS -Message "CA DS" -Source Cs -id 203

$api = new-object -comObject 'MOM.ScriptAPI'
Add-PSSnapin Get-CAList
$cas = Get-CAList
$caCount = $cas.Length

for($i = 0; $i -lt $caCount; $i++)
{

$bag = $api.CreatePropertyBag()
$bag.AddValue('CAName',$cas[$i].ObjectName)
if($cas[$i].State.Equals("Warning"))
{
$bag.AddValue('Result','Warning')
}
elseif($cas[$i].State.Equals("Error"))
{
$bag.AddValue('Result','Error')
}
else
{
$bag.AddValue('Result','Normal')
}
$bag.AddValue('State',$cas[$i].State)
$bag

}
</Script></ScriptBody>
<TimeoutSeconds>90</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PSScript"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
<TriggerOnly>true</TriggerOnly>
</ProbeActionModuleType>