MetricAlert

class MetricAlert : KotlinCustomResource

Manages a Metric Alert within Azure Monitor.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.monitoring.ActionGroup;
import com.pulumi.azure.monitoring.ActionGroupArgs;
import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
import com.pulumi.azure.monitoring.MetricAlert;
import com.pulumi.azure.monitoring.MetricAlertArgs;
import com.pulumi.azure.monitoring.inputs.MetricAlertCriteriaArgs;
import com.pulumi.azure.monitoring.inputs.MetricAlertActionArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
var toMonitor = new Account("toMonitor", AccountArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.accountTier("Standard")
.accountReplicationType("LRS")
.build());
var main = new ActionGroup("main", ActionGroupArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.shortName("exampleact")
.webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
.name("callmyapi")
.serviceUri("http://example.com/alert")
.build())
.build());
var exampleMetricAlert = new MetricAlert("exampleMetricAlert", MetricAlertArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.scopes(toMonitor.id())
.description("Action will be triggered when Transactions count is greater than 50.")
.criterias(MetricAlertCriteriaArgs.builder()
.metricNamespace("Microsoft.Storage/storageAccounts")
.metricName("Transactions")
.aggregation("Total")
.operator("GreaterThan")
.threshold(50)
.dimensions(MetricAlertCriteriaDimensionArgs.builder()
.name("ApiName")
.operator("Include")
.values("*")
.build())
.build())
.actions(MetricAlertActionArgs.builder()
.actionGroupId(main.id())
.build())
.build());
}
}

Import

Metric Alerts can be imported using the resource id, e.g.

$ pulumi import azure:monitoring/metricAlert:MetricAlert main /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.Insights/metricAlerts/example-metricalert

Properties

Link copied to clipboard

One or more action blocks as defined below.

A application_insights_web_test_location_availability_criteria block as defined below.

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

Should the alerts in this Metric Alert be auto resolved? Defaults to true.

Link copied to clipboard

One or more (static) criteria blocks as defined below.

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

The description of this Metric Alert.

Link copied to clipboard

A dynamic_criteria block as defined below.

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

Should this Metric Alert be enabled? Defaults to true.

Link copied to clipboard
val frequency: Output<String>?

The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

The name of the Metric Alert. Changing this forces a new resource to be created.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.

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

A set of strings of resource IDs at which the metric criteria should be applied.

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

The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.

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

A mapping of tags to assign to the resource.

Link copied to clipboard

The location of the target resource.

Link copied to clipboard

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

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

The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.