DHCP Filtered Super Scopes Statistics 2016 and 1709+ Data source Module

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

Knowledge Base article:

Summary

This module get statistic data collected for Super Scope IPV4 in DHCP 2016 and 1709+ Server group members named "DHCP 2016 and 1709+ Servers Group" with instances of Server that are running a Microsoft Windows Server 2016 and 1709+ operating system and got the DHCP feature enabled.

Configuration

Interval Seconds: How frequently (in seconds) the value should be checked.

Sync Time: Synchronization time for the module execution.

Timeout Seconds: How much time (in seconds) to wait for the module to finish execution.

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$Interval secondsHow frequently (in seconds) the value should be sampled.
SyncTimestring$Config/SyncTime$Sync TimeSynchronization time for the module execution.
TimeoutSecondsint$Config/TimeoutSeconds$Timeout SecondsHow much time (in seconds) to wait for the module to finish execution.

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>