BPA Monitor Type

Microsoft.Windows.Server.10.0.Monitoring.MonitorType (UnitMonitorType)

Windows Server 2016 and above operating systems Monitor Type

Element properties:

RunAsDefault
AccessibilityInternal
Support Monitor RecalculateTrue

Member Modules:

ID Module Type TypeId RunAs 
Scheduler DataSource System.Scheduler Default
PA ProbeAction Microsoft.Windows.Server.10.0.BPA.PowerShellPropertyBagProbe Default
PassThrough ProbeAction System.PassThroughProbe Default
FilterError ConditionDetection System.ExpressionFilter Default
FilterHealthy ConditionDetection System.ExpressionFilter Default
FilterWarning ConditionDetection System.ExpressionFilter Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
Intervalint$Config/Interval$IntervalInterval in seconds

Source Code:

<UnitMonitorType ID="Microsoft.Windows.Server.10.0.Monitoring.MonitorType" Accessibility="Internal">
<MonitorTypeStates>
<MonitorTypeState ID="Healthy" NoDetection="false"/>
<MonitorTypeState ID="Warning" NoDetection="false"/>
<MonitorTypeState ID="Error" NoDetection="false"/>
</MonitorTypeStates>
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="Interval" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="Interval" Selector="$Config/Interval$" ParameterType="int"/>
</OverrideableParameters>
<MonitorImplementation>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/Interval$</Interval>
<SyncTime/>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="PA" TypeID="Microsoft.Windows.Server.10.0.BPA.PowerShellPropertyBagProbe">
<ScriptName>Microsoft.Windows.Server.10.0.Monitoring.BPA.RunBPA.Script.ps1</ScriptName>
<PSparam/>
<ScriptBody><Script>Function Main()
{
$State = $STATE_SUCCESS
$ErrorActionPreference = "SilentlyContinue"

$momAPI = New-Object -ComObject Mom.ScriptAPI
if ($null -eq $momAPI)
{
return
}

$error.Clear()
$Models = New-Object System.Collections.ArrayList($null)
$ImportedAssemblies = New-Object System.Collections.ArrayList($null)

if (0 -ne $error.Count)
{
CreateStatePropertyBag -StateProperty $State -Message $BpaInitFailed -momAPI $momAPI
return
}

$iResult = Check-BpaRequirement -ModelsToRun $Models -ImportedAssemblies $ImportedAssemblies

if ($BpaNotSupportedStatus -eq $iResult)
{
CreateStatePropertyBag -StateProperty $State -Message $Description -momAPI $momAPI
return
}

if ($BpaNotLoadedStatus -eq $iResult)
{
CreateStatePropertyBag -StateProperty $State -Message $BpaLoadProblem -momAPI $momAPI
return

}

if ($BpaModelLoadProblem -eq $iResult)
{
CreateStatePropertyBag -StateProperty $State -Message $BpaModelLoadProblem -momAPI $momAPI

Unload-Modules -ImportedAssemblies $ImportedAssemblies

return

}

$ErrorActionPreference = "Stop"

$WarningRulesCount = 0
$ErrorRulesCount = 0

try
{
$Details = $Models | Invoke-BPAModel
foreach ($Detail in $Details)
{
If ($State -ne $STATE_ERROR)
{
if ($false -eq $Detail.Success)
{
$State = $STATE_ERROR
$Description = $DESCRIPTION_ERROR
}
else
{
$tWarningRulesCount = 0
$tErrorRulesCount = 0

Get-BpaWarningsAndErrorCounts -Detail $Detail.Detail -WarningRulesCount ([ref] $tWarningRulesCount) -ErrorRulesCount ([ref] $tErrorRulesCount)
if (($tWarningRulesCount -ne 0) -or ($tErrorRulesCount -ne 0))
{
$State = $STATE_WARNING
$WarningRulesCount += $tWarningRulesCount
$ErrorRulesCount += $tErrorRulesCount
}
}
}
}

If ($State -eq $STATE_WARNING)
{
$Description = $DESCRIPTION_WARNING -f $WarningRulesCount, $ErrorRulesCount
}
}
catch [System.Exception]
{
$Description = $_.ToString()
$State = $STATE_ERROR
}
finally
{
$ErrorActionPreference = "SilentlyContinue"

if ($State -eq $STATE_SUCCESS)
{
$WarningRulesCount = 0
$ErrorRulesCount = 0
Get-AllBpaResults -BPAModels $Models -WarnCount ([ref]$WarningRulesCount) -ErrorCount ([ref]$ErrorRulesCount)
if (($WarningRulesCount -ne 0) -or ($ErrorRulesCount -ne 0))
{
$State = $STATE_WARNING
$Description = $DESCRIPTION_WARNING -f $WarningRulesCount, $ErrorRulesCount
}
}

Unload-Modules -ImportedAssemblies $ImportedAssemblies
CreateStatePropertyBag -StateProperty $State -Message $Description -momAPI $momAPI
}

}

Main
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</ProbeAction>
<ProbeAction ID="PassThrough" TypeID="System!System.PassThroughProbe"/>
<ConditionDetection ID="FilterHealthy" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='State']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Success</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="FilterWarning" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='State']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Warning</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
<ConditionDetection ID="FilterError" TypeID="System!System.ExpressionFilter">
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='State']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Error</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</ConditionDetection>
</MemberModules>
<RegularDetections>
<RegularDetection MonitorTypeStateID="Healthy">
<Node ID="FilterHealthy">
<Node ID="PA">
<Node ID="Scheduler"/>
</Node>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Warning">
<Node ID="FilterWarning">
<Node ID="PA">
<Node ID="Scheduler"/>
</Node>
</Node>
</RegularDetection>
<RegularDetection MonitorTypeStateID="Error">
<Node ID="FilterError">
<Node ID="PA">
<Node ID="Scheduler"/>
</Node>
</Node>
</RegularDetection>
</RegularDetections>
<OnDemandDetections>
<OnDemandDetection MonitorTypeStateID="Healthy">
<Node ID="FilterHealthy">
<Node ID="PA">
<Node ID="PassThrough"/>
</Node>
</Node>
</OnDemandDetection>
<OnDemandDetection MonitorTypeStateID="Warning">
<Node ID="FilterWarning">
<Node ID="PA">
<Node ID="PassThrough"/>
</Node>
</Node>
</OnDemandDetection>
<OnDemandDetection MonitorTypeStateID="Error">
<Node ID="FilterError">
<Node ID="PA">
<Node ID="PassThrough"/>
</Node>
</Node>
</OnDemandDetection>
</OnDemandDetections>
</MonitorImplementation>
</UnitMonitorType>