I want to monitor my azure app service. Two use cases:
Application availability hosted inside azure app service (Application availability part) To do this - I have enabled Azure app insights (workspace-backed) and configured 'availability tests' -> Run a Kusto Query to query the availability test -> Create Monitors/Alerts etc -> Able to show this via Azure dashboard
Azure App service availability (Infra part) I currently do not know how to 'monitor' if there is a problem with the app service. For example, if the app service (infra / instances) has problem and the application does not have problem. Example: If the App service gets 'stopped' for a random reason, I should be able to tell by the logs that the issue was with the azure app service and not the application.
I have configured the Diagnostic Settings to forward logs to Analytics workspace. No luck. I have checked the metrics 'memory work set' and 'CPU time' as well -> If I 'STOP' the app service, these two metrics do not hit ZERO value.
Does anyone know how to 'monitor' the infra part of the Azure app service? We want to do this, because we have infra team who looks after the infrastructure. And the DevOps team who looks after the application. I need two different types of alerts depending on the 'origin' of the issue.
You might try looking in Analyze metrics for an Azure resource
Just from some poking around we can make a type of "heartbeat" search for all App Services you have running. This can be found in the AzureMetrics
table:
AppMetrics
| where SyntheticSource has "HeartbeatState"
| summarize arg_max(TimeGenerated, *) by AppRoleName
| extend lastHeartbeat_min = round(todouble(now() - TimeGenerated)/10000000/60,2)//conversion to minutes
//| where lastHeartbeat_min > 30//threshold in minutes
This is a very simple query that can then be developed to an analytics rule to trigger once a threshold is met (an app service has not checked in). I used 30 minutes as an arbitrary threshold, you can change it to anything.
I hope this helps!