Lenovo.XClarity.Integrator.Service.Compatibility.HealthProvider (DataSourceModuleType)

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.PropertyBagData

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.Scheduler Default
PSScript ProbeAction Microsoft.Windows.PowerShellPropertyBagProbe Default

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
TimeoutSecondsint$Config/TimeoutSeconds$

Source Code:

<DataSourceModuleType ID="Lenovo.XClarity.Integrator.Service.Compatibility.HealthProvider" Accessibility="Public">
<Configuration>
<xsd:element name="Version" type="xsd:string"/>
<xsd:element name="IntervalSeconds" type="xsd:integer"/>
<xsd:element name="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="PSScript" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagProbe">
<ScriptName>Lenovo.LXCI.Service.ps1</ScriptName>
<ScriptBody><Script>
param($version)

$api = new-object -comObject 'MOM.ScriptAPI'
$bag = $api.CreatePropertyBag()

function Get-RegistryValue($key, $value)
{
(Get-ItemProperty $key $value).$value
}

function WriteLog($str, $RegDebug, $debugLevel)
{
if ($RegDebug -gt $debugLevel)
{
#Write-Host $str
if ([System.Diagnostics.EventLog]::SourceExists("Lenovo.EventLogSource") -eq $false)
{
[System.Diagnostics.EventLog]::CreateEventSource("Lenovo.EventLogSource", "Operations Manager")
}
Write-EventLog -LogName 'Operations Manager' -Source 'Lenovo.EventLogSource' -EventId 3008 -EntryType Information -Message $str
}
}

$RegDebug = Get-RegistryValue 'HKLM:\SOFTWARE\Lenovo\Lenovo SCOM MP\Debug' 'Level'
if($RegDebug -eq $null)
{
$RegDebug = '0'
}
$RegDebug = [Convert]::ToInt32($RegDebug,10)

$logstring = "RegDebug = " + $RegDebug
WriteLog $logstring $RegDebug 5

$hwmp_version = "7.12.0.7"
$start = $hwmp_version.IndexOf(".") + 1
$end = $hwmp_version.LastIndexOf(".")
$compare = $hwmp_version.Substring($start,$end - $start)

if ($version.Substring($start,$end - $start) -eq $compare)
{
$bag.AddValue('State','Healthy')
$logstring = "Lenovo XClarity Integrator Service version is " + $verion
WriteLog $logstring $RegDebug 5
}
else
{
$bag.AddValue('State','Error')
$logstring = "Lenovo XClarity Integrator Service version is " + $verion+ " not supported!"
WriteLog $logstring $RegDebug 5
}

$bag
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>Version</Name>
<Value>$Config/Version$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PSScript">
<Node ID="DS"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>