Bagikan melalui


Contoh kueri Azure Resource Graph untuk Azure Service Health

Halaman ini berisi kumpulan sampel kueri Azure Resource Graph untuk Azure Service Health.

Nota

Setelah setiap kueri, Anda akan melihat hasil yang diperbarui dalam waktu 5 menit secara umum.

Gambaran Umum

Halaman ini membantu Anda memantau dan memahami kesehatan layanan dan sumber daya Azure Anda menggunakan Kusto Query Language (KQL) melalui Azure Resource Graph.

Ini termasuk kueri sampel khusus untuk Azure Service Health.

Kueri sampel Service Health

Peristiwa Active Service Health berdasarkan langganan

Kueri ini memperlihatkan semua peristiwa Service Health aktif—seperti masalah layanan, pemeliharaan terencana, saran kesehatan, dan saran keamanan, dikelompokkan menurut jenis peristiwa dan menyertakan hitungan layanan yang terkena dampak.

Contoh akan menampilkan setiap jenis peristiwa termasuk hitungan yang menunjukkan berapa banyak langganan yang terpengaruh olehnya.

Nota

Masalah yang muncul tidak terkait dengan ID langganan dan akibatnya tidak dapat dikueri melalui ARG, yang berbasis ID langganan. Untuk informasi selengkapnya, buka halaman ini.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = tostring(properties.EventType), status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime
| where eventType == 'ServiceIssue' and status == 'Active'
| summarize count(subscriptionId) by name
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = tostring(properties.EventType), status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime | where eventType == 'ServiceIssue' and status == 'Active' | summarize count(subscriptionId) by name"

Semua peristiwa peringatan kesehatan aktif

Kueri ini mencantumkan semua acara penasihat kesehatan aktif dari Service Health pada setiap langganan yang dapat Anda akses.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime))
| where eventType == 'HealthAdvisory' and impactMitigationTime > now()
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime)) | where eventType == 'HealthAdvisory' and impactMitigationTime > now()"

Semua acara penghentian layanan mendatang

Kueri ini mengembalikan semua peristiwa Service Health mendatang untuk pensiun di semua langganan Anda.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, eventSubType = properties.EventSubType
| where eventType == "HealthAdvisory" and eventSubType == "Retirement"
| extend status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = todatetime(tolong(properties.ImpactStartTime)), impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime)), impact = properties.Impact
| where impactMitigationTime > datetime(now)
| project trackingId, subscriptionId, status, eventType, eventSubType, summary, description, priority, impactStartTime, impactMitigationTime, impact

Semua peristiwa pemeliharaan terencana yang aktif

Kueri ini menemukan dan mengembalikan daftar semua kejadian Kesehatan Layanan aktif pemeliharaan terencana pada semua langganan yang Anda miliki aksesnya.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime))
| where eventType == 'PlannedMaintenance' and impactMitigationTime > now()
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime)) | where eventType == 'PlannedMaintenance' and impactMitigationTime > now()"

Semua peristiwa Service Health aktif

Gunakan kueri ini untuk mencantumkan semua peristiwa Service Health aktif, seperti masalah layanan, pemeliharaan terencana, saran kesehatan, dan saran keamanan di semua langganan Anda.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime
| where (eventType in ('HealthAdvisory', 'SecurityAdvisory', 'PlannedMaintenance') and impactMitigationTime > now()) or (eventType == 'ServiceIssue' and status == 'Active')
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime | where (eventType in ('HealthAdvisory', 'SecurityAdvisory', 'PlannedMaintenance') and impactMitigationTime > now()) or (eventType == 'ServiceIssue' and status == 'Active')"

Semua kejadian masalah layanan aktif

Kueri ini menemukan dan mencantumkan semua masalah layanan aktif (pemadaman) dan peristiwa Service Health di semua langganan.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime
| where eventType == 'ServiceIssue' and status == 'Active'
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime | where eventType == 'ServiceIssue' and status == 'Active'"

Langkah berikutnya