Hiermee haalt u een incident op dat is gekoppeld aan een waarschuwingsregel
GET https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}?api-version=2016-03-01
URI-parameters
Name |
In |
Vereist |
Type |
Description |
incidentName
|
path |
True
|
string
|
De naam van het incident dat moet worden opgehaald.
|
resourceGroupName
|
path |
True
|
string
|
De naam van de resourcegroep. De naam is niet hoofdlettergevoelig.
|
ruleName
|
path |
True
|
string
|
De naam van de regel.
|
subscriptionId
|
path |
True
|
string
|
De id van het doelabonnement.
|
api-version
|
query |
True
|
string
|
De API-versie die voor deze bewerking moet worden gebruikt.
|
Antwoorden
Name |
Type |
Description |
200 OK
|
Incident
|
Geslaagde aanvraag voor één incident met betrekking tot een waarschuwingsregel
|
Other Status Codes
|
ErrorResponse
|
Foutreactie waarin wordt beschreven waarom de bewerking is mislukt.
|
Beveiliging
azure_auth
Azure Active Directory OAuth2-stroom
Type:
oauth2
Stroom:
implicit
Autorisatie-URL:
https://login.microsoftonline.com/common/oauth2/authorize
Bereiken
Name |
Description |
user_impersonation
|
Uw gebruikersaccount imiteren
|
Voorbeelden
Get a single alert rule incident
Voorbeeldaanvraag
GET https://management.azure.com/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourcegroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName/incidents/Website_started?api-version=2016-03-01
/**
* Samples for AlertRuleIncidents Get.
*/
public final class Main {
/*
* x-ms-original-file:
* specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json
*/
/**
* Sample code: Get a single alert rule incident.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getASingleAlertRuleIncident(com.azure.resourcemanager.AzureResourceManager azure) {
azure.diagnosticSettings().manager().serviceClient().getAlertRuleIncidents().getWithResponse("Rac46PostSwapRG",
"myRuleName", "Website_started", 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/getAlertRuleIncident.json
func ExampleAlertRuleIncidentsClient_Get() {
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.NewAlertRuleIncidentsClient().Get(ctx, "Rac46PostSwapRG", "myRuleName", "Website_started", 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.Incident = 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 an incident associated to an alert rule
*
* @summary Gets an incident associated to an alert rule
* x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json
*/
async function getASingleAlertRuleIncident() {
const subscriptionId =
process.env["MONITOR_SUBSCRIPTION_ID"] || "b67f7fec-69fc-4974-9099-a26bd6ffeda3";
const resourceGroupName = process.env["MONITOR_RESOURCE_GROUP"] || "Rac46PostSwapRG";
const ruleName = "myRuleName";
const incidentName = "Website_started";
const credential = new DefaultAzureCredential();
const client = new MonitorClient(credential, subscriptionId);
const result = await client.alertRuleIncidents.get(resourceGroupName, ruleName, incidentName);
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 Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using System.Xml;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Monitor.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Monitor;
// Generated from example definition: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json
// this example is just showing the usage of "AlertRuleIncidents_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 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
string incidentName = "Website_started";
MonitorIncident result = await alertRule.GetAlertRuleIncidentAsync(incidentName);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Voorbeeldrespons
{
"name": "Website_started",
"ruleName": "myRuleName",
"isActive": true,
"activatedTime": "2017-09-13T15:45:26.9792776Z",
"resolvedTime": "2017-09-13T22:14:28.9792776Z"
}
Definities
Name |
Description |
ErrorResponse
|
Beschrijft de indeling van foutreactie.
|
Incident
|
Een waarschuwingsincident geeft de activeringsstatus van een waarschuwingsregel aan.
|
ErrorResponse
Beschrijft de indeling van foutreactie.
Name |
Type |
Description |
code
|
string
|
Foutcode
|
message
|
string
|
Foutbericht dat aangeeft waarom de bewerking is mislukt.
|
Incident
Een waarschuwingsincident geeft de activeringsstatus van een waarschuwingsregel aan.
Name |
Type |
Description |
activatedTime
|
string
|
Het tijdstip waarop het incident is geactiveerd in ISO8601 indeling.
|
isActive
|
boolean
|
Een Booleaanse waarde die aangeeft of het incident actief of opgelost is.
|
name
|
string
|
Naam van incident.
|
resolvedTime
|
string
|
Het tijdstip waarop het incident is opgelost in ISO8601 indeling. Als het null is, betekent dit dat het incident nog steeds actief is.
|
ruleName
|
string
|
Regelnaam die is gekoppeld aan het incident.
|