你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
为本地服务器部署 Azure Monitor Application Insights 代理
重要
对于 Application Insights 代理的本地和非 Azure 云部署,建议使用本指南。 下面是建议用于 Azure 虚拟机和虚拟机规模集部署的方法。
Application Insights 代理(以前称为状态监视器 V2)是发布到 PowerShell 库的 PowerShell 模块。 它将替换状态监视器。 遥测数据将发送到 Azure 门户,你可以在其中监视应用。
注意
本模块当前支持通过 IIS 托管的 ASP.NET 和 ASP.NET Core web 应用的无代码检测。 使用 SDK 检测 Java 和 Node.js 应用程序。
PowerShell 库
Application Insights 代理位于此处:https://www.powershellgallery.com/packages/Az.ApplicationMonitor。
说明
PowerShell API 参考
- Disable-ApplicationInsightsMonitoring
- Disable-InstrumentationEngine
- Enable-ApplicationInsightsMonitoring
- Enable-InstrumentationEngine
- Get-ApplicationInsightsMonitoringConfig
- Get-ApplicationInsightsMonitoringStatus
- Set-ApplicationInsightsMonitoringConfig
- Start-ApplicationInsightsMonitoringTrace
故障排除
请参阅专用疑难解答文章。
常见问题解答
Application Insights 代理是否支持代理安装?
是 可以通过多种方式下载 Application Insights 代理。 如果计算机可以访问 Internet,则可以使用
-Proxy参数登录到 PowerShell 库。 还可以手动下载此模块,并将其安装到计算机上或直接使用它。 上述每个选项都在详细说明中进行了说明。状态监视器 v2 是否支持 ASP.NET Core 应用程序?
是 从 Application Insights 代理 2.0.0-beta1 开始,将支持 IIS 中托管的 ASP.NET Core 应用程序。
如何验证启用是否成功?
Get-ApplicationInsightsMonitoringStatus cmdlet 可用于验证启用是否成功。
我们建议你使用实时指标来快速确定应用是否正在发送遥测数据。
还可以使用 Log Analytics 列出当前正在发送遥测数据的所有云角色:
union * | summarize count() by cloud_RoleName, cloud_RoleInstance
发行说明
2.0.0-beta3
- 将 ApplicationInsights .NET/.NET Core SDK 更新到 2.20.1-redfield。
- 启用 SQL 查询集合。
2.0.0-beta2
- 将 ApplicationInsights .NET/.NET Core SDK 更新到 2.18.1-redfield。
2.0.0-beta1
- 添加了 ASP.NET Core 自动检测功能。
后续步骤
查看遥测:
添加更多遥测:
- 创建 Web 测试,以确保站点保持活动状态。
- 添加 Web 客户端遥测,以查看网页代码中的异常并启用跟踪调用。
- 将 Application Insights SDK 添加到代码,以便插入跟踪和日志调用。