收集 .NET CSM Statistic/Avg execution time (毫秒)

Microsoft.SystemCenter.Apm.CsmTransaction.AvgRequestTimeMonitor (UnitMonitor)

收集 .NET CSM Statistic/Avg execution time 性能计数器(毫秒)

Knowledge Base article:

摘要

如果每个定义时段内浏览器上的网页加载平均请求时间超过监视器阈值,则实例状态将变为不正常。

原因

在客户端性能事件的平均持续时间超过所配置的监视器阈值时,将生成事务性能警报。

过长的网络请求时间可能由不均衡的网络所引起。

复杂或低效的源代码可能会导致服务器处理时间很长。

大页面或大量的 java 脚本都可能会导致页面加载时间性能问题。

执行时间很长的 JavaScript 处理程序可能会导致 Window.OnLoad 较长的性能问题。

解决方法

页面加载调用时间长的原因通常包括,网络不平衡、服务器处理时间长、页面加载或 Window.OnLoad 时间较长。

Element properties:

TargetMicrosoft.SystemCenter.Apm.CsmTransaction
Parent MonitorSystem.Health.PerformanceState
CategoryCustom
EnabledFalse
Instance Name.NET CSM Statistic
Counter NameAverage page request execution time
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeSystem.Performance.ConsecutiveSamplesThreshold
RemotableFalse
AccessibilityPublic
Alert Message
.NET CSM Statistic/Avg.Request Time 超过了阈值。
.NET CSM Statistic/Avg execution time 性能计数器超出了所配置的阈值 {0} 毫秒。性能计数器的值为 {1} 毫秒。
RunAsDefault

Source Code:

<UnitMonitor ID="Microsoft.SystemCenter.Apm.CsmTransaction.AvgRequestTimeMonitor" Accessibility="Public" Enabled="false" Target="Microsoft.SystemCenter.Apm.CsmTransaction" ParentMonitorID="Health!System.Health.PerformanceState" Remotable="false" Priority="Normal" TypeID="Performance!System.Performance.ConsecutiveSamplesThreshold" ConfirmDelivery="false">
<Category>Custom</Category>
<AlertSettings AlertMessage="Microsoft.SystemCenter.Apm.CsmTransaction.AvgRequestTimeMonitor.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="AL!Microsoft.SystemCenter.Apm.TransactionBase"]/AvgRequestTimeMonitorThreshold$</AlertParameter1>
<AlertParameter2>$Data/Context/SampleValue$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Success" MonitorTypeStateID="ConditionFalse" HealthState="Success"/>
<OperationalState ID="Warning" MonitorTypeStateID="ConditionTrue" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<ComputerName>$Target/Host/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<CounterName>Average page request execution time</CounterName>
<ObjectName>.NET CSM Statistic</ObjectName>
<InstanceName>$Target/Property[Type="Microsoft.SystemCenter.Apm.CsmTransaction"]/CounterInstance$</InstanceName>
<AllInstances>false</AllInstances>
<Frequency>$Target/Property[Type="AL!Microsoft.SystemCenter.Apm.TransactionBase"]/AvgRequestTimeMonitorInterval$</Frequency>
<Threshold>$Target/Property[Type="AL!Microsoft.SystemCenter.Apm.TransactionBase"]/AvgRequestTimeMonitorThreshold$</Threshold>
<Direction>greater</Direction>
<NumSamples>3</NumSamples>
</Configuration>
</UnitMonitor>