为性能 APM 事件生成警报

Microsoft.SystemCenter.Apm.ApplicationInstance.AlertPerformanceAspectRule (Rule)

Knowledge Base article:

摘要

如果每个指定时段内的性能事件总数超过监视器阈值,则实例状态将变为不正常。

原因

在执行时间超过所配置的警报阈值时,将生成应用程序性能警报。警报详细信息按照在函数调用的不同类型上所花费的时间百分比来分解执行时间。服务器问题或查询结构和复杂性的问题可能会导致数据库调用时间过长。文件服务器问题可能会导致文件 I/O 时间很长。Web 服务或它驻留的服务器关闭,或者 Web 服务代码中出现问题,都可能会导致 Web 服务的性能问题。复杂或低效的代码可能会导致应用程序的内部执行时间很长。

解决方法

在执行时间超过所配置的阈值时,将生成应用程序性能警报。应用程序性能下降的原因通常包括,数据库调用时间长、Web 服务调用时间长、.NET 远程调用或 COM+ 调用速度慢或者应用程序代码效率低。

通过使用“警报描述”中和“警报上下文”选项卡上提供的指向事件详细信息的链接,你可以访问有关此警报的其他详细信息。该链接将在 Application Diagnostics 控制台中打开事件。Application Diagnostics 控制台包含特定于此事件的信息,以及特定于检测到的相关事件和类似事件的信息。

Element properties:

TargetMicrosoft.SystemCenter.Apm.ApplicationInstance
CategoryAlert
EnabledFalse
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableFalse
Alert Message
服务器性能异常
“{0}”在以下项目上已超出配置的阈值 {1} 毫秒:{2}. 有关其他详细信息,请使用以下链接:$Url[Query='{3}']/APMEvent$

Member Modules:

ID Module Type TypeId RunAs 
LOBProvider DataSource Microsoft.SystemCenter.Apm.LobDataProvider Default
AlertWriteAction WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SystemCenter.Apm.ApplicationInstance.AlertPerformanceAspectRule" Enabled="false" ConfirmDelivery="true" Target="Microsoft.SystemCenter.Apm.ApplicationInstance" Remotable="false">
<Category>Alert</Category>
<DataSources>
<DataSource ID="LOBProvider" TypeID="Microsoft.SystemCenter.Apm.LobDataProvider">
<Name>$Target/Property[Type="Microsoft.SystemCenter.Apm.ApplicationInstanceBase"]/ApplicationName$</Name>
<AspectType>performance</AspectType>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="AlertWriteAction" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name='Microsoft.SystemCenter.Apm.ApplicationInstance.AlertPerformanceAspectRule.AlertMessage']$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Data/EventData/problemDescription$</AlertParameter1>
<AlertParameter2>$Target/Property[Type="Microsoft.SystemCenter.Apm.ApplicationInstance"]/PerformanceThreshold$</AlertParameter2>
<AlertParameter3>$Target/Host/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</AlertParameter3>
<AlertParameter4>$Data/EventData/ViewDetail$</AlertParameter4>
</AlertParameters>
<Suppression>
<SuppressionValue>$Data/EventData/eventConsolidationHash$</SuppressionValue>
</Suppression>
<Custom1>Performance</Custom1>
</WriteAction>
</WriteActions>
</Rule>