檢索警報規則定義。
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}?api-version=2024-03-01-preview
URI 參數
| 名稱 |
位於 |
必要 |
類型 |
Description |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
資源群組的名稱。 名稱不區分大小寫。
|
|
ruleName
|
path |
True
|
string
|
規則的名稱。
|
|
subscriptionId
|
path |
True
|
string
minLength: 1
|
目標訂用帳戶的標識碼。
|
|
api-version
|
query |
True
|
string
minLength: 1
|
用於此作業的 API 版本。
|
回應
安全性
azure_auth
Azure Active Directory OAuth2 流
類型:
oauth2
Flow:
implicit
授權 URL:
https://login.microsoftonline.com/common/oauth2/authorize
範圍
| 名稱 |
Description |
|
user_impersonation
|
模擬您的用戶帳戶
|
範例
Get a dynamic alert rule for multiple resources
範例要求
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertOnMultipleResources?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_dynamic_metric_alert_multiple_resource.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.metric_alerts.get(
resource_group_name="gigtest",
rule_name="MetricAlertOnMultipleResources",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getDynamicMetricAlertMultipleResource.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getDynamicMetricAlertMultipleResource.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "gigtest";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "MetricAlertOnMultipleResources";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"targetResourceRegion": "southcentralus",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
"allOf": [
{
"criterionType": "DynamicThresholdCriterion",
"name": "High_CPU_80",
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"operator": "GreaterOrLessThan",
"timeAggregation": "Average",
"dimensions": [],
"alertSensitivity": "Medium",
"failingPeriods": {
"numberOfEvaluationPeriods": 4,
"minFailingPeriodsToAlert": 4
}
}
]
},
"autoMitigate": false,
"actions": [
{
"actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
Get a dynamic alert rule for single resource
範例要求
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_dynamic_metric_alert_single_resource.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.metric_alerts.get(
resource_group_name="gigtest",
rule_name="chiricutin",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getDynamicMetricAlertSingleResource.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getDynamicMetricAlertSingleResource.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "00000000-0000-0000-0000-000000000000";
string resourceGroupName = "gigtest";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "chiricutin";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
"allOf": [
{
"criterionType": "DynamicThresholdCriterion",
"name": "High_CPU_80",
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"operator": "GreaterOrLessThan",
"timeAggregation": "Average",
"dimensions": [],
"alertSensitivity": "Medium",
"failingPeriods": {
"numberOfEvaluationPeriods": 4,
"minFailingPeriodsToAlert": 4
},
"ignoreDataBefore": null
}
]
},
"autoMitigate": false,
"actions": [
{
"actionGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
Get a query based alert rule
範例要求
GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_alert_query.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7",
)
response = client.metric_alerts.get(
resource_group_name="gigtest",
rule_name="chiricutin",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertQuery.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertQuery.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
string resourceGroupName = "gigtest";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "chiricutin";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
"type": "Microsoft.Insights/metricAlerts",
"location": "eastus",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"identity": {
"type": "UserAssigned",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"userAssignedIdentities": {
"/subscriptions/2f1a501a-6e1d-4f37-a445-462d7f8a563d/resourceGroups/AdisTest/providers/Microsoft.ManagedIdentity/userAssignedIdentities/msi-test-euap": {
"clientId": "778f4d04-3c60-4622-a839-5cf05866c983",
"principalId": "669dd76d-cde8-4dc3-b882-1de566b0c628"
}
}
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/microsoft.monitor/accounts/gigwadme"
],
"evaluationFrequency": "PT1M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.PromQLCriteria",
"allOf": [
{
"name": "Metric1",
"criterionType": "StaticThresholdCriterion",
"query": "floor(minute(vector(time())) / 10 ) % 2 == 1"
}
]
},
"resolveConfiguration": {
"autoResolved": true,
"timeToResolve": "PT10M"
},
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
Get a web test alert rule
範例要求
GET https://management.azure.com/subscriptions/12345678-1234-1234-1234-123456789101/resourceGroups/rg-example/providers/Microsoft.Insights/metricAlerts/webtest-name-example?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_web_test_metric_alert.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="12345678-1234-1234-1234-123456789101",
)
response = client.metric_alerts.get(
resource_group_name="rg-example",
rule_name="webtest-name-example",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getWebTestMetricAlert.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getWebTestMetricAlert.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "12345678-1234-1234-1234-123456789101";
string resourceGroupName = "rg-example";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "webtest-name-example";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"location": "global",
"type": "Microsoft.Insights/metricAlerts",
"name": "webtest-name-example",
"id": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example",
"tags": {
"hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": "Resource",
"hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": "Resource"
},
"properties": {
"description": "Automatically created alert rule for availability test \"webtest-name-example\"",
"severity": 4,
"enabled": true,
"scopes": [
"/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example",
"/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"criteria": {
"webTestId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example",
"componentId": "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example",
"failedLocationCount": 2,
"odata.type": "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"
},
"actions": []
}
}
Get an alert rule for multiple resources
範例要求
GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertOnMultipleResources?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_alert_multiple_resource.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7",
)
response = client.metric_alerts.get(
resource_group_name="gigtest",
rule_name="MetricAlertOnMultipleResources",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertMultipleResource.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertMultipleResource.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
string resourceGroupName = "gigtest";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "MetricAlertOnMultipleResources";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1",
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"targetResourceRegion": "southcentralus",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
"allOf": [
{
"criterionType": "StaticThresholdCriterion",
"name": "High_CPU_80",
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"dimensions": [],
"operator": "GreaterThan",
"threshold": 80.5,
"timeAggregation": "Average"
}
]
},
"autoMitigate": false,
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
Get an alert rule for single resource
範例要求
GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_alert_single_resource.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7",
)
response = client.metric_alerts.get(
resource_group_name="gigtest",
rule_name="chiricutin",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertSingleResource.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertSingleResource.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
string resourceGroupName = "gigtest";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "chiricutin";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
"allOf": [
{
"criterionType": "StaticThresholdCriterion",
"name": "High_CPU_80",
"metricName": "\\Processor(_Total)\\% Processor Time",
"dimensions": [],
"operator": "GreaterThan",
"threshold": 80.5,
"timeAggregation": "Average"
}
]
},
"autoMitigate": false,
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
Get an alert rule on resource group(s)
範例要求
GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/Microsoft.Insights/metricAlerts/MetricAlertAtResourceGroupLevel?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_alert_resource_group.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7",
)
response = client.metric_alerts.get(
resource_group_name="gigtest1",
rule_name="MetricAlertAtResourceGroupLevel",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertResourceGroup.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertResourceGroup.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
string resourceGroupName = "gigtest1";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "MetricAlertAtResourceGroupLevel";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1",
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"targetResourceRegion": "southcentralus",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
"allOf": [
{
"criterionType": "StaticThresholdCriterion",
"name": "High_CPU_80",
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"dimensions": [],
"operator": "GreaterThan",
"threshold": 80.5,
"timeAggregation": "Average"
}
]
},
"autoMitigate": false,
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
Get an alert rule on subscription
範例要求
GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/MetricAlertAtSubscriptionLevel?api-version=2024-03-01-preview
from azure.identity import DefaultAzureCredential
from azure.mgmt.monitor import MonitorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-monitor
# USAGE
python get_metric_alert_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = MonitorManagementClient(
credential=DefaultAzureCredential(),
subscription_id="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7",
)
response = client.metric_alerts.get(
resource_group_name="gigtest",
rule_name="MetricAlertAtSubscriptionLevel",
)
print(response)
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertSubscription.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/preview/2024-03-01-preview/examples/getMetricAlertSubscription.json
// this example is just showing the usage of "MetricAlerts_Get" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
string resourceGroupName = "gigtest";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this MetricAlertResource
MetricAlertCollection collection = resourceGroupResource.GetMetricAlerts();
// invoke the operation
string ruleName = "MetricAlertAtSubscriptionLevel";
NullableResponse<MetricAlertResource> response = await collection.GetIfExistsAsync(ruleName);
MetricAlertResource result = response.HasValue ? response.Value : null;
if (result == null)
{
Console.WriteLine("Succeeded with null as result");
}
else
{
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
MetricAlertData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
範例回覆
{
"id": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel",
"type": "Microsoft.Insights/metricAlerts",
"location": "global",
"tags": {
"hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": "Resource"
},
"properties": {
"description": "This is the description of the rule1",
"severity": 3,
"enabled": true,
"scopes": [
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"
],
"evaluationFrequency": "PT1M",
"windowSize": "PT15M",
"targetResourceType": "Microsoft.Compute/virtualMachines",
"targetResourceRegion": "southcentralus",
"criteria": {
"odata.type": "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
"allOf": [
{
"criterionType": "StaticThresholdCriterion",
"name": "High_CPU_80",
"metricName": "Percentage CPU",
"metricNamespace": "microsoft.compute/virtualmachines",
"dimensions": [],
"operator": "GreaterThan",
"threshold": 80.5,
"timeAggregation": "Average"
}
]
},
"autoMitigate": false,
"actions": [
{
"actionGroupId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
"webHookProperties": {
"key11": "value11",
"key12": "value12"
}
}
]
}
}
定義
AdditionalInfo
Object
一組具有「類型」和「資訊」屬性的物件陣列。 「info」的結構是服務特定的,並依賴於「類型」字串。
| 名稱 |
類型 |
Description |
|
info
|
|
針對特定類型的額外資訊。
|
|
type
|
string
|
附加資訊的類型。
|
AggregationTypeEnum
列舉型別
準則時間彙總類型。 先前未記載的值可能會傳回
| 值 |
Description |
|
Average
|
|
|
Count
|
|
|
Minimum
|
|
|
Maximum
|
|
|
Total
|
|
DynamicMetricCriteria
Object
動態閾值標準。
| 名稱 |
類型 |
Description |
|
alertSensitivity
|
DynamicThresholdSensitivity
|
觸發警示所需的偏差範圍。 這會影響臨界值與計量數列模式的緊密程度。 先前未記載的值可能會傳回
|
|
criterionType
|
string:
DynamicThresholdCriterion
|
指定臨界值準則的類型。 先前未記載的值可能會傳回
|
|
dimensions
|
MetricDimension[]
|
維度條件的清單。
|
|
failingPeriods
|
DynamicThresholdFailingPeriods
|
引發警示所需的所選回溯時間範圍內所需的違規數目下限。
|
|
ignoreDataBefore
|
string
(date-time)
|
使用此選項可設定開始學習計量歷程記錄資料的日期,並計算動態閾值(以ISO8601格式)
|
|
metricName
|
string
|
計量的名稱。
|
|
metricNamespace
|
string
|
計量Namespace。
|
|
name
|
string
|
準則的名稱。
|
|
operator
|
DynamicThresholdOperator
|
運算子,用來比較計量值與臨界值。 先前未記載的值可能會傳回
|
|
skipMetricValidation
|
boolean
|
允許在尚未發出的自定義計量上建立警示規則,方法是略過計量驗證。
|
|
timeAggregation
|
AggregationTypeEnum
|
準則時間彙總類型。 先前未記載的值可能會傳回
|
DynamicPromQLCriteria
Object
動態舞會查詢的標準。
| 名稱 |
類型 |
Description |
|
alertSensitivity
|
DynamicThresholdSensitivity
|
觸發警示所需的偏差範圍。 這會影響臨界值與計量數列模式的緊密程度。 先前未記載的值可能會傳回
|
|
criterionType
|
string:
DynamicThresholdCriterion
|
指定臨界值準則的類型。 先前未記載的值可能會傳回
|
|
ignoreDataBefore
|
string
(date-time)
|
使用此選項可設定開始學習計量歷程記錄資料的日期,並計算動態閾值(以ISO8601格式)
|
|
name
|
string
|
準則的名稱。
|
|
operator
|
DynamicThresholdOperator
|
運算子,用來比較計量值與臨界值。 先前未記載的值可能會傳回
|
|
query
|
string
|
用來評估警示規則的查詢
|
DynamicThresholdFailingPeriods
Object
引發警示所需的所選回溯時間範圍內所需的違規數目下限。
| 名稱 |
類型 |
Description |
|
minFailingPeriodsToAlert
|
number
|
觸發警示的違規次數。 應小於或等於 numberOfEvaluationPeriods。
|
|
numberOfEvaluationPeriods
|
number
|
匯總回溯點的數目。 回溯時間範圍是根據匯總數據粒度 (windowSize) 和選取的匯總點數目來計算。
|
DynamicThresholdOperator
列舉型別
運算子,用來比較計量值與臨界值。 先前未記載的值可能會傳回
| 值 |
Description |
|
GreaterThan
|
|
|
LessThan
|
|
|
GreaterOrLessThan
|
|
DynamicThresholdSensitivity
列舉型別
觸發警示所需的偏差範圍。 這會影響臨界值與計量數列模式的緊密程度。 先前未記載的值可能會傳回
| 值 |
Description |
|
Low
|
|
|
Medium
|
|
|
High
|
|
Error
Object
| 名稱 |
類型 |
Description |
|
additionalInfo
|
AdditionalInfo[]
|
一組具有「類型」和「資訊」屬性的物件陣列。 「info」的結構是服務特定的,並依賴於「類型」字串。
|
|
code
|
string
|
未局域字串,可用於程式化識別錯誤。
|
|
details
|
ErrorDetail[]
|
其他巢狀錯誤回應資訊對象的陣列,如此合約所述。
|
|
message
|
string
|
詳細描述錯誤並提供除錯資訊。 如果請求中設定了 Accept-Language,必須在地化到該語言。
|
|
target
|
string
|
特定錯誤的目標 (例如,發生錯誤的屬性名稱)。
|
ErrorDetail
Object
描述錯誤回應的細節。
| 名稱 |
類型 |
Description |
|
additionalInfo
|
AdditionalInfo[]
|
一組具有「類型」和「資訊」屬性的物件陣列。 「info」的結構是服務特定的,並依賴於「類型」字串。
|
|
code
|
string
|
未局域字串,可用於程式化識別錯誤。
|
|
message
|
string
|
詳細描述錯誤並提供除錯資訊。
|
|
target
|
string
|
特定錯誤的目標 (例如,發生錯誤的屬性名稱)。
|
ErrorResponse
Object
描述錯誤回應的格式。
| 名稱 |
類型 |
Description |
|
error
|
Error
|
|
Identity
Object
資源的身分識別。
| 名稱 |
類型 |
Description |
|
principalId
|
string
|
資源識別的主要標識碼。
|
|
tenantId
|
string
|
資源的租用戶標識碼。
|
|
type
|
IdentityType
|
受控服務識別的類型。 先前未記載的值可能會傳回
|
|
userAssignedIdentities
|
<string,
UserIdentityProperties>
|
與資源相關聯的使用者身分識別清單。 使用者身分識別字典索引鍵參考會是 Azure 資源識別碼,格式為:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'。
|
IdentityType
列舉型別
受控服務識別的類型。 先前未記載的值可能會傳回
| 值 |
Description |
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
None
|
|
MetricAlertAction
Object
警示動作。
| 名稱 |
類型 |
Description |
|
actionGroupId
|
string
|
要使用的動作群組識別碼。
|
|
webHookProperties
|
object
|
此欄位允許指定自定義屬性,這會附加至傳送為 Webhook 輸入的警示承載。
|
MetricAlertMultipleResourceMultipleMetricCriteria
Object
指定多個資源的指標警示標準,且該資源具有多個指標條件。
| 名稱 |
類型 |
Description |
|
allOf
|
MultiMetricCriteria[]:
|
此「全部」作業的多個度量準則清單。
|
|
odata.type
|
string:
Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria
|
指定警示準則的類型。 先前未記載的值可能會傳回
|
MetricAlertResource
Object
指標警示資源。
| 名稱 |
類型 |
Description |
|
id
|
string
|
Azure 資源標識碼
|
|
identity
|
Identity
|
資源的身分識別。
|
|
location
|
string
|
資源位置
|
|
name
|
string
|
Azure 資源名稱
|
|
properties.actionProperties
|
object
|
動作屬性的屬性。
|
|
properties.actions
|
MetricAlertAction[]
|
警示規則變成作用中,以及解決警示條件時所執行的動作陣列。
|
|
properties.autoMitigate
|
boolean
|
指出是否應自動解決警示的旗標。 默認值為 true。
|
|
properties.criteria
|
MetricAlertCriteria:
|
定義特定的警示準則資訊。
|
|
properties.customProperties
|
object
|
警示承載的屬性。
|
|
properties.description
|
string
|
將包含在警示電子郵件中的計量警示描述。
|
|
properties.enabled
|
boolean
|
指出是否已啟用度量警示的旗標。
|
|
properties.evaluationFrequency
|
string
(duration)
|
評估度量警示的頻率,以 ISO 8601 持續時間格式表示。
|
|
properties.isMigrated
|
boolean
|
該值指示該警報規則是否已被遷移。
|
|
properties.lastUpdatedTime
|
string
(date-time)
|
上次規則更新為ISO8601格式。
|
|
properties.resolveConfiguration
|
ResolveConfiguration
|
如何解決警示的設定。 適用於PromQLCriteria。
|
|
properties.scopes
|
string[]
|
此計量警示的範圍為的資源識別碼清單。 您無法根據記錄來變更計量規則的範圍。
|
|
properties.severity
|
integer
(int32)
|
警示嚴重性 {0, 1, 2, 3, 4}
|
|
properties.targetResourceRegion
|
string
|
建立/更新警示的目標資源區域。 如果範圍包含訂用帳戶、資源群組或多個資源,則為必要專案。
|
|
properties.targetResourceType
|
string
|
建立/更新警示的目標資源的資源類型。 如果範圍包含訂用帳戶、資源群組或多個資源,則為必要專案。
|
|
properties.windowSize
|
string
(duration)
|
用來根據臨界值監視警示活動的時間段 (ISO 8601 持續時間格式)。
|
|
tags
|
object
|
資源標籤
|
|
type
|
string
|
Azure 資源類型
|
MetricAlertSingleResourceMultipleMetricCriteria
Object
指定單一資源的指標警示標準,該資源具有多個指標條件。
| 名稱 |
類型 |
Description |
|
allOf
|
MetricCriteria[]
|
此「所有」作業的計量準則清單。
|
|
odata.type
|
string:
Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria
|
指定警示準則的類型。 先前未記載的值可能會傳回
|
MetricCriteria
Object
篩選指標的標準。
| 名稱 |
類型 |
Description |
|
criterionType
|
string:
StaticThresholdCriterion
|
指定臨界值準則的類型。 先前未記載的值可能會傳回
|
|
dimensions
|
MetricDimension[]
|
維度條件的清單。
|
|
metricName
|
string
|
計量的名稱。
|
|
metricNamespace
|
string
|
計量Namespace。
|
|
name
|
string
|
準則的名稱。
|
|
operator
|
Operator
|
criteria 運算子。 先前未記載的值可能會傳回
|
|
skipMetricValidation
|
boolean
|
允許在尚未發出的自定義計量上建立警示規則,方法是略過計量驗證。
|
|
threshold
|
number
(double)
|
啟動警示的準則臨界值。
|
|
timeAggregation
|
AggregationTypeEnum
|
準則時間彙總類型。 先前未記載的值可能會傳回
|
MetricDimension
Object
指定一個公制維度。
| 名稱 |
類型 |
Description |
|
name
|
string
|
維度的名稱。
|
|
operator
|
string
|
維度運算子。 僅支援 'Include' 和 'Exclude'
|
|
values
|
string[]
|
維度值清單。
|
Operator
列舉型別
criteria 運算子。 先前未記載的值可能會傳回
| 值 |
Description |
|
Equals
|
|
|
GreaterThan
|
|
|
GreaterThanOrEqual
|
|
|
LessThan
|
|
|
LessThanOrEqual
|
|
PromQLCriteria
Object
指定 PromQL 對度量警示資源的標準。
| 名稱 |
類型 |
Description |
|
allOf
|
MultiPromQLCriteria[]:
|
promQL 標準清單。 當滿足所有條件時,將發出警報。
|
|
failingPeriods
|
QueryFailingPeriods
|
查詢型警示中失敗期間的設定。
|
|
odata.type
|
string:
Microsoft.Azure.Monitor.PromQLCriteria
|
指定警示準則的類型。 先前未記載的值可能會傳回
|
QueryFailingPeriods
Object
查詢型警示中失敗期間的設定。
| 名稱 |
類型 |
Description |
|
for
|
string
(duration)
|
觸發前必須啟用的時間量(以 ISO 8601 持續時間格式)警示。
|
ResolveConfiguration
Object
| 名稱 |
類型 |
Description |
|
autoResolved
|
boolean
|
指出是否應自動解決警示
|
|
timeToResolve
|
string
(duration)
|
應自動解決警示的時間 (以 ISO 8601 持續時間格式)
|
StaticPromQLCriteria
Object
靜態舞會查詢的標準。
| 名稱 |
類型 |
Description |
|
criterionType
|
string:
StaticThresholdCriterion
|
指定臨界值準則的類型。 先前未記載的值可能會傳回
|
|
name
|
string
|
準則的名稱。
|
|
query
|
string
|
用來評估警示規則的查詢
|
UserIdentityProperties
Object
使用者指派身份的屬性。
| 名稱 |
類型 |
Description |
|
clientId
|
string
|
資源識別碼的客戶端ID。
|
|
principalId
|
string
|
資源識別的主要標識碼。
|
WebtestLocationAvailabilityCriteria
Object
指定網路測試資源的指標警示規則標準。
| 名稱 |
類型 |
Description |
|
componentId
|
string
|
Application Insights 資源標識符。
|
|
failedLocationCount
|
number
|
失敗的位置數目。
|
|
odata.type
|
string:
Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria
|
指定警示準則的類型。 先前未記載的值可能會傳回
|
|
webTestId
|
string
|
Application Insights Web 測試標識符。
|