import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages a Metric Alert within Azure Monitor. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as azure from "@pulumi/azure"; * * const example = new azure.core.ResourceGroup("example", { * name: "example-resources", * location: "West Europe", * }); * const toMonitor = new azure.storage.Account("to_monitor", { * name: "examplestorageaccount", * resourceGroupName: example.name, * location: example.location, * accountTier: "Standard", * accountReplicationType: "LRS", * }); * const main = new azure.monitoring.ActionGroup("main", { * name: "example-actiongroup", * resourceGroupName: example.name, * shortName: "exampleact", * webhookReceivers: [{ * name: "callmyapi", * serviceUri: "http://example.com/alert", * }], * }); * const exampleMetricAlert = new azure.monitoring.MetricAlert("example", { * name: "example-metricalert", * resourceGroupName: example.name, * scopes: [toMonitor.id], * description: "Action will be triggered when Transactions count is greater than 50.", * criterias: [{ * metricNamespace: "Microsoft.Storage/storageAccounts", * metricName: "Transactions", * aggregation: "Total", * operator: "GreaterThan", * threshold: 50, * dimensions: [{ * name: "ApiName", * operator: "Include", * values: ["*"], * }], * }], * actions: [{ * actionGroupId: main.id, * }], * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Insights` - 2018-03-01 * * ## Import * * Metric Alerts can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:monitoring/metricAlert:MetricAlert main /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.Insights/metricAlerts/example-metricalert * ``` */ export declare class MetricAlert extends pulumi.CustomResource { /** * Get an existing MetricAlert resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: MetricAlertState, opts?: pulumi.CustomResourceOptions): MetricAlert; /** * Returns true if the given object is an instance of MetricAlert. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is MetricAlert; /** * One or more `action` blocks as defined below. */ readonly actions: pulumi.Output; /** * A `applicationInsightsWebTestLocationAvailabilityCriteria` block as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ readonly applicationInsightsWebTestLocationAvailabilityCriteria: pulumi.Output; /** * Should the alerts in this Metric Alert be auto resolved? Defaults to `true`. */ readonly autoMitigate: pulumi.Output; /** * One or more (static) `criteria` blocks as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ readonly criterias: pulumi.Output; /** * The description of this Metric Alert. */ readonly description: pulumi.Output; /** * A `dynamicCriteria` block as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ readonly dynamicCriteria: pulumi.Output; /** * Should this Metric Alert be enabled? Defaults to `true`. */ readonly enabled: pulumi.Output; /** * 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`. */ readonly frequency: pulumi.Output; /** * The name of the Metric Alert. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * A set of strings of resource IDs at which the metric criteria should be applied. */ readonly scopes: pulumi.Output; /** * The severity of this Metric Alert. Possible values are `0`, `1`, `2`, `3` and `4`. Defaults to `3`. */ readonly severity: pulumi.Output; /** * A mapping of tags to assign to the resource. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The location of the target resource. * * > **Note:** This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes. */ readonly targetResourceLocation: pulumi.Output; /** * The resource type (e.g. `Microsoft.Compute/virtualMachines`) of the target resource. * * > **Note:** This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes. */ readonly targetResourceType: pulumi.Output; /** * 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`. */ readonly windowSize: pulumi.Output; /** * Create a MetricAlert resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: MetricAlertArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering MetricAlert resources. */ export interface MetricAlertState { /** * One or more `action` blocks as defined below. */ actions?: pulumi.Input[]>; /** * A `applicationInsightsWebTestLocationAvailabilityCriteria` block as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ applicationInsightsWebTestLocationAvailabilityCriteria?: pulumi.Input; /** * Should the alerts in this Metric Alert be auto resolved? Defaults to `true`. */ autoMitigate?: pulumi.Input; /** * One or more (static) `criteria` blocks as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ criterias?: pulumi.Input[]>; /** * The description of this Metric Alert. */ description?: pulumi.Input; /** * A `dynamicCriteria` block as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ dynamicCriteria?: pulumi.Input; /** * Should this Metric Alert be enabled? Defaults to `true`. */ enabled?: pulumi.Input; /** * 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`. */ frequency?: pulumi.Input; /** * The name of the Metric Alert. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * A set of strings of resource IDs at which the metric criteria should be applied. */ scopes?: pulumi.Input[]>; /** * The severity of this Metric Alert. Possible values are `0`, `1`, `2`, `3` and `4`. Defaults to `3`. */ severity?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The location of the target resource. * * > **Note:** This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes. */ targetResourceLocation?: pulumi.Input; /** * The resource type (e.g. `Microsoft.Compute/virtualMachines`) of the target resource. * * > **Note:** This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes. */ targetResourceType?: pulumi.Input; /** * 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`. */ windowSize?: pulumi.Input; } /** * The set of arguments for constructing a MetricAlert resource. */ export interface MetricAlertArgs { /** * One or more `action` blocks as defined below. */ actions?: pulumi.Input[]>; /** * A `applicationInsightsWebTestLocationAvailabilityCriteria` block as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ applicationInsightsWebTestLocationAvailabilityCriteria?: pulumi.Input; /** * Should the alerts in this Metric Alert be auto resolved? Defaults to `true`. */ autoMitigate?: pulumi.Input; /** * One or more (static) `criteria` blocks as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ criterias?: pulumi.Input[]>; /** * The description of this Metric Alert. */ description?: pulumi.Input; /** * A `dynamicCriteria` block as defined below. * * > **Note:** One of either `criteria`, `dynamicCriteria` or `applicationInsightsWebTestLocationAvailabilityCriteria` must be specified. */ dynamicCriteria?: pulumi.Input; /** * Should this Metric Alert be enabled? Defaults to `true`. */ enabled?: pulumi.Input; /** * 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`. */ frequency?: pulumi.Input; /** * The name of the Metric Alert. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * A set of strings of resource IDs at which the metric criteria should be applied. */ scopes: pulumi.Input[]>; /** * The severity of this Metric Alert. Possible values are `0`, `1`, `2`, `3` and `4`. Defaults to `3`. */ severity?: pulumi.Input; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The location of the target resource. * * > **Note:** This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes. */ targetResourceLocation?: pulumi.Input; /** * The resource type (e.g. `Microsoft.Compute/virtualMachines`) of the target resource. * * > **Note:** This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes. */ targetResourceType?: pulumi.Input; /** * 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`. */ windowSize?: pulumi.Input; }