Uyarı kuralıyla ilişkili olayların listesini alır
GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents?api-version=2016-03-01
URI Parametreleri
Name |
İçinde |
Gerekli |
Tür |
Description |
resourceGroupName
|
path |
True
|
string
|
Kaynak grubunun adı. Ad büyük/küçük harfe duyarlı değildir.
|
ruleName
|
path |
True
|
string
|
Kuralın adı.
|
subscriptionId
|
path |
True
|
string
|
Hedef aboneliğin kimliği.
|
api-version
|
query |
True
|
string
|
Bu işlem için kullanılacak API sürümü.
|
Yanıtlar
Name |
Tür |
Description |
200 OK
|
IncidentListResult
|
Uyarı kuralıyla ilgili olayların listesi için başarılı istek
|
Güvenlik
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
kullanıcı hesabınızın kimliğine bürünme
|
Örnekler
List alert rule incidents
Sample Request
GET https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourcegroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName/incidents?api-version=2016-03-01
/**
* Samples for AlertRuleIncidents ListByAlertRule.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json
*/
/**
* Sample code: List alert rule incidents.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void listAlertRuleIncidents(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getAlertRuleIncidents().listByAlertRule("Rac46PostSwapRG",
"myRuleName", 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/2016-03-01/examples/listAlertRuleIncidents.json
func ExampleAlertRuleIncidentsClient_NewListByAlertRulePager() {
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)
}
pager := clientFactory.NewAlertRuleIncidentsClient().NewListByAlertRulePager("Rac46PostSwapRG", "myRuleName", nil)
for pager.More() {
page, err := pager.NextPage(ctx)
if err != nil {
log.Fatalf("failed to advance page: %v", err)
}
for _, v := range page.Value {
// You could use page here. We use blank identifier for just demo purposes.
_ = v
}
// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// page.IncidentListResult = armmonitor.IncidentListResult{
// Value: []*armmonitor.Incident{
// {
// Name: to.Ptr("Website_started"),
// ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()),
// IsActive: to.Ptr(true),
// ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()),
// RuleName: to.Ptr("myRuleName"),
// }},
// }
}
}
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 Gets a list of incidents associated to an alert rule
*
* @summary Gets a list of incidents associated to an alert rule
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json
*/
async function listAlertRuleIncidents() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "b67f7fec-69fc-4974-9099-a26bd6ffeda3";
const resourceGroupName = process.env["MONITOR_RESOURCE_GROUP"] || "Rac46PostSwapRG";
const ruleName = "myRuleName";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const resArray = new Array();
for await (let item of client.alertRuleIncidents.listByAlertRule(resourceGroupName, ruleName)) {
resArray.push(item);
}
console.log(resArray);
}
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/2016-03-01/examples/listAlertRuleIncidents.json
// this example is just showing the usage of "AlertRuleIncidents_ListByAlertRule" 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 AlertRuleResource created on azure
// for more information of creating AlertRuleResource, please refer to the document of AlertRuleResource
string subscriptionId = "b67f7fec-69fc-4974-9099-a26bd6ffeda3";
string resourceGroupName = "Rac46PostSwapRG";
string ruleName = "myRuleName";
ResourceIdentifier alertRuleResourceId = AlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, ruleName);
AlertRuleResource alertRule = client.GetAlertRuleResource(alertRuleResourceId);
// invoke the operation and iterate over the result
await foreach (MonitorIncident item in alertRule.GetAlertRuleIncidentsAsync())
{
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": [
{
"name": "Website_started",
"ruleName": "myRuleName",
"isActive": true,
"activatedTime": "2017-09-13T15:45:26.9792776Z",
"resolvedTime": "2017-09-13T22:14:28.9792776Z"
}
]
}
Tanımlar
Name |
Description |
Incident
|
Uyarı olayı, uyarı kuralının etkinleştirme durumunu gösterir.
|
IncidentListResult
|
Olayları listeleme işlemi yanıtı.
|
Incident
Uyarı olayı, uyarı kuralının etkinleştirme durumunu gösterir.
Name |
Tür |
Description |
activatedTime
|
string
|
Olayın ISO8601 biçimde etkinleştirildiği saat.
|
isActive
|
boolean
|
Olayın etkin olup olmadığını veya çözümlenip çözümlenmediğini belirten boole değeri.
|
name
|
string
|
Olay adı.
|
resolvedTime
|
string
|
Olayın ISO8601 biçimde çözümlenme zamanı. Null olması, olayın hala etkin olduğu anlamına gelir.
|
ruleName
|
string
|
Olayla ilişkili kural adı.
|
IncidentListResult
Olayları listeleme işlemi yanıtı.
Name |
Tür |
Description |
value
|
Incident[]
|
olay koleksiyonu.
|