1

我在我的应用服务中创建了一个警报,该警报将警报发送到逻辑应用,然后逻辑应用将消息发布到 Microsoft Teams。 https://docs.microsoft.com/en-us/azure/azure-monitor/platform/action-groups-logic-app

一切都按预期工作接受我可以将数据从个人中获取到我的消息中。

我在逻辑应用程序的架构中使用了以下内容

{
    "schemaId": "azureMonitorCommonAlertSchema",
    "data": {
        "essentials": {
            "alertId": "/subscriptions/MyAlert",
            "alertRule": "Web - Test teams",
            "severity": "Sev1",
            "signalType": "Metric",
            "monitorCondition": "Fired",
            "monitoringService": "Platform",
            "alertTargetIDs": [
                "/subscriptions/MySub"
            ],
            "originAlertId": "bd40051b-35fa-,
            "firedDateTime": "2020-06-03T14:53:34.0942607Z",
            "description": "",
            "essentialsVersion": "1.0",
            "alertContextVersion": "1.0"
        },
        "alertContext": {
            "properties": null,
            "conditionType": "SingleResourceMultipleMetricCriteria",
            "condition": {
                "windowSize": "PT5M",
                "allOf": [
                    {
                        "metricName": "Http2xx",
                        "metricNamespace": "Microsoft.Web/sites",
                        "operator": "GreaterThan",
                        "threshold": "5",
                        "timeAggregation": "Total",
                        "dimensions": [
                            {
                                "name": "ResourceId",
                                "value": "MyWebs.com"
                            }
                        ],
                        "metricValue": 24,
                        "webTestName": null
                    }
                ],
                "windowStartTime": "2020-06-03T14:45:23.095Z",
                "windowEndTime": "2020-06-03T14:50:23.095Z"
            }
        }
    }
}

然后在设计器中添加字段 逻辑应用设计器

以下是消息正文“内容”的逻辑代码视图中的详细信息:“

你的 Azure Monitor 警报已触发
\nAzure 监视器警报规则 Web - 测试团队在 @{triggerBody()?['body']?['data']?['alertContext']?['condition']?[' 触发windowEndTime']}
\n
\nRule: @{triggerBody()?['body']?['data']?['essentials']?['alertRule']}
\nBody:@{triggerBody()}
\nHeader :@{triggerOutputs()['headers']}
\nheaders:@{triggerBody()?['headers']}
\essentials:@{triggerBody()?['body']?['data']?['要领']}
\ndata:@{triggerBody()?['body']?['data']}
\nbody:@{triggerBody()?['body']}

"

唯一填充的字段是正文,没有任何特定字段

你的 Azure Monitor 警报被触发 Azure Monitor 警报规则 Web - 测试团队被触发于

RkkKACgAAAAAAAAAEABEgMLahbH0Sqw1EVoRy7Y8AQAQANlpmHhZlSRMkU6bLTb+DSk=","Content-Length":"1254","Content-Type":"application/json; charset=utf-8"} 标题:要领:数据:正文:

4

1 回答 1

0

我不得不手动更新逻辑代码并删除额外的正文标签

原来的

@{triggerBody()?['body']?['data']?['alertContext']?['condition']?['windowEndTime']}

对此

@{triggerBody()?['data']?['alertContext']?['condition']?['windowEndTime']}

于 2020-06-04T08:41:49.977 回答