MetricAlertArgs

data class MetricAlertArgs(val actions: Output<List<MetricAlertActionArgs>>? = null, val autoMitigate: Output<Boolean>? = null, val criteria: Output<Any>? = null, val description: Output<String>? = null, val enabled: Output<Boolean>? = null, val evaluationFrequency: Output<String>? = null, val location: Output<String>? = null, val resourceGroupName: Output<String>? = null, val ruleName: Output<String>? = null, val scopes: Output<List<String>>? = null, val severity: Output<Int>? = null, val tags: Output<Map<String, String>>? = null, val targetResourceRegion: Output<String>? = null, val targetResourceType: Output<String>? = null, val windowSize: Output<String>? = null) : ConvertibleToJava<MetricAlertArgs>

The metric alert resource. API Version: 2018-03-01.

Example Usage

Create or update a dynamic alert rule for Multiple Resources

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertMultipleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.DynamicMetricCriteriaArgs
{
AlertSensitivity = "Medium",
CriterionType = "DynamicThresholdCriterion",
Dimensions = new[] {},
FailingPeriods = new AzureNative.Insights.Inputs.DynamicThresholdFailingPeriodsArgs
{
MinFailingPeriodsToAlert = 4,
NumberOfEvaluationPeriods = 4,
},
MetricName = "Percentage CPU",
MetricNamespace = "microsoft.compute/virtualmachines",
Name = "High_CPU_80",
Operator = "GreaterOrLessThan",
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "PT1M",
Location = "global",
ResourceGroupName = "gigtest",
RuleName = "MetricAlertOnMultipleResources",
Scopes = new[]
{
"/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",
},
Severity = 3,
Tags = null,
TargetResourceRegion = "southcentralus",
TargetResourceType = "Microsoft.Compute/virtualMachines",
WindowSize = "PT15M",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertMultipleResourceMultipleMetricCriteria{
AllOf: []interface{}{
insights.DynamicMetricCriteria{
AlertSensitivity: "Medium",
CriterionType: "DynamicThresholdCriterion",
Dimensions: []insights.MetricDimension{},
FailingPeriods: insights.DynamicThresholdFailingPeriods{
MinFailingPeriodsToAlert: 4,
NumberOfEvaluationPeriods: 4,
},
MetricName: "Percentage CPU",
MetricNamespace: "microsoft.compute/virtualmachines",
Name: "High_CPU_80",
Operator: "GreaterOrLessThan",
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1M"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest"),
RuleName: pulumi.String("MetricAlertOnMultipleResources"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"),
pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"),
},
Severity: pulumi.Int(3),
Tags: nil,
TargetResourceRegion: pulumi.String("southcentralus"),
TargetResourceType: pulumi.String("Microsoft.Compute/virtualMachines"),
WindowSize: pulumi.String("PT15M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("alertSensitivity", "Medium"),
Map.entry("criterionType", "DynamicThresholdCriterion"),
Map.entry("dimensions", ),
Map.entry("failingPeriods", Map.ofEntries(
Map.entry("minFailingPeriodsToAlert", 4),
Map.entry("numberOfEvaluationPeriods", 4)
)),
Map.entry("metricName", "Percentage CPU"),
Map.entry("metricNamespace", "microsoft.compute/virtualmachines"),
Map.entry("name", "High_CPU_80"),
Map.entry("operator", "GreaterOrLessThan"),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("PT1M")
.location("global")
.resourceGroupName("gigtest")
.ruleName("MetricAlertOnMultipleResources")
.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")
.severity(3)
.tags()
.targetResourceRegion("southcentralus")
.targetResourceType("Microsoft.Compute/virtualMachines")
.windowSize("PT15M")
.build());
}
}

Create or update a dynamic alert rule for Single Resource

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertMultipleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.DynamicMetricCriteriaArgs
{
AlertSensitivity = "Medium",
CriterionType = "DynamicThresholdCriterion",
Dimensions = new[] {},
FailingPeriods = new AzureNative.Insights.Inputs.DynamicThresholdFailingPeriodsArgs
{
MinFailingPeriodsToAlert = 4,
NumberOfEvaluationPeriods = 4,
},
IgnoreDataBefore = "2019-04-04T21:00:00.000Z",
MetricName = "Percentage CPU",
MetricNamespace = "microsoft.compute/virtualmachines",
Name = "High_CPU_80",
Operator = "GreaterOrLessThan",
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "PT1M",
Location = "global",
ResourceGroupName = "gigtest",
RuleName = "chiricutin",
Scopes = new[]
{
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme",
},
Severity = 3,
Tags = null,
WindowSize = "PT15M",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertMultipleResourceMultipleMetricCriteria{
AllOf: []interface{}{
insights.DynamicMetricCriteria{
AlertSensitivity: "Medium",
CriterionType: "DynamicThresholdCriterion",
Dimensions: []insights.MetricDimension{},
FailingPeriods: insights.DynamicThresholdFailingPeriods{
MinFailingPeriodsToAlert: 4,
NumberOfEvaluationPeriods: 4,
},
IgnoreDataBefore: "2019-04-04T21:00:00.000Z",
MetricName: "Percentage CPU",
MetricNamespace: "microsoft.compute/virtualmachines",
Name: "High_CPU_80",
Operator: "GreaterOrLessThan",
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1M"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest"),
RuleName: pulumi.String("chiricutin"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"),
},
Severity: pulumi.Int(3),
Tags: nil,
WindowSize: pulumi.String("PT15M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("alertSensitivity", "Medium"),
Map.entry("criterionType", "DynamicThresholdCriterion"),
Map.entry("dimensions", ),
Map.entry("failingPeriods", Map.ofEntries(
Map.entry("minFailingPeriodsToAlert", 4),
Map.entry("numberOfEvaluationPeriods", 4)
)),
Map.entry("ignoreDataBefore", "2019-04-04T21:00:00.000Z"),
Map.entry("metricName", "Percentage CPU"),
Map.entry("metricNamespace", "microsoft.compute/virtualmachines"),
Map.entry("name", "High_CPU_80"),
Map.entry("operator", "GreaterOrLessThan"),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("PT1M")
.location("global")
.resourceGroupName("gigtest")
.ruleName("chiricutin")
.scopes("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")
.severity(3)
.tags()
.windowSize("PT15M")
.build());
}
}

Create or update a web test alert rule

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[] {},
Criteria = new AzureNative.Insights.Inputs.WebtestLocationAvailabilityCriteriaArgs
{
ComponentId = "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example",
FailedLocationCount = 2,
OdataType = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
WebTestId = "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
},
Description = "Automatically created alert rule for availability test \"component-example\" a",
Enabled = true,
EvaluationFrequency = "PT1M",
Location = "global",
ResourceGroupName = "rg-example",
RuleName = "webtest-name-example",
Scopes = new[]
{
"/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
"/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example",
},
Severity = 4,
Tags =
{
{ "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example", "Resource" },
{ "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example", "Resource" },
},
WindowSize = "PT15M",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: insights.MetricAlertActionArray{},
Criteria: insights.WebtestLocationAvailabilityCriteria{
ComponentId: "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example",
FailedLocationCount: 2,
OdataType: "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria",
WebTestId: "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
},
Description: pulumi.String("Automatically created alert rule for availability test \"component-example\" a"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1M"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("rg-example"),
RuleName: pulumi.String("webtest-name-example"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"),
pulumi.String("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"),
},
Severity: pulumi.Int(4),
Tags: pulumi.StringMap{
"hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": pulumi.String("Resource"),
"hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": pulumi.String("Resource"),
},
WindowSize: pulumi.String("PT15M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions()
.criteria(Map.ofEntries(
Map.entry("componentId", "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"),
Map.entry("failedLocationCount", 2),
Map.entry("odataType", "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"),
Map.entry("webTestId", "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example")
))
.description("Automatically created alert rule for availability test \"component-example\" a")
.enabled(true)
.evaluationFrequency("PT1M")
.location("global")
.resourceGroupName("rg-example")
.ruleName("webtest-name-example")
.scopes(
"/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example",
"/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example")
.severity(4)
.tags(Map.ofEntries(
Map.entry("hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example", "Resource"),
Map.entry("hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example", "Resource")
))
.windowSize("PT15M")
.build());
}
}

Create or update an alert rule for Multiple Resource

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertMultipleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.MetricCriteriaArgs
{
CriterionType = "StaticThresholdCriterion",
Dimensions = new[] {},
MetricName = "Percentage CPU",
MetricNamespace = "microsoft.compute/virtualmachines",
Name = "High_CPU_80",
Operator = "GreaterThan",
Threshold = 80.5,
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "PT1M",
Location = "global",
ResourceGroupName = "gigtest",
RuleName = "MetricAlertOnMultipleResources",
Scopes = new[]
{
"/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",
},
Severity = 3,
Tags = null,
TargetResourceRegion = "southcentralus",
TargetResourceType = "Microsoft.Compute/virtualMachines",
WindowSize = "PT15M",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertMultipleResourceMultipleMetricCriteria{
AllOf: []interface{}{
insights.MetricCriteria{
CriterionType: "StaticThresholdCriterion",
Dimensions: []insights.MetricDimension{},
MetricName: "Percentage CPU",
MetricNamespace: "microsoft.compute/virtualmachines",
Name: "High_CPU_80",
Operator: "GreaterThan",
Threshold: 80.5,
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1M"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest"),
RuleName: pulumi.String("MetricAlertOnMultipleResources"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"),
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2"),
},
Severity: pulumi.Int(3),
Tags: nil,
TargetResourceRegion: pulumi.String("southcentralus"),
TargetResourceType: pulumi.String("Microsoft.Compute/virtualMachines"),
WindowSize: pulumi.String("PT15M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("criterionType", "StaticThresholdCriterion"),
Map.entry("dimensions", ),
Map.entry("metricName", "Percentage CPU"),
Map.entry("metricNamespace", "microsoft.compute/virtualmachines"),
Map.entry("name", "High_CPU_80"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 80.5),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("PT1M")
.location("global")
.resourceGroupName("gigtest")
.ruleName("MetricAlertOnMultipleResources")
.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")
.severity(3)
.tags()
.targetResourceRegion("southcentralus")
.targetResourceType("Microsoft.Compute/virtualMachines")
.windowSize("PT15M")
.build());
}
}

Create or update an alert rule for Single Resource

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertSingleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.MetricCriteriaArgs
{
CriterionType = "StaticThresholdCriterion",
Dimensions = new[] {},
MetricName = "\\Processor(_Total)\\% Processor Time",
Name = "High_CPU_80",
Operator = "GreaterThan",
Threshold = 80.5,
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "Pt1m",
Location = "global",
ResourceGroupName = "gigtest",
RuleName = "chiricutin",
Scopes = new[]
{
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme",
},
Severity = 3,
Tags = null,
WindowSize = "Pt15m",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertSingleResourceMultipleMetricCriteria{
AllOf: []insights.MetricCriteria{
{
CriterionType: "StaticThresholdCriterion",
Dimensions: []insights.MetricDimension{},
MetricName: "\\Processor(_Total)\\% Processor Time",
Name: "High_CPU_80",
Operator: "GreaterThan",
Threshold: 80.5,
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("Pt1m"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest"),
RuleName: pulumi.String("chiricutin"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"),
},
Severity: pulumi.Int(3),
Tags: nil,
WindowSize: pulumi.String("Pt15m"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("criterionType", "StaticThresholdCriterion"),
Map.entry("dimensions", ),
Map.entry("metricName", "\\Processor(_Total)\\% Processor Time"),
Map.entry("name", "High_CPU_80"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 80.5),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("Pt1m")
.location("global")
.resourceGroupName("gigtest")
.ruleName("chiricutin")
.scopes("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")
.severity(3)
.tags()
.windowSize("Pt15m")
.build());
}
}

Create or update an alert rule on Resource group(s)

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertMultipleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.MetricCriteriaArgs
{
CriterionType = "StaticThresholdCriterion",
Dimensions = new[] {},
MetricName = "Percentage CPU",
MetricNamespace = "microsoft.compute/virtualmachines",
Name = "High_CPU_80",
Operator = "GreaterThan",
Threshold = 80.5,
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "PT1M",
Location = "global",
ResourceGroupName = "gigtest1",
RuleName = "MetricAlertAtResourceGroupLevel",
Scopes = new[]
{
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1",
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2",
},
Severity = 3,
Tags = null,
TargetResourceRegion = "southcentralus",
TargetResourceType = "Microsoft.Compute/virtualMachines",
WindowSize = "PT15M",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertMultipleResourceMultipleMetricCriteria{
AllOf: []interface{}{
insights.MetricCriteria{
CriterionType: "StaticThresholdCriterion",
Dimensions: []insights.MetricDimension{},
MetricName: "Percentage CPU",
MetricNamespace: "microsoft.compute/virtualmachines",
Name: "High_CPU_80",
Operator: "GreaterThan",
Threshold: 80.5,
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1M"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest1"),
RuleName: pulumi.String("MetricAlertAtResourceGroupLevel"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"),
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2"),
},
Severity: pulumi.Int(3),
Tags: nil,
TargetResourceRegion: pulumi.String("southcentralus"),
TargetResourceType: pulumi.String("Microsoft.Compute/virtualMachines"),
WindowSize: pulumi.String("PT15M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("criterionType", "StaticThresholdCriterion"),
Map.entry("dimensions", ),
Map.entry("metricName", "Percentage CPU"),
Map.entry("metricNamespace", "microsoft.compute/virtualmachines"),
Map.entry("name", "High_CPU_80"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 80.5),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("PT1M")
.location("global")
.resourceGroupName("gigtest1")
.ruleName("MetricAlertAtResourceGroupLevel")
.scopes(
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1",
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")
.severity(3)
.tags()
.targetResourceRegion("southcentralus")
.targetResourceType("Microsoft.Compute/virtualMachines")
.windowSize("PT15M")
.build());
}
}

Create or update an alert rule on Subscription

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertMultipleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.MetricCriteriaArgs
{
CriterionType = "StaticThresholdCriterion",
Dimensions = new[] {},
MetricName = "Percentage CPU",
MetricNamespace = "microsoft.compute/virtualmachines",
Name = "High_CPU_80",
Operator = "GreaterThan",
Threshold = 80.5,
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "PT1M",
Location = "global",
ResourceGroupName = "gigtest",
RuleName = "MetricAlertAtSubscriptionLevel",
Scopes = new[]
{
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7",
},
Severity = 3,
Tags = null,
TargetResourceRegion = "southcentralus",
TargetResourceType = "Microsoft.Compute/virtualMachines",
WindowSize = "PT15M",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertMultipleResourceMultipleMetricCriteria{
AllOf: []interface{}{
insights.MetricCriteria{
CriterionType: "StaticThresholdCriterion",
Dimensions: []insights.MetricDimension{},
MetricName: "Percentage CPU",
MetricNamespace: "microsoft.compute/virtualmachines",
Name: "High_CPU_80",
Operator: "GreaterThan",
Threshold: 80.5,
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1M"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest"),
RuleName: pulumi.String("MetricAlertAtSubscriptionLevel"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7"),
},
Severity: pulumi.Int(3),
Tags: nil,
TargetResourceRegion: pulumi.String("southcentralus"),
TargetResourceType: pulumi.String("Microsoft.Compute/virtualMachines"),
WindowSize: pulumi.String("PT15M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("criterionType", "StaticThresholdCriterion"),
Map.entry("dimensions", ),
Map.entry("metricName", "Percentage CPU"),
Map.entry("metricNamespace", "microsoft.compute/virtualmachines"),
Map.entry("name", "High_CPU_80"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 80.5),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("PT1M")
.location("global")
.resourceGroupName("gigtest")
.ruleName("MetricAlertAtSubscriptionLevel")
.scopes("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")
.severity(3)
.tags()
.targetResourceRegion("southcentralus")
.targetResourceType("Microsoft.Compute/virtualMachines")
.windowSize("PT15M")
.build());
}
}

Create or update an alert rules with dimensions

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var metricAlert = new AzureNative.Insights.MetricAlert("metricAlert", new()
{
Actions = new[]
{
new AzureNative.Insights.Inputs.MetricAlertActionArgs
{
ActionGroupId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2",
WebHookProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
},
AutoMitigate = true,
Criteria = new AzureNative.Insights.Inputs.MetricAlertMultipleResourceMultipleMetricCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.MetricCriteriaArgs
{
CriterionType = "StaticThresholdCriterion",
Dimensions = new[]
{
new AzureNative.Insights.Inputs.MetricDimensionArgs
{
Name = "ActivityName",
Operator = "Include",
Values = new[]
{
"*",
},
},
new AzureNative.Insights.Inputs.MetricDimensionArgs
{
Name = "StatusCode",
Operator = "Include",
Values = new[]
{
"200",
},
},
},
MetricName = "Availability",
MetricNamespace = "Microsoft.KeyVault/vaults",
Name = "Metric1",
Operator = "GreaterThan",
Threshold = 55,
TimeAggregation = "Average",
},
},
OdataType = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description = "This is the description of the rule1",
Enabled = true,
EvaluationFrequency = "PT1H",
Location = "global",
ResourceGroupName = "gigtest",
RuleName = "MetricAlertOnMultipleDimensions",
Scopes = new[]
{
"/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource",
},
Severity = 3,
Tags = null,
WindowSize = "P1D",
});
});
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.NewMetricAlert(ctx, "metricAlert", &insights.MetricAlertArgs{
Actions: []insights.MetricAlertActionArgs{
{
ActionGroupId: pulumi.String("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
WebHookProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
},
AutoMitigate: pulumi.Bool(true),
Criteria: insights.MetricAlertMultipleResourceMultipleMetricCriteria{
AllOf: []interface{}{
insights.MetricCriteria{
CriterionType: "StaticThresholdCriterion",
Dimensions: []insights.MetricDimension{
{
Name: "ActivityName",
Operator: "Include",
Values: []string{
"*",
},
},
{
Name: "StatusCode",
Operator: "Include",
Values: []string{
"200",
},
},
},
MetricName: "Availability",
MetricNamespace: "Microsoft.KeyVault/vaults",
Name: "Metric1",
Operator: "GreaterThan",
Threshold: 55,
TimeAggregation: "Average",
},
},
OdataType: "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria",
},
Description: pulumi.String("This is the description of the rule1"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT1H"),
Location: pulumi.String("global"),
ResourceGroupName: pulumi.String("gigtest"),
RuleName: pulumi.String("MetricAlertOnMultipleDimensions"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource"),
},
Severity: pulumi.Int(3),
Tags: nil,
WindowSize: pulumi.String("P1D"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.MetricAlert;
import com.pulumi.azurenative.insights.MetricAlertArgs;
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 metricAlert = new MetricAlert("metricAlert", MetricAlertArgs.builder()
.actions(Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"),
Map.entry("webHookProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
))
.autoMitigate(true)
.criteria(Map.ofEntries(
Map.entry("allOf", Map.ofEntries(
Map.entry("criterionType", "StaticThresholdCriterion"),
Map.entry("dimensions",
Map.ofEntries(
Map.entry("name", "ActivityName"),
Map.entry("operator", "Include"),
Map.entry("values", "*")
),
Map.ofEntries(
Map.entry("name", "StatusCode"),
Map.entry("operator", "Include"),
Map.entry("values", "200")
)),
Map.entry("metricName", "Availability"),
Map.entry("metricNamespace", "Microsoft.KeyVault/vaults"),
Map.entry("name", "Metric1"),
Map.entry("operator", "GreaterThan"),
Map.entry("threshold", 55),
Map.entry("timeAggregation", "Average")
)),
Map.entry("odataType", "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")
))
.description("This is the description of the rule1")
.enabled(true)
.evaluationFrequency("PT1H")
.location("global")
.resourceGroupName("gigtest")
.ruleName("MetricAlertOnMultipleDimensions")
.scopes("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")
.severity(3)
.tags()
.windowSize("P1D")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:insights:MetricAlert webtest-name-example /subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions

Constructors

Link copied to clipboard
constructor(actions: Output<List<MetricAlertActionArgs>>? = null, autoMitigate: Output<Boolean>? = null, criteria: Output<Any>? = null, description: Output<String>? = null, enabled: Output<Boolean>? = null, evaluationFrequency: Output<String>? = null, location: Output<String>? = null, resourceGroupName: Output<String>? = null, ruleName: Output<String>? = null, scopes: Output<List<String>>? = null, severity: Output<Int>? = null, tags: Output<Map<String, String>>? = null, targetResourceRegion: Output<String>? = null, targetResourceType: Output<String>? = null, windowSize: Output<String>? = null)

Properties

Link copied to clipboard
val actions: Output<List<MetricAlertActionArgs>>? = null

the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved.

Link copied to clipboard
val autoMitigate: Output<Boolean>? = null

the flag that indicates whether the alert should be auto resolved or not. The default is true.

Link copied to clipboard
val criteria: Output<Any>? = null

defines the specific alert criteria information.

Link copied to clipboard
val description: Output<String>? = null

the description of the metric alert that will be included in the alert email.

Link copied to clipboard
val enabled: Output<Boolean>? = null

the flag that indicates whether the metric alert is enabled.

Link copied to clipboard
val evaluationFrequency: Output<String>? = null

how often the metric alert is evaluated represented in ISO 8601 duration format.

Link copied to clipboard
val location: Output<String>? = null

Resource location

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group. The name is case insensitive.

Link copied to clipboard
val ruleName: Output<String>? = null

The name of the rule.

Link copied to clipboard
val scopes: Output<List<String>>? = null

the list of resource id's that this metric alert is scoped to.

Link copied to clipboard
val severity: Output<Int>? = null

Alert severity {0, 1, 2, 3, 4}

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Resource tags

Link copied to clipboard
val targetResourceRegion: Output<String>? = null

the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource.

Link copied to clipboard
val targetResourceType: Output<String>? = null

the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource.

Link copied to clipboard
val windowSize: Output<String>? = null

the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.

Functions

Link copied to clipboard
open override fun toJava(): MetricAlertArgs