0

如果有任何计划的定期维护,我们将显示 URL、VPN 和 VM 的 SLA 图表,我们希望将 KQL SLA 图表中的时间排除为已知停机时间。

在此期间,我们通过 powershell 禁用警报,我们将以下列传递给 Loganalytics 自定义表。

     "resourcename": "$resourcename",
     "Alertstate": "Enabled",
     "Scheduledmaintenance" : "stop",
     "Environment" : "UAT",
     "timestamp": "$TimeStampField",

    Now we want to use join condition SLA charts queries  with custom table data and exclude the time range in SLA charts during scheduled maintenance.

    Adding query as per request
    ---------------------------

    url_json_CL
    | where Uri_s contains "xxxx"
    | extend Availablity = iff(StatusCode_d ==200,1.000,0.000)
    | extend urlhit = 1.000
    | summarize PassCount = sum(Availablity), TestCount = sum(urlhit) by Uri_s ,ClientName_s
    | extend AVLPERCENTAGE = ((PassCount / TestCount ) * 100)
    | join kind=leftouter 
(  scheduledmaintenance2_CL
     | where ResourceName_s == "VMname" 
     | where ScheduledMaintenance_s == "start" 
     | extend starttime = timestamp_t)
     on ClientName_s
    | join kind= leftouter
     (scheduledmaintenance2_CL
     | where ResourceName_s == "VMname" 
     | where ScheduledMaintenance_s == "stop" 
     | extend stoptime = timestamp_t )
     on ClientName_s
     | extend excludedtime=stoptime - starttime  
     | project ClientName_s, ResourceName_s, excludedtime, AVLPERCENTAGE , Uri_s 
     | top 3 by  ClientName_s  desc
4

1 回答 1

0

可以在 Azure Monitor 中执行跨资源日志查询

  1. 使用 Application Insights explorer,我们也可以查询日志分析工作区自定义表。

workspace("/subscriptions/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/resourcegroups/rgname/providers/Microsoft.OperationalInsights/workspaces/workspacename").Event | count

  1. 使用 Log Analytics 日志资源管理器,您可以查询 Application Insights 可用性结果

app("applicationinsightsinstancename").availabilityResults

您可以使用上述任何选项来查询所需的表并连接这些表。请参阅有关联接的此文档。

附加文档参考

希望这可以帮助。

于 2019-07-09T18:01:02.463 回答