DHCP 2016 及更新版本已篩選的超級領域統計資料資料來源模組

Microsoft.Windows.DHCPServer.10.0.FilteredSuperScopeStats.DS (DataSourceModuleType)

Knowledge Base article:

摘要

此模組會取得在名為「DHCP 2016 及更新版本伺服器群組」的 DHCP 2016 及更新版本伺服器群組成員中為超級領域 IPV4 所收集的統計資料,其伺服器執行個體執行 Microsoft Windows Server 2016 及更新版本作業系統並已啟用 DHCP 功能。

設定

間隔秒數:必須檢查值的頻率 (以秒為單位)。

同步時間:模組執行同步處理時間。

逾時秒數:等待模組執行完成的時間 (以秒為單位)。

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.Performance.Data

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource System.SimpleScheduler Default
PS ProbeAction Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe Default
InstanceFilter ConditionDetection System.ExpressionFilter Default
PerfMapper ConditionDetection System.Performance.DataGenericMapper Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$間隔秒數值的取樣頻率 (以秒為單位)。
SyncTimestring$Config/SyncTime$同步時間模組執行同步處理時間。
TimeoutSecondsint$Config/TimeoutSeconds$逾時秒數等待模組執行完成的時間 (以秒為單位)。

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.DHCPServer.10.0.FilteredSuperScopeStats.DS" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="SuperScope" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="CounterName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="ComputerName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="IntervalSeconds" 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="TimeoutSeconds" type="xsd:integer"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="System!System.SimpleScheduler">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime>$Config/SyncTime$</SyncTime>
</DataSource>
<ProbeAction ID="PS" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe">
<ScriptName>DHCPSuperScopes.10.0.Probe.ps1</ScriptName>
<ScriptBody><Script>

param ([String] $PrincipalName)

$SCRIPT_NAME = "DHCPSuperScopes.10.0.Probe"
$ErrorActionPreference = "Stop"

# Event type constants
$EVENT_TYPE_LOG = 0
$EVENT_TYPE_ERROR = 1
$EVENT_TYPE_WARNING = 2
$EVENT_TYPE_INFORMATION = 4

# Typed property bag constants
$PROPERTY_TYPE_ALERT = 0
$PROPERTY_TYPE_EVENT = 1
$PROPERTY_TYPE_PERFORMANCE = 2
$PROPERTY_TYPE_STATE = 3

# State type constants
$STATE_SUCCESS = "Success"
$STATE_WARNING = "Warning"
$STATE_ERROR = "Error"

$momAPI = new-object -comObject MOM.ScriptAPI
Write-Host "$SCRIPT_NAME - Executing DHCP Super Scope 2016 and 1709+ Probe Powershell Script"

try
{
$SuperScopes = Get-DhcpServerv4SuperscopeStatistics -ComputerName $PrincipalName

if($SuperScopes.Length -eq $null)
{
$SuperScopeCount = 1
}
else
{
$SuperScopeCount = $SuperScopes.Length
}


for ($itmSupScp=0; $itmSupScp -lt $SuperScopeCount; $itmSupScp++)
{
if($SuperScopes.Length -eq $null)
{
$ObjSuperScope = $SuperScopes
}
else
{
if($SuperScopes.Get($itmSupScp) -ne $null)
{
$ObjSuperScope = $SuperScopes.Get($itmSupScp)
}
}

if($ObjSuperScope.Name.Length -gt 0)
{

$PercSupScopeInUse = $ObjSuperScope.PercentageInUse
$PercSupScopeAvail = 100-$PercSupScopeInUse

[system.double] $DbldSupScopeInUse = [System.Convert]::ToDouble($ObjSuperScope.InUse)
[system.double] $DbldSupScopeInFree = [System.Convert]::ToDouble($ObjSuperScope.Available)


[System.String] $CounterAddInUse = "AddressesInUse"
[System.String] $CounterAddFree = "AddressesAvailable"
[System.String] $CounterPrcInUse = "PercentageInUse"
[System.String] $CounterPrcFree = "PercentageAvailable"


$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterAddInUse)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjSuperScope.Name)
$PerformancePropertyBag.AddValue("PerfValue", $DbldSupScopeInUse)

$PerformancePropertyBag

$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterAddFree)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjSuperScope.Name)
$PerformancePropertyBag.AddValue("PerfValue", $DbldSupScopeInFree)

$PerformancePropertyBag

$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterPrcInUse)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjSuperScope.Name)
$PerformancePropertyBag.AddValue("PerfValue", $PercSupScopeInUse)

$PerformancePropertyBag

$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("PerfCounter", $CounterPrcFree)
$PerformancePropertyBag.AddValue("PerfInstance", $ObjSuperScope.Name)
$PerformancePropertyBag.AddValue("PerfValue", $PercSupScopeAvail)

$PerformancePropertyBag

Write-Host "$SCRIPT_NAME - Super Scope Performance Data Added"
}
}

}
catch [System.Exception]
{
$Description = $_.ToString()
Write-Warning "$SCRIPT_NAME - $Description"

$PerformancePropertyBag = $momAPI.CreatePropertyBag()
$PerformancePropertyBag.AddValue("AddressesInUse", 0)
$PerformancePropertyBag.AddValue("AddressesAvailable", 0)
$PerformancePropertyBag.AddValue("PercentageInUse", 0)
$PerformancePropertyBag.AddValue("PercentageAvailable", 0)

$PerformancePropertyBag
}
finally
{
Write-Host "$SCRIPT_NAME - multiple performance property bag returned"
}
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>PrincipalName</Name>
<Value>$Config/ComputerName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
<ConditionDetection ID="PerfMapper" TypeID="Performance!System.Performance.DataGenericMapper">
<ObjectName>Scopes</ObjectName>
<CounterName>$Data/Property[@Name='PerfCounter']$</CounterName>
<InstanceName>$Data/Property[@Name='PerfInstance']$</InstanceName>
<Value>$Data/Property[@Name='PerfValue']$</Value>
</ConditionDetection>
<ConditionDetection ID="InstanceFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='PerfCounter']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Config/CounterName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='PerfInstance']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Config/SuperScope$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="PerfMapper">
<Node ID="InstanceFilter">
<Node ID="PS">
<Node ID="DS"/>
</Node>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>Performance!System.Performance.Data</OutputType>
</DataSourceModuleType>