LoginSignup
4
2

Azure で設定したアラートを全部出す方法

Posted at

「すべてのリソース」というマネージド・サービスの横断で全部の作ったリソースが表として出て、簡単なフィルターが使えるものがあり、ごちゃ混ぜ感がすごくて最初驚いたけど、使ってみると思いの外すごく便利。マネージド・サービスがたくさんあるのであれ作ったやつどこだっけな?がだいぶ解消されるのと、あっこのサービスは裏でこんなの生成しているんだってのがリンクを頑張って掘って探さなくてもわかるのが嬉しい。

image.png


全く同じような話で、全部のアラートは?というアラートに絞った状態で欲しい場合がある。実はこれもあるらしい。Azure ポータル -> 左のメニューから[モニター] -> [アラート] -> [アラート ルール] -> [クエリを開く] -> [クエリの実行]
image.png

image.png

resources
| where type in~ ('microsoft.insights/metricalerts','microsoft.insights/scheduledqueryrules') and ['kind'] !in~ ('LogToMetric','LogToApplicationInsights')
| extend severity = strcat("Sev", properties["severity"])
| extend enabled = tobool(properties["enabled"])
| where enabled in~ ('true')
| project id,name,type,properties,enabled,severity,subscriptionId
| union (resources | where type =~ 'microsoft.alertsmanagement/smartdetectoralertrules' | extend severity = tostring(properties["severity"])
| extend enabled = properties["state"] =~ 'Enabled' | where enabled in~ ('true') | project id,name,type,properties,enabled,severity,subscriptionId), (resources | where type =~ 'microsoft.insights/activitylogalerts' | extend severity = "Sev4"
| extend enabled = tobool(properties["enabled"]) | mvexpand innerCondition = properties["condition"]["allOf"] | where innerCondition["field"] =~ 'category'
| where enabled in~ ('true') | project id,name,type,properties,enabled,severity,subscriptionId)
| order by tolower(name) asc

image.png

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2