Azure 警报 - 使用 API 创建标准 Web 测试而不检查 http 状态代码? [英] Azure Alerts - Create standard web test with API WITHOUT http status code check?

查看:13
本文介绍了Azure 警报 - 使用 API 创建标准 Web 测试而不检查 http 状态代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个

解决方案

正如评论中提到的,我使用相同的标准进行测试,在 ExpectedHttpStatusCode 中不提供 httpstatuscode 并设置它为 null .我还将 IgnoreHttpsStatusCode 设置为 true 只是为了更安全.

验证规则":{预期的HttpStatusCode":空,忽略HttpsStatusCode":真,内容验证":空,SSLCheck":真,SSLCertRemainingLifetimeCheck":[参数('certRemainingLifetimeCheck')]"}

但上面只将 HTTP response: 设置为 null .它不会禁用 HTTP 响应.即使您没有提供 ExpectedHttpStatusCodeIgnoreHttpsStatusCode ,它也会启用 Http Response 并将其设置为 null .

验证规则":{内容验证":空,SSLCheck":真,SSLCertRemainingLifetimeCheck":[参数('certRemainingLifetimeCheck')]"}

在响应中设置一些 HTTP 代码并将 IgnoreHttpsStatusCode 添加为 true 将忽略您在测试运行中提供的相同 http 代码,如

最终的结论是不可能使用 ARM 模板在成功标准中禁用 HTTP 响应,但即使启用它也可以将其设置为 Null.

I'm setting up an Azure Alert Rule for a Webtest with Terraform and ARM template. Works fine.

Some of the URLs that I need to check might return "error" (http status code >= 400). When I manually modify or setup the alert, I'd disable "HTTP response" in "Success criteria".

How would I do that in an ARM template? I exported two tests in portal and diff'd them. There's no difference. See https://gist.github.com/alexs77/fc61992f84cf2d3ca80bda54cb2717cb for details.

According to Microsoft.Insights webtests 2018-05-01-preview I would have expected, that setting IgnoreHttpsStatusCode would do just that. But no matter if I set it to true or false, the created web test has "HTTP response" enabled.

Well?!?

How do you create a web test with HTTP resonse disabled?

解决方案

As mentioned in comments , I tested using the same criteria by not providing httpstatuscode in ExpectedHttpStatusCode and setting it to null . I also set the IgnoreHttpsStatusCode as true just to be on safer side.

"ValidationRules": {
            "ExpectedHttpStatusCode": null,
            "IgnoreHttpsStatusCode": true,
            "ContentValidation": null,
            "SSLCheck": true,
            "SSLCertRemainingLifetimeCheck": "[parameters('certRemainingLifetimeCheck')]"
          }

But the above only sets the HTTP response: as null . It doesn't disable the HTTP response. Even if you are not providing ExpectedHttpStatusCode and IgnoreHttpsStatusCode , then also it enables Http Response and sets it to null .

      "ValidationRules": {
        "ContentValidation": null,
        "SSLCheck": true,
        "SSLCertRemainingLifetimeCheck": "[parameters('certRemainingLifetimeCheck')]"
      }

Setting some HTTP code in the response and adding the IgnoreHttpsStatusCode as true will ignore the same http code that you have provided in the test runs as mentioned in the Microsoft Document you have referred to.

Final conclusion will be it is not possible to disable the HTTP response in success criteria using ARM Template but it can be set to Null even if its enabled.

这篇关于Azure 警报 - 使用 API 创建标准 Web 测试而不检查 http 状态代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆