简体   繁体   中英

Is there an Azure CLI command for getting Health Check status from Function App?

I've created a Function App, and everything seems to be running fine. In the Azure Portal, Function App Overview I can see that the Health Check is "100.00% (Healthy 2 / Degraded 0)", and on the Health Check page of the Function App I can see that it's enabled and the endpoint is "api/health".

Is there a way to get the "100% (Healthy 2 / Degraded 0)" through an Azure CLI command. It looks like az functionapp list only gives me the siteConfig.healthCheckPath value and that's not what I need.

在此处输入图像描述

You can fetch the values of Health Check Status metric by using the Azure CLI command az monitor metrics list as described here https://learn.microsoft.com/en-us/cli/azure/monitor/metrics?view=azure-cli-latest#az-monitor-metrics-list .

Example: az monitor metrics list --resource myresource --resource-group myresourcegroup --resource-type "Microsoft.Web/sites" --metric "HealthCheckStatus" --interval 5m

Note that the --interval property is important as health checks do not support the default 1m interval used by az monitor metrics list

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM