استعلامات نموذجية عن Azure Resource Graph لحالة خدمة Azure
تشمل هذه الصفحة استعلامات نموذجيةعن Azure Resource Graph الخاصة بحالة خدمة Azure.
حالة خدمة Azure
تأثير اشتراك حدث حالة الخدمة النشطة
إرجاع جميع أحداث حالة الخدمة النشطة -بما في ذلك مشكلات الخدمة، والصيانة المخططة، وإرشادات الحالة، والتحذيرات الأمنية- مجمعةً حسب نوع الحدث وتتضمن عدد الاشتراكات المتأثرة.
[! ملاحظة:] هذا لا يتضمن المشكلات الناشئة. لمزيد من المعلومات افتح "https://rest/api/resourcehealth/emerging-issues".
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"
جميع الأحداث الصحية النشطة الاستشارية
إرجاع جميع أحداث «حالة الخدمة» الاستشارية الخاصة بالحالة النشطة عبر جميع الاشتراكات التي يمكن للمستخدم الوصول إليها.
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()"
جميع أحداث الصيانة المخطط لها النشطة
إرجاع جميع أحداث «حالة الخدمة» الخاصة بالصيانة المخططة عبر جميع الاشتراكات التي يمكن للمستخدم الوصول إليها.
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()"
جميع أحداث حالة الخدمة النشطة
إرجاع جميع أحداث حالة الخدمة النشطة عبر جميع الاشتراكات التي يمكن للمستخدم الوصول إليها، بما في ذلك مشكلات الخدمة، والصيانة المخططة، وإرشادات الحالة، والتحذيرات الأمنية.
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')"
جميع أحداث إصدار الخدمة النشطة
إرجاع جميع أحداث «حالة الخدمة» الخاصة بمشكلة الخدمة النشطة (الانقطاع) عبر جميع الاشتراكات التي يمكن للمستخدم الوصول إليها.
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'"
تأكيد الموارد المتأثرة
إرجاع كافة الموارد المتأثرة لكافة أحداث حالة الخدمة (الانقطاع) الخاصة بالخدمة عبر جميع الاشتراكات التي يمكن للمستخدم الوصول إليها.
ServiceHealthResources
| where type == "microsoft.resourcehealth/events/impactedresources"
| extend TrackingId = split(split(id, "/events/", 1)[0], "/impactedResources", 0)[0]
| extend p = parse_json(properties)
| project subscriptionId, TrackingId, resourceName= p.resourceName, resourceGroup=p.resourceGroup, resourceType=p.targetResourceType, details = p, id
az graph query -q "ServiceHealthResources | where type == 'microsoft.resourcehealth/events/impactedresources' | extend TrackingId = split(split(id, '/events/', 1)[0], '/impactedResources', 0)[0] | extend p = parse_json(properties) | project subscriptionId, TrackingId, resourceName= p.resourceName, resourceGroup=p.resourceGroup, resourceType=p.targetResourceType, details = p, id"
تأكيد الموارد المتأثرة بمزيد من التفاصيل
إرجاع كافة الموارد المتأثرة لكافة أحداث حالة الخدمة (الانقطاع) الخاصة بالخدمة عبر جميع الاشتراكات التي يمكن للمستخدم الوصول إليها. يوفر هذا الاستعلام أيضا المزيد من التفاصيل من resources
الجدول.
servicehealthresources
| where type == "microsoft.resourcehealth/events/impactedresources"
| extend TrackingId = split(split(id, "/events/", 1)[0], "/impactedResources", 0)[0]
| extend p = parse_json(properties)
| project subscriptionId, TrackingId, targetResourceId= tostring(p.targetResourceId), details = p
| join kind=inner (
resources
)
on $left.targetResourceId == $right.id
az graph query -q "ServiceHealthResources | where type == 'microsoft.resourcehealth/events/impactedresources' | extend TrackingId = split(split(id, '/events/', 1)[0], '/impactedResources', 0)[0] | extend p = parse_json(properties) | project subscriptionId, TrackingId, targetResourceId = tostring(p.targetResourceId), details = p | join kind=inner (resources) on $left.targetResourceId == $right.id"
صحة الموارد
عدد الأجهزة الظاهرية حسب حالة التوفر ومعرف الاشتراك
لعرض عدد الأجهزة الظاهرية (النوع Microsoft.Compute/virtualMachines
) مجمعة حسب حالة توفرها عبر كل اشتراك من اشتراكاتك.
HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| summarize count() by subscriptionId, AvailabilityState = tostring(properties.availabilityState)
az graph query -q "HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | summarize count() by subscriptionId, AvailabilityState = tostring(properties.availabilityState)"
قائمة الأجهزة الظاهرية وحالات التوفر المقترنة حسب معرفات الموارد
لعرض أحدث قائمة بالأجهزة الظاهرية (النوع Microsoft.Compute/virtualMachines
) مجمعة حسب حالة التوفر. يوفر الاستعلام أيضا معرف المورد المقترن استنادا properties.targetResourceId
إلى ، لتصحيح الأخطاء بسهولة والتخفيف. يمكن أن تكون حالات التوفر واحدة من أربع قيم: متوفرة وغير متوفرة ومتدهورة وغير معروفة. لمزيد من التفاصيل حول معنى كل حالة من حالات التوفر، انتقل إلى نظرة عامة على Azure Resource Health.
HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)
az graph query -q "HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)"
قائمة الأجهزة الظاهرية حسب حالة التوفر وحالة الطاقة مع معرفات الموارد ومجموعات الموارد
إرجاع قائمة الأجهزة الظاهرية (النوع Microsoft.Compute/virtualMachines
) المجمعة على حالة الطاقة وحالة التوفر لتوفير حالة صحية متماسكة للأجهزة الظاهرية. يوفر الاستعلام أيضا تفاصيل حول مجموعة الموارد ومعرف المورد المرتبط بكل إدخال للحصول على رؤية مفصلة لمواردك.
Resources
| where type =~ 'microsoft.compute/virtualmachines'
| project resourceGroup, Id = tolower(id), PowerState = tostring( properties.extended.instanceView.powerState.code)
| join kind=leftouter (
HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| where tostring(properties.targetResourceType) =~ 'microsoft.compute/virtualmachines'
| project targetResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState))
on $left.Id == $right.targetResourceId
| project-away targetResourceId
| where PowerState != 'PowerState/deallocated'
az graph query -q "Resources | where type =~ 'microsoft.compute/virtualmachines' | project resourceGroup, Id = tolower(id), PowerState = tostring( properties.extended.instanceView.powerState.code) | join kind=leftouter ( HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | where tostring(properties.targetResourceType) =~ 'microsoft.compute/virtualmachines' | project targetResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)) on \$left.Id == \$right.targetResourceId | project-away targetResourceId | where PowerState != 'PowerState/deallocated'"
قائمة الأجهزة الظاهرية غير المتوفرة بواسطة معرفات الموارد
لعرض أحدث قائمة بالأجهزة الظاهرية (النوع Microsoft.Compute/virtualMachines
) مجمعة حسب حالة توفرها. تسلط القائمة المأهولة الضوء فقط على الأجهزة الظاهرية التي لا تتوفر حالة توفرها للتأكد من أنك على دراية بجميع الحالات المتعلقة بالأجهزة الظاهرية الخاصة بك. عندما تكون جميع الأجهزة الظاهرية متوفرة، يمكنك توقع عدم تلقي أي نتائج.
HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| where tostring(properties.availabilityState) != 'Available'
| summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)
az graph query -q "HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | where tostring(properties.availabilityState) != 'Available' | summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)"
الخطوات التالية
- الاطلاع على المزيد حول لغة الاستعلام.
- تعرف على المزيد عن كيفية استكشاف الموارد.