簡體   English   中英

Azure中的活動日志警報

[英]Activity Log Alerts in Azure

我在Azure中創建了一個活動日志警報,該警報針對Application Insights實例進行自定義日志搜索。 警報正在工作,並且通過我設置的渠道通知了行動小組。 我遇到的問題是在我們用於部署資源的手臂模板中創建該警報。

在門戶網站中查看自動化腳本時,警報被忽略並且不可見。 (microsoft.insights / scheduledqueryrules)我無法在線找到有關如何在模板中寫入條件的任何信息,因此它可以與自定義日志搜索一起使用。

在何處查找有關如何編寫條件或如何從門戶網站中提取這些警報的模板的信息的任何建議。

這是一個ARM模板部件,用於使用計划的查詢創建警報。 它還添加了一組操作組,這些組在觸發警報時得到通知:

{
  "name": "[parameters('scheduleQueryMonitorApplicationError')]",
  "type": "microsoft.insights/scheduledqueryrules",
  "apiVersion": "2018-04-16",
  "location": "[resourceGroup().location]",
  "tags": {
    "[concat('hidden-link:', resourceGroup().id, '/resourceGroups/', parameters('resourceGroupName'), '/providers/microsoft.insights/components/', parameters('applicationInsightsName'))]": "Resource"
  },
  "properties": {
    "description": "[parameters('scheduleQueryMonitorApplicationError')]",
    "enabled": "true",
    "source": {
      "query": "traces | where severityLevel == 3",
      "queryType": "ResultCount",
      "dataSourceId": "[resourceId('microsoft.insights/components', parameters('applicationInsightsName'))]"
    },
    "schedule": {
      "frequencyInMinutes": 5,
      "timeWindowInMinutes": 5
    },
    "action": {
      "odata.type": "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
      "severity": "3",
      "aznsAction": {
        "actionGroup": "[array( resourceId('microsoft.insights/actiongroups', parameters('actionGroupName')) )]"
      },
      "trigger": {
        "threshold": 1,
        "thresholdOperator": "GreaterThan"
      }
    }
  },
  "dependsOn": [
    "[resourceId('microsoft.insights/components', parameters('applicationInsightsName'))]"
  ]
},

請參閱 stackoverflow線程,詢問類似問題。 Elfocrash提到他為此寫了一篇博客文章,解釋了它是如何工作的。 我嘗試了他的方法,並且有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM