Получение состояния правила генерации оповещений.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status?api-version=2018-03-01
Параметры URI
Имя |
В |
Обязательно |
Тип |
Описание |
resourceGroupName
|
path |
True
|
string
|
Имя группы ресурсов. Регистр букв в имени не учитывается.
|
ruleName
|
path |
True
|
string
|
Имя правила.
|
subscriptionId
|
path |
True
|
string
|
Идентификатор целевой подписки.
|
api-version
|
query |
True
|
string
|
Версия API, используемая для данной операции.
|
Ответы
Безопасность
azure_auth
Поток OAuth2 в Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Имя |
Описание |
user_impersonation
|
олицетворения учетной записи пользователя
|
Примеры
Get an alert rule status
Sample Request
GET https://management.azure.com/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Insights/metricAlerts/chiricutin/status?api-version=2018-03-01
/**
* Samples for MetricAlertsStatus List.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json
*/
/**
* Sample code: Get an alert rule status.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getAnAlertRuleStatus(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getMetricAlertsStatus().listWithResponse("gigtest",
"chiricutin", com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armmonitor_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json
func ExampleMetricAlertsStatusClient_List() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmonitor.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewMetricAlertsStatusClient().List(ctx, "gigtest", "chiricutin", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{
// Value: []*armmonitor.MetricAlertStatus{
// {
// Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"),
// Type: to.Ptr("Microsoft.Insights/metricAlerts/status"),
// ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1"),
// Properties: &armmonitor.MetricAlertStatusProperties{
// Dimensions: map[string]*string{
// "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"),
// },
// Status: to.Ptr("Healthy"),
// Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()),
// },
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { MonitorClient } = require("@azure/arm-monitor");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Retrieve an alert rule status.
*
* @summary Retrieve an alert rule status.
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json
*/
async function getAnAlertRuleStatus() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
const resourceGroupName = process.env["MONITOR_RESOURCE_GROUP"] || "gigtest";
const ruleName = "chiricutin";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const result = await client.metricAlertsStatus.list(resourceGroupName, ruleName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Monitor;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json
// this example is just showing the usage of "MetricAlertsStatus_List" 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 MetricAlertResource created on azure
// for more information of creating MetricAlertResource, please refer to the document of MetricAlertResource
string subscriptionId = "14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7";
string resourceGroupName = "gigtest";
string ruleName = "chiricutin";
ResourceIdentifier metricAlertResourceId = MetricAlertResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, ruleName);
MetricAlertResource metricAlert = client.GetMetricAlertResource(metricAlertResourceId);
// invoke the operation and iterate over the result
await foreach (MetricAlertStatus item in metricAlert.GetAllMetricAlertsStatusAsync())
{
Console.WriteLine($"Succeeded: {item}");
}
Console.WriteLine($"Succeeded");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"value": [
{
"id": "/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1",
"name": "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l",
"type": "Microsoft.Insights/metricAlerts/status",
"properties": {
"dimensions": {
"resourceId": "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"
},
"status": "Healthy",
"timestamp": "2018-01-17T20:17:25.6293237Z"
}
}
]
}
Определения
ErrorResponse
Описывает формат ответа об ошибке.
Имя |
Тип |
Описание |
code
|
string
|
Код ошибки
|
message
|
string
|
Сообщение об ошибке, указывающее, почему операция завершилась сбоем.
|
MetricAlertStatus
Состояние оповещения.
Имя |
Тип |
Описание |
id
|
string
|
Идентификатор arm правила генерации оповещений.
|
name
|
string
|
Имя состояния.
|
properties
|
MetricAlertStatusProperties
|
Свойства состояния оповещения для состояния оповещения метрики.
|
type
|
string
|
Имя расширенного типа ресурса.
|
MetricAlertStatusCollection
Представляет коллекцию ресурсов правил генерации оповещений.
Имя |
Тип |
Описание |
value
|
MetricAlertStatus[]
|
значения для ресурсов правила генерации оповещений.
|
MetricAlertStatusProperties
Свойства состояния оповещения.
Имя |
Тип |
Описание |
dimensions
|
object
|
Объект, описывающий тип измерений.
|
status
|
string
|
значение состояния
|
timestamp
|
string
|
Время проверки состояния в формате UTC.
|