Alert Rule
The alert rule resource. API Version: 2016-03-01.
Example Usage
Create or update an alert rule
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var alertRule = new AzureNative.Insights.AlertRule("alertRule", new()
{
Actions = new[] {},
Condition = new AzureNative.Insights.Inputs.ThresholdRuleConditionArgs
{
DataSource = new AzureNative.Insights.Inputs.RuleMetricDataSourceArgs
{
MetricName = "Requests",
OdataType = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
ResourceUri = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest",
},
OdataType = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
Operator = AzureNative.Insights.ConditionOperator.GreaterThan,
Threshold = 3,
TimeAggregation = AzureNative.Insights.TimeAggregationOperator.Total,
WindowSize = "PT5M",
},
Description = "Pura Vida",
IsEnabled = true,
Location = "West US",
Name = "chiricutin",
ResourceGroupName = "Rac46PostSwapRG",
RuleName = "chiricutin",
Tags = null,
});
});
Content copied to clipboard
package main
import (
insights "github.com/pulumi/pulumi-azure-native-sdk/insights"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := insights.NewAlertRule(ctx, "alertRule", &insights.AlertRuleArgs{
Actions: pulumi.AnyArray{},
Condition: insights.ThresholdRuleCondition{
DataSource: insights.RuleMetricDataSource{
MetricName: "Requests",
OdataType: "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource",
ResourceUri: "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest",
},
OdataType: "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition",
Operator: insights.ConditionOperatorGreaterThan,
Threshold: 3,
TimeAggregation: insights.TimeAggregationOperatorTotal,
WindowSize: "PT5M",
},
Description: pulumi.String("Pura Vida"),
IsEnabled: pulumi.Bool(true),
Location: pulumi.String("West US"),
Name: pulumi.String("chiricutin"),
ResourceGroupName: pulumi.String("Rac46PostSwapRG"),
RuleName: pulumi.String("chiricutin"),
Tags: nil,
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.AlertRule;
import com.pulumi.azurenative.insights.AlertRuleArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var alertRule = new AlertRule("alertRule", AlertRuleArgs.builder()
.actions()
.condition(Map.ofEntries(
Map.entry("dataSource", Map.ofEntries(
Map.entry("metricName", "Requests"),
Map.entry("odataType", "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"),
Map.entry("resourceUri", "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest")
)),
Map.entry("odataType", "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 3),
Map.entry("timeAggregation", "Total"),
Map.entry("windowSize", "PT5M")
))
.description("Pura Vida")
.isEnabled(true)
.location("West US")
.name("chiricutin")
.resourceGroupName("Rac46PostSwapRG")
.ruleName("chiricutin")
.tags()
.build());
}
}
Content copied to clipboard
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:insights:AlertRule chiricutin /subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin
Content copied to clipboard
Properties
Link copied to clipboard
action that is performed when the alert rule becomes active, and when an alert condition is resolved.
Link copied to clipboard
the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.
Link copied to clipboard
the description of the alert rule that will be included in the alert email.
Link copied to clipboard
Last time the rule was updated in ISO8601 format.
Link copied to clipboard
the provisioning state.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard