Módulo de origen de datos de estadísticas de superámbitos filtrados DHCP 2012 R2

Microsoft.Windows.DHCPServer.2012.R2.FilteredSuperScopeStats.DS (DataSourceModuleType)

Knowledge Base article:

Resumen

Este módulo obtiene datos estadísticos recopilados para el superámbito IPV4 de los miembros del grupo DHCP 2012 R2 denominado “Grupo de servidores DHCP 2012 R2" con instancias de Server que ejecutan el sistema operativo Microsoft Windows Server 2012 y tenían habilitada la característica DHCP.

Configuración

Segundos de intervalo: frecuencia (en segundos) con la que se debe comprobar el valor.

Tiempo de sincronización: tiempo de sincronización para la ejecución del módulo.

Segundos de tiempo de espera: cuánto tiempo (en segundos) se debe esperar a que el módulo finalice la ejecución.

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.PowerShellDiscoveryProbe Default
InstanceFilter ConditionDetection System.ExpressionFilter Default
PerfMapper ConditionDetection System.Performance.DataGenericMapper Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Segundos de intervaloFrecuencia (en segundos) con la que se debe muestrear el valor.
SyncTimestring$Config/SyncTime$Hora de sincronizaciónTiempo de sincronización para la ejecución del módulo.
TimeoutSecondsint$Config/TimeoutSeconds$Tiempo de espera en segundosCuánto tiempo (en segundos) se debe esperar a que el módulo finalice la ejecución.

Source Code:

<DataSourceModuleType ID="Microsoft.Windows.DHCPServer.2012.R2.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.PowerShellDiscoveryProbe">
<ScriptName>DHCPSuperScopes2012R2Probe</ScriptName>
<ScriptBody><Script>

param ([String] $PrincipalName)

$SCRIPT_NAME = "DHCPSuperScopes2012R2Probe"
$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 2012 R2 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>