在 Service Fabric 群集上安装 Application Insights 时出错
Posted
技术标签:
【中文标题】在 Service Fabric 群集上安装 Application Insights 时出错【英文标题】:Error Installing Application Insights on a Service Fabric Cluster 【发布时间】:2021-03-14 18:53:11 【问题描述】:我有一个现有的 Service Fabric 群集,其中包含我从 Azure 示例中获得的 application,现在,我正在尝试启用 Application Insights 来监视群集,在创建 Application Insight 之后,我复制了连接字符串并前往 VM 规模集,然后我使用我拥有的连接字符串安装了 Application Insights 扩展,但在安装过程完成后,我收到此错误消息
VM has reported a failure when processing extension 'ApplicationMonitoringWindows'. Error message: "Failed to enable application monitoring for IIS: System.IO.FileNotFoundException: Cannot find applicationHost.config at C:\windows\System32\inetsrv\config\applicationHost.config File name: 'C:\windows\System32\inetsrv\config\applicationHost.config' at Microsoft.ApplicationInsights.Redfield.Configurator.RuntimeConfigurators.IISConfigurator.UpdateApplicationHostConfig(IAppInsightsConfiguratorLogger logger, Boolean enable, Boolean skipMissingApplicationHostConfig, ISystem system) at Microsoft.ApplicationInsights.Redfield.Configurator.RuntimeConfigurators.IISConfigurator.Enable(IRuntimePaths runtimePaths, IAppInsightsConfiguratorLogger logger, Boolean writeToApplicationHostConfig, Boolean skipMissingApplicationHostConfig, ISystem system) at Microsoft.ApplicationInsights.Redfield.Configurator.RedfieldConfigurator.Enable(IRuntimePaths runtimePaths, IAppInsightsConfiguratorLogger logger, RedfieldConfiguration redfieldConfiguration, Boolean enableInstrumentationEngine, Boolean writeToApplicationHostConfig, Boolean skipMissingApplicationHostConfig) at Microsoft.ApplicationInsights.VmExtensionHandler.VmExtensionHandler.Enable(HandlerEnvironment handlerEnvironment, String configSequenceNumber)" More information on troubleshooting is available at https://aka.ms/vmextensionwindowstroubleshoot
我关注this 文档并在同一个 VM 规模集中安装了一个自定义 powershell 脚本扩展,下面是 ps 脚本
@
"redfieldConfiguration"= @
"instrumentationKeyMap"= @
"filters"= @(
@
"appFilter"= ".*";
"machineFilter"= ".*";
"virtualPathFilter": ".*",
"instrumentationSettings" :
"connectionString": "XXXXXXXXXXXXXXXXXXXXXX"
)
;
$privateCfgHashtable = @;
$vmss = Get-AzVmss -ResourceGroupName "XXXXX" -VMScaleSetName "XXXXX"
Add-AzVmssExtension -VirtualMachineScaleSet $vmss -Name "ApplicationMonitoring" -Publisher "Microsoft.Azure.Diagnostics" -Type "ApplicationMonitoringWindows" -TypeHandlerVersion "2.8" -Setting $publicCfgHashtable -ProtectedSetting $privateCfgHashtable
Update-AzVmss -ResourceGroupName $vmss.ResourceGroupName -Name $vmss.Name -VirtualMachineScaleSet $vmss
有没有我想念的地方?谢谢!
【问题讨论】:
【参考方案1】:我建议您关注monitoring your SF cluster 官方文档中的this tutorial。
由于您已经运行 .Net 应用并设置了您的应用洞察资源,您可以instrument 它来抽取必要的遥测数据。
Application Insights 有两个特定于 Service Fabric 的 NuGet,可根据场景使用。一种用于 Service Fabric 的本机服务,另一种用于容器和来宾可执行文件。若要详细了解 Application Insights SDK 和特定于 Service Fabric 的 NuGet 包,请参阅Microsoft Application Insights for Service Fabric。
然后,您可以在 Azure 门户上的 Application Insights 资源中查看应用的遥测数据。如果需要,您还可以将自定义检测添加到您的应用程序以改进诊断。
【讨论】:
以上是关于在 Service Fabric 群集上安装 Application Insights 时出错的主要内容,如果未能解决你的问题,请参考以下文章
启动 Service Fabric 群集时出错 (v 1.5.175)
Service Fabric 多节点 X509 群集 - 等待安装程序服务完成时超时
如何使用 CLI 部署到 Service Fabric 群集