Azure Hizmet Durumu için Azure Kaynak Grafı örnek sorguları
Bu sayfa, Azure Hizmet Durumu için Azure Kaynak Grafı örnek sorgularından oluşan bir koleksiyondur.
Azure Hizmet Durumu
Etkin Hizmet Durumu olay aboneliğinin etkisi
Hizmet sorunları, planlı bakım, sistem durumu önerileri ve güvenlik önerileri dahil olmak üzere tüm etkin Hizmet Durumu olaylarını olay türüne göre gruplandırılmış ve etkilenen aboneliklerin sayısını içeren tüm etkin Hizmet Durumu olaylarını döndürür.
[! NOT:] Bu, ortaya çıkan sorunları içermez. Daha fazla bilgi için "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"
Tüm etkin sistem durumu danışmanlığı olayları
Kullanıcının erişimi olan tüm abonelikler genelindeki tüm etkin sistem durumu danışmanlığı Hizmet Durumu olaylarını döndürür.
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()"
Tüm etkin planlı bakım olayları
Kullanıcının erişimi olan tüm aboneliklerde tüm etkin planlı bakım Hizmet Durumu olaylarını döndürür.
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()"
Tüm etkin Hizmet Durumu olayları
Hizmet sorunları, planlı bakım, sistem durumu önerileri ve güvenlik önerileri dahil olmak üzere kullanıcının erişimi olan tüm abonelikler genelindeki tüm etkin Hizmet Durumu olaylarını döndürür.
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')"
Tüm etkin hizmet sorunu olayları
Kullanıcının erişimi olan tüm aboneliklerde tüm etkin hizmet sorunu (kesinti) Hizmet Durumu olaylarını döndürür.
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'"
Etkilenen kaynaklar onaylandı
Kullanıcının erişimi olan tüm aboneliklerde tüm hizmet sorunu (kesinti) Hizmet Durumu olayları için etkilenen tüm kaynakları döndürür.
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"
Daha fazla ayrıntı içeren onaylanmış etkilenen kaynaklar
Kullanıcının erişimi olan tüm aboneliklerde tüm hizmet sorunu (kesinti) Hizmet Durumu olayları için etkilenen tüm kaynakları döndürür. Bu sorgu ayrıca tablodan resources
daha fazla ayrıntı sağlar.
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"
Kaynak durumu
Kullanılabilirlik durumuna ve abonelik kimliğine göre sanal makinelerin sayısı
Aboneliklerinizin her birinde kullanılabilirlik durumlarına göre toplanan sanal makinelerin sayısını (tür Microsoft.Compute/virtualMachines
) döndürür.
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)"
Kaynak kimliklerine göre sanal makinelerin ve ilişkili kullanılabilirlik durumlarının listesi
Kullanılabilirlik durumuna göre toplanan sanal makinelerin (tür Microsoft.Compute/virtualMachines
) en son listesini döndürür. Sorgu ayrıca, kolay hata ayıklama ve azaltma için temelinde properties.targetResourceId
ilişkili Kaynak Kimliğini sağlar. Kullanılabilirlik durumları dört değerden biri olabilir: Kullanılabilir, Kullanılamıyor, Düzeyi Düşürülmüş ve Bilinmiyor. Kullanılabilirlik durumlarının her biri hakkında daha fazla bilgi için Azure Kaynak Durumu genel bakış sayfasına gidin.
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)"
Kaynak kimlikleri ve kaynak gruplarıyla kullanılabilirlik durumuna ve güç durumuna göre sanal makinelerin listesi
Sanal makineleriniz için uyumlu bir sistem durumu sağlamak üzere güç durumlarına ve kullanılabilirlik durumlarına göre toplanan sanal makinelerin (tür Microsoft.Compute/virtualMachines
) listesini döndürür. Sorgu ayrıca, kaynaklarınıza ilişkin ayrıntılı görünürlük için her girişle ilişkili kaynak grubu ve kaynak kimliğiyle ilgili ayrıntılar sağlar.
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'"
Kaynak kimlikleriyle kullanılamaan sanal makinelerin listesi
Kullanılabilirlik durumlarına göre toplanan sanal makinelerin (tür Microsoft.Compute/virtualMachines
) en son listesini döndürür. Doldurulan liste yalnızca kullanılabilirlik durumu Kullanılabilir olmayan sanal makineleri vurgular ve sanal makinelerinizin içinde olduğu tüm ilgili durumların farkında olduğunuzdan emin olun. Tüm sanal makineleriniz Kullanılabilir olduğunda hiçbir sonuç almayı bekleyebilirsiniz.
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)"
Sonraki adımlar
- Sorgu dili hakkında daha fazla bilgi edinin.
- Kaynakları keşfetme hakkında daha fazla bilgi edinin.