Esta fonte de dados obtém as Métricas do DNS em todos os Windows Server 2012 R2
Esta Fonte de dados obtém Dados de Métricas do DNS em computadores com Windows Server 2012 R2 usando um powershell commandlet
Intervalo em Segundos: a frequência (em segundos) em que o valor deve ser verificado.
Tempo de Sincronização: tempo de sincronização para a execução do módulo.
Tempo Limite (Segundos): quantidade de tempo (em segundos) que deverá ser aguardado até o módulo terminar a execução.
Type | DataSourceModuleType |
Isolation | Any |
Accessibility | Public |
RunAs | Default |
OutputType | System.PropertyBagData |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
DS | DataSource | System.Scheduler | Default |
PS | ProbeAction | Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe | Default |
InstanceFilter | ConditionDetection | System.ExpressionFilter | Default |
ID | ParameterType | Selector | Display Name | Description |
---|---|---|---|---|
IntervalSeconds | int | $Config/IntervalSeconds$ | Segundos de intervalo | A frequência (em segundos) com que o valor deve ser amostrado. |
SyncTime | string | $Config/SyncTime$ | Tempo de sincronização | Tempo de sincronização para a execução do módulo. |
TimeoutSeconds | int | $Config/TimeoutSeconds$ | Tempo Limite (segundos) | Quantidade de tempo (em segundos) que deverá ser aguardado até o módulo terminar a execução. |
<DataSourceModuleType ID="Microsoft.Windows.Server.DNS.2012.R2.Metrics.DS" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="ZoneName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="Group" 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.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/IntervalSeconds$</Interval>
<SyncTime>$Config/SyncTime$</SyncTime>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="PS" TypeID="Windows!Microsoft.Windows.PowerShellPropertyBagTriggerOnlyProbe">
<ScriptName>DNSMetrics2012R2Probe</ScriptName>
<ScriptBody>
param ([String] $PrincipalName)
$SCRIPT_NAME = "DNSMetrics2012R2Probe"
$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 DNS 2012 R2 DNS Metrics Property Bag Powershell Script"
$DNSZones = Get-DnsServerZone -ComputerName $PrincipalName
if($DNSZones -ne $null)
{
if($DNSZones.Count -eq $null)
{
$ZoneCount = 1
}
else
{
$ZoneCount = $DNSZones.Count
}
for ($itmZone=0; $itmZone -lt $ZoneCount; $itmZone++)
{
if($ZoneCount -eq 1)
{
$ZoneObj = $DNSZones
}
else
{
$ZoneObj = $DNSZones.Item($itmZone)
}
if($ZoneObj.IsAutoCreated -eq $false)
{
$ZoneName = $ZoneObj.ZoneName.toString()
$PerfData = Get-DnsServerStatistics -ZoneName $ZoneName
#Zone Query Statistics
$PerfQueryStats = $PerfData.ZoneQueryStatistics
if($PerfQueryStats.Count -eq $null)
{
$PerfQueryStatsCount = 1
}
else
{
$PerfQueryStatsCount = $PerfQueryStats.Count
}
for ($itmQrStat=0; $itmQrStat -lt $PerfQueryStatsCount; $itmQrStat++)
{
if($PerfQueryStatsCount -eq 1)
{
$QueryStatObj = $PerfQueryStats
}
else
{
$QueryStatObj = $PerfQueryStats.Item($itmQrStat)
}
$StatQRec = $QueryStatObj.QueriesReceived
$StatQRes = $QueryStatObj.QueriesResponded
$StatQFail = $QueryStatObj.QueriesFailure
$StatQNError = $QueryStatObj.QueriesNameError
if($QueryStatObj.RecordType -eq "ALL")
{
$PropertyBag = $momAPI.CreatePropertyBag()
$PropertyBag.AddValue("ZoneName", $ZoneName)
$PropertyBag.AddValue("Group", "ZoneQueryStatistics")
$PropertyBag.AddValue("RecordType", $QueryStatObj.RecordType)
$PropertyBag.AddValue("QueriesReceived", $StatQRec)
$PropertyBag.AddValue("QueriesResponded", $StatQRes)
$PropertyBag.AddValue("QueriesFailure", $StatQFail)
$PropertyBag.AddValue("QueriesNameError", $StatQNError)
$PropertyBag
Write-Host "$SCRIPT_NAME - ZoneQueryStatistics Property Bag Added"
}
}
#Zone Transfer Statistics
$PerfTransfStats = $PerfData.ZoneTransferStatistics
if($PerfTransfStats.Count -eq $null)
{
$PerfTransfStatsCount = 1
}
else
{
$PerfTransfStatsCount = $PerfTransfStats.Count
}
for ($itmTrStat=0; $itmTrStat -lt $PerfTransfStatsCount; $itmTrStat++)
{
if($PerfTransfStatsCount -eq 1)
{
$TransfStatObj = $PerfTransfStats
}
else
{
$TransfStatObj = $PerfTransfStats.Item($itmTrStat)
}
$StatResRec = $TransfStatObj.ResponseReceived
$StatSucRec = $TransfStatObj.SuccessReceived
$StatReqRec = $TransfStatObj.RequestReceived
$StatReqSen = $TransfStatObj.RequestSent
$StatSucSen = $TransfStatObj.SuccessSent
if($TransfStatObj.TransferType -eq "IXFR" -or $TransfStatObj.TransferType -eq "AXFR" )
{
$PropertyBag = $momAPI.CreatePropertyBag()
$PropertyBag.AddValue("ZoneName", $ZoneName)
$PropertyBag.AddValue("Group", "ZoneTransferStatistics")
$PropertyBag.AddValue("TransferType", $TransfStatObj.TransferType)
$PropertyBag.AddValue("RequestReceived", $StatReqRec)
$PropertyBag.AddValue("RequestSent", $StatReqSen)
$PropertyBag.AddValue("ResponseReceived", $StatResRec)
$PropertyBag.AddValue("SuccessReceived", $StatSucRec)
$PropertyBag.AddValue("SuccessSent", $StatSucSen)
$PropertyBag
Write-Host "$SCRIPT_NAME - ZoneTransferStatistics Property Bag Added"
}
}
#Zone Update Statistics
$PerfUpdateStats = $PerfData.ZoneUpdateStatistics
$PropertyBag = $momAPI.CreatePropertyBag()
$PropertyBag.AddValue("ZoneName", $ZoneName)
$PropertyBag.AddValue("Group", "ZoneUpdateStatistics")
$PropertyBag.AddValue("DynamicUpdateReceived", $PerfUpdateStats.DynamicUpdateReceived)
$PropertyBag.AddValue("DynamicUpdateRejected", $PerfUpdateStats.DynamicUpdateRejected)
$PropertyBag
Write-Host "$SCRIPT_NAME - ZoneUpdateStatistics Property Bag Added"
}
}
}
Write-Host "$SCRIPT_NAME - multiple property bag returned"
</ScriptBody>
<Parameters>
<Parameter>
<Name>PrincipalName</Name>
<Value>$Config/ComputerName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
</ProbeAction>
<ConditionDetection ID="InstanceFilter" TypeID="System!System.ExpressionFilter">
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Group']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Config/Group$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='ZoneName']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">$Config/ZoneName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</ConditionDetection>
</MemberModules>
<Composition>
<Node ID="InstanceFilter">
<Node ID="PS">
<Node ID="DS"/>
</Node>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.PropertyBagData</OutputType>
</DataSourceModuleType>