Scheduled Query Rules - List By Subscription
擷取訂用帳戶中的排程查詢規則定義。
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules?api-version=2021-08-01
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
subscription
|
path | True |
string minLength: 1 |
目標訂用帳戶的標識碼。 |
|
api-version
|
query | True |
string minLength: 1 |
要用於這項作業的 API 版本。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
已排程查詢規則清單的成功要求 |
|
| Other Status Codes |
錯誤的請求 |
安全性
azure_auth
Azure Active Directory OAuth2 流
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 | Description |
|---|---|
| user_impersonation | 模擬您的用戶帳戶 |
範例
List scheduled query rules by subscription
範例要求
GET https://management.azure.com/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/providers/Microsoft.Insights/scheduledQueryRules?api-version=2021-08-01
範例回覆
{
"value": [
{
"id": "/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf",
"name": "perf",
"type": "microsoft.insights/scheduledqueryrules",
"location": "eastus",
"tags": {},
"properties": {
"description": "Performance rule",
"severity": 4,
"enabled": true,
"evaluationFrequency": "PT5M",
"scopes": [
"/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"
],
"targetResourceTypes": [
"Microsoft.Compute/virtualMachines"
],
"windowSize": "PT10M",
"criteria": {
"allOf": [
{
"query": "Perf | where ObjectName == \"Processor\"",
"timeAggregation": "Average",
"metricMeasureColumn": "% Processor Time",
"resourceIdColumn": "resourceId",
"dimensions": [
{
"name": "ComputerIp",
"operator": "Exclude",
"values": [
"192.168.1.1"
]
},
{
"name": "OSType",
"operator": "Include",
"values": [
"*"
]
}
],
"operator": "GreaterThan",
"threshold": 70,
"failingPeriods": {
"numberOfEvaluationPeriods": 1,
"minFailingPeriodsToAlert": 1
}
}
]
},
"muteActionsDuration": "PT30M",
"actions": {
"actionGroups": [
"/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"
],
"customProperties": {
"key11": "value11",
"key12": "value12"
}
},
"autoMitigate": true,
"isWorkspaceAlertsStorageConfigured": true,
"checkWorkspaceAlertsStorageConfigured": true,
"skipQueryValidation": true
}
},
{
"id": "/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/MyResourceGroupName2/providers/microsoft.insights/scheduledqueryrules/heartbeat",
"name": "heartbeat",
"type": "microsoft.insights/scheduledqueryrules",
"location": "eastus",
"tags": {},
"properties": {
"description": "Health check rule",
"severity": 4,
"enabled": true,
"evaluationFrequency": "PT5M",
"scopes": [
"/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"
],
"targetResourceTypes": [
"Microsoft.Compute/virtualMachines"
],
"windowSize": "PT10M",
"criteria": {
"allOf": [
{
"query": "Heartbeat",
"timeAggregation": "Count",
"dimensions": [],
"operator": "GreaterThan",
"threshold": 360,
"failingPeriods": {
"numberOfEvaluationPeriods": 1,
"minFailingPeriodsToAlert": 1
}
}
]
},
"muteActionsDuration": "PT30M",
"actions": {
"actionGroups": [
"/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"
],
"customProperties": {
"key11": "value11",
"key12": "value12"
}
},
"autoMitigate": true,
"isWorkspaceAlertsStorageConfigured": true,
"checkWorkspaceAlertsStorageConfigured": true,
"skipQueryValidation": true
}
}
]
}
定義
| 名稱 | Description |
|---|---|
| Actions |
警示引發時要叫用的動作。 |
|
Alert |
警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。 |
| Condition |
排程查詢規則的條件。 |
|
condition |
criteria 運算子。 只有 LogAlert 類型的規則才相關且必要。 |
|
created |
建立資源的身分識別類型。 |
| Dimension |
維度分割和篩選定義 |
|
dimension |
維度值的運算符 |
|
Error |
資源管理錯誤其他資訊。 |
|
Error |
描述錯誤回應的格式。 |
|
Error |
錯誤回應 |
|
Failing |
引發警示所需的所選回溯時間範圍內所需的違規數目下限。 僅與 LogAlert 類型的規則相關。 |
| Kind |
指出排程查詢規則的類型。 預設值為LogAlert。 |
|
Scheduled |
定義排程查詢規則條件的規則準則。 |
|
Scheduled |
排程的查詢規則資源。 |
|
Scheduled |
表示排程查詢規則資源的集合。 |
|
system |
與建立和上次修改資源相關的元數據。 |
|
time |
匯總類型。 只有 LogAlert 類型的規則才相關且必要。 |
Actions
警示引發時要叫用的動作。
| 名稱 | 類型 | Description |
|---|---|---|
| actionGroups |
string[] |
動作群組資源標識碼,以在警示引發時叫用。 |
| customProperties |
object |
警示承載的屬性。 |
AlertSeverity
警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。
| 值 | Description |
|---|---|
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 |
Condition
排程查詢規則的條件。
| 名稱 | 類型 | Description |
|---|---|---|
| dimensions |
維度條件清單 |
|
| failingPeriods |
引發警示所需的所選回溯時間範圍內所需的違規數目下限。 僅與 LogAlert 類型的規則相關。 |
|
| metricMeasureColumn |
string |
包含計量量值編號的數據行。 僅與 LogAlert 類型的規則相關。 |
| metricName |
string |
要傳送的計量名稱。 只有 LogToMetric 類型的規則才相關且必要。 |
| operator |
criteria 運算子。 只有 LogAlert 類型的規則才相關且必要。 |
|
| query |
string |
記錄查詢警示 |
| resourceIdColumn |
string |
包含資源標識碼的數據行。數據行的內容必須是格式化為資源標識碼的 URI。僅與 LogAlert 類型的規則相關。 |
| threshold |
number (double) |
啟動警示的準則臨界值。 只有 LogAlert 類型的規則才相關且必要。 |
| timeAggregation |
匯總類型。 只有 LogAlert 類型的規則才相關且必要。 |
conditionOperator
criteria 運算子。 只有 LogAlert 類型的規則才相關且必要。
| 值 | Description |
|---|---|
| Equals | |
| GreaterThan | |
| GreaterThanOrEqual | |
| LessThan | |
| LessThanOrEqual |
createdByType
建立資源的身分識別類型。
| 值 | Description |
|---|---|
| User | |
| Application | |
| ManagedIdentity | |
| Key |
Dimension
維度分割和篩選定義
| 名稱 | 類型 | Description |
|---|---|---|
| name |
string |
維度的名稱 |
| operator |
維度值的運算符 |
|
| values |
string[] |
維度值清單 |
dimensionOperator
維度值的運算符
| 值 | Description |
|---|---|
| Include | |
| Exclude |
ErrorAdditionalInfo
資源管理錯誤其他資訊。
| 名稱 | 類型 | Description |
|---|---|---|
| info |
object |
其他資訊。 |
| type |
string |
其他信息類型。 |
ErrorContract
描述錯誤回應的格式。
| 名稱 | 類型 | Description |
|---|---|---|
| error |
錯誤回應 |
ErrorResponse
錯誤回應
| 名稱 | 類型 | Description |
|---|---|---|
| additionalInfo |
錯誤其他資訊。 |
|
| code |
string |
錯誤碼。 |
| details |
錯誤詳細數據。 |
|
| message |
string |
錯誤訊息。 |
| target |
string |
錯誤目標。 |
FailingPeriods
引發警示所需的所選回溯時間範圍內所需的違規數目下限。 僅與 LogAlert 類型的規則相關。
| 名稱 | 類型 | 預設值 | Description |
|---|---|---|---|
| minFailingPeriodsToAlert |
integer (int64) |
1 |
觸發警示的違規次數。 應小於或等於 numberOfEvaluationPeriods。 預設值為 1 |
| numberOfEvaluationPeriods |
integer (int64) |
1 |
匯總回溯點的數目。 回溯時間範圍是根據匯總數據粒度 (windowSize) 和選取的匯總點數目來計算。 預設值為 1 |
Kind
指出排程查詢規則的類型。 預設值為LogAlert。
| 值 | Description |
|---|---|
| LogAlert | |
| LogToMetric |
ScheduledQueryRuleCriteria
定義排程查詢規則條件的規則準則。
| 名稱 | 類型 | Description |
|---|---|---|
| allOf |
要根據指定範圍評估的條件清單 |
ScheduledQueryRuleResource
排程的查詢規則資源。
| 名稱 | 類型 | Description |
|---|---|---|
| etag |
string |
etag 欄位 不需要。 如果在回應本文中提供,則也必須根據一般 etag 慣例提供它作為標頭。 實體標籤用於比較來自相同要求資源的兩個或多個實體。 HTTP/1.1 會在 etag(第 14.19 節)、If-Match(第 14.24 節)、If-None-Match (section 14.26) 和 If-Range (第 14.27 節) 標頭字段中使用實體標記。 |
| id |
string |
資源的完整資源標識碼。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
| kind |
指出排程查詢規則的類型。 預設值為LogAlert。 |
|
| location |
string |
資源所在的地理位置 |
| name |
string |
資源的名稱 |
| properties.actions |
警示引發時要叫用的動作。 |
|
| properties.autoMitigate |
boolean |
指出是否應該自動解決警示的旗標。 默認值為 true。 僅與 LogAlert 類型的規則相關。 |
| properties.checkWorkspaceAlertsStorageConfigured |
boolean |
旗標,指出此排程的查詢規則是否應該儲存在客戶的記憶體中。 默認值為 false。 僅與 LogAlert 類型的規則相關。 |
| properties.createdWithApiVersion |
string |
建立此警示規則時所使用的 API 版本 |
| properties.criteria |
定義排程查詢規則條件的規則準則。 |
|
| properties.description |
string |
排程查詢規則的描述。 |
| properties.displayName |
string |
警示規則的顯示名稱 |
| properties.enabled |
boolean |
指出是否啟用此排程查詢規則的旗標。 值應該是 true 或 false |
| properties.evaluationFrequency |
string (duration) |
以 ISO 8601 持續時間格式來評估排程查詢規則的頻率。 只有 LogAlert 類型的規則才相關且必要。 |
| properties.isLegacyLogAnalyticsRule |
boolean |
True 是表示 如果警示規則是舊版 Log Analytic 規則 |
| properties.isWorkspaceAlertsStorageConfigured |
boolean |
旗標,指出是否已將這個排程的查詢規則設定為儲存在客戶的記憶體中。 默認值為 false。 |
| properties.muteActionsDuration |
string (duration) |
在引發警示之後,將所選期間(ISO 8601 持續時間格式)的動作設為靜音。 僅與 LogAlert 類型的規則相關。 |
| properties.overrideQueryTimeRange |
string (duration) |
如果指定,則會覆寫查詢時間範圍(預設值為 WindowSize*NumberOfEvaluationPeriods)。 僅與 LogAlert 類型的規則相關。 |
| properties.scopes |
string[] |
此排程查詢規則的範圍是資源標識碼的清單。 |
| properties.severity |
Alert |
警示的嚴重性。 應該是介於 [0-4] 之間的整數。 值為 0 最嚴重。 只有 LogAlert 類型的規則才相關且必要。 |
| properties.skipQueryValidation |
boolean |
指出是否應該驗證所提供查詢的旗標。 默認值為 false。 僅與 LogAlert 類型的規則相關。 |
| properties.targetResourceTypes |
string[] |
建立/更新警示之目標資源的資源類型清單。 例如,如果範圍是資源群組,且 targetResourceTypes 是 Microsoft.Compute/virtualMachines,則會針對符合警示準則的資源群組中的每個虛擬機引發不同的警示。 僅與 LogAlert 類型的規則相關 |
| properties.windowSize |
string (duration) |
警示查詢將執行的時間週期(以 ISO 8601 持續時間格式表示)。 只有 LogAlert 類型的規則才相關且必要。 |
| systemData |
ScheduledQueryRule 的 SystemData。 |
|
| tags |
object |
資源標籤。 |
| type |
string |
資源的型別。 例如“Microsoft.Compute/virtualMachines” 或 “Microsoft.Storage/storageAccounts” |
ScheduledQueryRuleResourceCollection
表示排程查詢規則資源的集合。
| 名稱 | 類型 | Description |
|---|---|---|
| nextLink |
string |
提供連結以擷取下一組元素。 |
| value |
排程查詢規則資源的值。 |
systemData
與建立和上次修改資源相關的元數據。
| 名稱 | 類型 | Description |
|---|---|---|
| createdAt |
string (date-time) |
資源建立的時間戳(UTC)。 |
| createdBy |
string |
建立資源的身分識別。 |
| createdByType |
建立資源的身分識別類型。 |
|
| lastModifiedAt |
string (date-time) |
上次修改的資源時間戳 (UTC) |
| lastModifiedBy |
string |
上次修改資源的身分識別。 |
| lastModifiedByType |
上次修改資源的身分識別類型。 |
timeAggregation
匯總類型。 只有 LogAlert 類型的規則才相關且必要。
| 值 | Description |
|---|---|
| Count | |
| Average | |
| Minimum | |
| Maximum | |
| Total |