2017-02-23 77 views
0

我們正在使用Application Insight並添加了幾個Web測試來監控我們的網站。網絡測試每5分鐘從三個位置運行,並且所有三個位置都需要在5分鐘內失敗,以便警報熄滅。如何獲得可用性Azure Application Insights中Web測試的SLA報告

Application Insights中是否有一些報告可用於向我們的客戶報告上個月的可用性?我們需要至少有一個小數的可用性百分比。

回答

4

您可以使用Application Insights Analytics計算SLA。點擊「分析」菜單項的概述頁面,並使用以下查詢:

availabilityResults 
| where timestamp > ago(30d) 
| summarize _successCount=todouble(countif(success == 1)), 
      _errorCount=todouble(countif(success == 0)), 
      _totalCount=todouble(count()) by name 
| project 
      ["Name"] = name, 
      ["SLA"] = _successCount/_totalCount * 100 
| order by ["SLA"] 

你應該得到這樣的事情:

enter image description here

然後你就可以將其固定到儀表板(還有在右上角一個圖釘圖標):

enter image description here

這僅僅是一個例子 - 在這裏喲你可以找到完整的分析查詢語言參考 - 這是相當強大的:https://docs.microsoft.com/en-us/azure/application-insights/app-insights-analytics-reference。您可以根據您對SLA的定義進行調整。

編輯:下面是一個查詢更接近你的問題

availabilityResults 
| where timestamp > ago(30d) 
// check whether location failed within 5m bin 
| summarize _failure=iff(countif(success == 0)>0, 1, 0) by name, location, bin(timestamp, 5m) 
// check whether all locations failed within 5m bin 
| summarize _failureAll=iff(sum(_failure)>=3, 1, 0) by name, bin(timestamp, 5m) 
// count all failed 5 minute bins and total number of bins 
| summarize _failuresCount=sum(_failureAll), _totalCount=count() by name 
| project ["Name"] = name, 
      ["SLA"] = todouble(_totalCount - _failuresCount)/todouble(_totalCount) * 100 
| order by ["SLA"] 
+0

感謝的一個例子。它工作得很好,說明是100%有幫助。與報告一樣,當你得到某些東西時你只需要更多:-)。現在我會看看是否可以找出如何更改where子句以獲取上個月的數據,甚至是最近6個月的按月分組的數據。 – MathiasR

0

應用程序見解具有「可用性」度量標準,您可以在MetricsExplorer中繪製圖表,然後將其固定到儀表板。 HTH!

相關問題