Looking for a Query that shows stats of Azure monitor

Copper Contributor

Hello,

 

Does someone know the query to retrieve the different alerts like shown in the picture here below?

 

dentom_0-1648828351910.png

 

3 Replies

Hi @dentom,

In order to retrieve all the alerts in this page we are querying ARG.

If I understand currently you are referring to how we are getting the count of the alerts by severity. For that we are using ARG Facets options:

https://docs.microsoft.com/en-us/rest/api/azureresourcegraph/resourcegraph(2021-03-01)/resources/res...

ItayElbaz_0-1649062851326.png

 

The facets will return the summarize count by the given expression for all the results (even when using pagination it will take into account the full available results and not only current page).

 

 

 

@dentom 

 

ARG example:

alertsmanagementresources
| project name, subscriptionId, Severity_ = tostring(properties.context.SeverityDescription), TimeGenerated_ = todatetime(properties.essentials.startDateTime), properties
| where TimeGenerated_ > ago(30d) // and subscriptionId == '< insert your ID here>'
| where isnotempty(Severity_)
| summarize  count() by Severity_, subscriptionId

 

Clive_Watson_0-1649064728506.png

 

@dentom  You can also use readily available workbook for Alerts under Azure Monitor
Portal -> Monitor -> Workbooks -> Search Alert Screenshot 2022-04-14 075708.jpg