import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Manages an AlertingAction Scheduled Query Rules Version 2 resource 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 exampleInsights = new azure.appinsights.Insights("example", { * name: "example-ai", * location: example.location, * resourceGroupName: example.name, * applicationType: "web", * }); * const exampleActionGroup = new azure.monitoring.ActionGroup("example", { * name: "example-mag", * resourceGroupName: example.name, * shortName: "test mag", * }); * const exampleUserAssignedIdentity = new azure.authorization.UserAssignedIdentity("example", { * name: "example-uai", * location: example.location, * resourceGroupName: example.name, * }); * const exampleAssignment = new azure.authorization.Assignment("example", { * scope: exampleInsights.id, * roleDefinitionName: "Reader", * principalId: exampleUserAssignedIdentity.principalId, * }); * const exampleScheduledQueryRulesAlertV2 = new azure.monitoring.ScheduledQueryRulesAlertV2("example", { * name: "example-msqrv2", * resourceGroupName: example.name, * location: example.location, * evaluationFrequency: "PT10M", * windowDuration: "PT10M", * scopes: exampleInsights.id, * severity: 4, * criterias: [{ * query: `requests * | summarize CountByCountry=count() by client_CountryOrRegion * `, * timeAggregationMethod: "Maximum", * threshold: 17.5, * operator: "LessThan", * resourceIdColumn: "client_CountryOrRegion", * metricMeasureColumn: "CountByCountry", * dimensions: [{ * name: "client_CountryOrRegion", * operator: "Exclude", * values: ["123"], * }], * failingPeriods: { * minimumFailingPeriodsToTriggerAlert: 1, * numberOfEvaluationPeriods: 1, * }, * }], * autoMitigationEnabled: true, * workspaceAlertsStorageEnabled: false, * description: "example sqr", * displayName: "example-sqr", * enabled: true, * queryTimeRangeOverride: "PT1H", * skipQueryValidation: true, * action: { * actionGroups: [exampleActionGroup.id], * customProperties: { * key: "value", * key2: "value2", * }, * emailSubject: "Email Header", * }, * identity: { * type: "UserAssigned", * identityIds: [exampleUserAssignedIdentity.id], * }, * tags: { * key: "value", * key2: "value2", * }, * }, { * dependsOn: [exampleAssignment], * }); * ``` * * ## API Providers * * * This resource uses the following Azure API Providers: * * * `Microsoft.Insights` - 2023-03-15-preview * * ## Import * * Monitor Scheduled Query Rule Alert can be imported using the `resource id`, e.g. * * ```sh * $ pulumi import azure:monitoring/scheduledQueryRulesAlertV2:ScheduledQueryRulesAlertV2 example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Insights/scheduledQueryRules/rule1 * ``` */ export declare class ScheduledQueryRulesAlertV2 extends pulumi.CustomResource { /** * Get an existing ScheduledQueryRulesAlertV2 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?: ScheduledQueryRulesAlertV2State, opts?: pulumi.CustomResourceOptions): ScheduledQueryRulesAlertV2; /** * Returns true if the given object is an instance of ScheduledQueryRulesAlertV2. 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 ScheduledQueryRulesAlertV2; /** * An `action` block as defined below. */ readonly action: pulumi.Output; /** * Specifies the flag that indicates whether the alert should be automatically resolved or not. Value should be `true` or `false`. The default is `false`. */ readonly autoMitigationEnabled: pulumi.Output; /** * The api-version used when creating this alert rule. */ readonly createdWithApiVersion: pulumi.Output; /** * A `criteria` block as defined below. */ readonly criterias: pulumi.Output; /** * Specifies the description of the scheduled query rule. */ readonly description: pulumi.Output; /** * Specifies the display name of the alert rule. */ readonly displayName: pulumi.Output; /** * Specifies the flag which indicates whether this scheduled query rule is enabled. Value should be `true` or `false`. Defaults to `true`. */ readonly enabled: pulumi.Output; /** * How often the scheduled query rule is evaluated, represented in ISO 8601 duration format. Possible values are `PT1M`, `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D`. * * > **Note:** `evaluationFrequency` cannot be greater than the query look back which is `windowDuration`*`numberOfEvaluationPeriods`. * * > **Note:** `evaluationFrequency` cannot be greater than the `muteActionsAfterAlertDuration`. */ readonly evaluationFrequency: pulumi.Output; /** * An `identity` block as defined below. */ readonly identity: pulumi.Output; /** * True if this alert rule is a legacy Log Analytic Rule. */ readonly isALegacyLogAnalyticsRule: pulumi.Output; /** * The flag indicates whether this Scheduled Query Rule has been configured to be stored in the customer's storage. */ readonly isWorkspaceAlertsStorageConfigured: pulumi.Output; /** * Specifies the Azure Region where the Monitor Scheduled Query Rule should exist. Changing this forces a new resource to be created. */ readonly location: pulumi.Output; /** * Mute actions for the chosen period of time in ISO 8601 duration format after the alert is fired. Possible values are `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D` and `P2D`. * * > **Note:** `autoMitigationEnabled` and `muteActionsAfterAlertDuration` are mutually exclusive and cannot both be set. */ readonly muteActionsAfterAlertDuration: pulumi.Output; /** * Specifies the name which should be used for this Monitor Scheduled Query Rule. Changing this forces a new resource to be created. */ readonly name: pulumi.Output; /** * Set this if the alert evaluation period is different from the query time range. If not specified, the value is `windowDuration`*`numberOfEvaluationPeriods`. Possible values are `PT5M`, `PT10M`, `PT15M`, `PT20M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D` and `P2D`. * * > **Note:** `queryTimeRangeOverride` cannot be less than the query look back which is `windowDuration`*`numberOfEvaluationPeriods`. */ readonly queryTimeRangeOverride: pulumi.Output; /** * Specifies the name of the Resource Group where the Monitor Scheduled Query Rule should exist. Changing this forces a new resource to be created. */ readonly resourceGroupName: pulumi.Output; /** * Specifies the list of resource IDs that this scheduled query rule is scoped to. Changing this forces a new resource to be created. Currently, the API supports exactly 1 resource ID in the scopes list. */ readonly scopes: pulumi.Output; /** * Severity of the alert. Should be an integer between 0 and 4. Value of 0 is severest. */ readonly severity: pulumi.Output; /** * Specifies the flag which indicates whether the provided query should be validated or not. The default is false. */ readonly skipQueryValidation: pulumi.Output; /** * A mapping of tags which should be assigned to the Monitor Scheduled Query Rule. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is `Microsoft.Compute/virtualMachines`, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. */ readonly targetResourceTypes: pulumi.Output; /** * Specifies the period of time in ISO 8601 duration format on which the Scheduled Query Rule will be executed (bin size). If `evaluationFrequency` is `PT1M`, possible values are `PT1M`, `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, and `PT6H`. Otherwise, possible values are `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D`, and `P2D`. */ readonly windowDuration: pulumi.Output; /** * Specifies the flag which indicates whether this scheduled query rule check if storage is configured. Value should be `true` or `false`. The default is `false`. */ readonly workspaceAlertsStorageEnabled: pulumi.Output; /** * Create a ScheduledQueryRulesAlertV2 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: ScheduledQueryRulesAlertV2Args, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering ScheduledQueryRulesAlertV2 resources. */ export interface ScheduledQueryRulesAlertV2State { /** * An `action` block as defined below. */ action?: pulumi.Input; /** * Specifies the flag that indicates whether the alert should be automatically resolved or not. Value should be `true` or `false`. The default is `false`. */ autoMitigationEnabled?: pulumi.Input; /** * The api-version used when creating this alert rule. */ createdWithApiVersion?: pulumi.Input; /** * A `criteria` block as defined below. */ criterias?: pulumi.Input[]>; /** * Specifies the description of the scheduled query rule. */ description?: pulumi.Input; /** * Specifies the display name of the alert rule. */ displayName?: pulumi.Input; /** * Specifies the flag which indicates whether this scheduled query rule is enabled. Value should be `true` or `false`. Defaults to `true`. */ enabled?: pulumi.Input; /** * How often the scheduled query rule is evaluated, represented in ISO 8601 duration format. Possible values are `PT1M`, `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D`. * * > **Note:** `evaluationFrequency` cannot be greater than the query look back which is `windowDuration`*`numberOfEvaluationPeriods`. * * > **Note:** `evaluationFrequency` cannot be greater than the `muteActionsAfterAlertDuration`. */ evaluationFrequency?: pulumi.Input; /** * An `identity` block as defined below. */ identity?: pulumi.Input; /** * True if this alert rule is a legacy Log Analytic Rule. */ isALegacyLogAnalyticsRule?: pulumi.Input; /** * The flag indicates whether this Scheduled Query Rule has been configured to be stored in the customer's storage. */ isWorkspaceAlertsStorageConfigured?: pulumi.Input; /** * Specifies the Azure Region where the Monitor Scheduled Query Rule should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * Mute actions for the chosen period of time in ISO 8601 duration format after the alert is fired. Possible values are `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D` and `P2D`. * * > **Note:** `autoMitigationEnabled` and `muteActionsAfterAlertDuration` are mutually exclusive and cannot both be set. */ muteActionsAfterAlertDuration?: pulumi.Input; /** * Specifies the name which should be used for this Monitor Scheduled Query Rule. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * Set this if the alert evaluation period is different from the query time range. If not specified, the value is `windowDuration`*`numberOfEvaluationPeriods`. Possible values are `PT5M`, `PT10M`, `PT15M`, `PT20M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D` and `P2D`. * * > **Note:** `queryTimeRangeOverride` cannot be less than the query look back which is `windowDuration`*`numberOfEvaluationPeriods`. */ queryTimeRangeOverride?: pulumi.Input; /** * Specifies the name of the Resource Group where the Monitor Scheduled Query Rule should exist. Changing this forces a new resource to be created. */ resourceGroupName?: pulumi.Input; /** * Specifies the list of resource IDs that this scheduled query rule is scoped to. Changing this forces a new resource to be created. Currently, the API supports exactly 1 resource ID in the scopes list. */ scopes?: pulumi.Input; /** * Severity of the alert. Should be an integer between 0 and 4. Value of 0 is severest. */ severity?: pulumi.Input; /** * Specifies the flag which indicates whether the provided query should be validated or not. The default is false. */ skipQueryValidation?: pulumi.Input; /** * A mapping of tags which should be assigned to the Monitor Scheduled Query Rule. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is `Microsoft.Compute/virtualMachines`, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. */ targetResourceTypes?: pulumi.Input[]>; /** * Specifies the period of time in ISO 8601 duration format on which the Scheduled Query Rule will be executed (bin size). If `evaluationFrequency` is `PT1M`, possible values are `PT1M`, `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, and `PT6H`. Otherwise, possible values are `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D`, and `P2D`. */ windowDuration?: pulumi.Input; /** * Specifies the flag which indicates whether this scheduled query rule check if storage is configured. Value should be `true` or `false`. The default is `false`. */ workspaceAlertsStorageEnabled?: pulumi.Input; } /** * The set of arguments for constructing a ScheduledQueryRulesAlertV2 resource. */ export interface ScheduledQueryRulesAlertV2Args { /** * An `action` block as defined below. */ action?: pulumi.Input; /** * Specifies the flag that indicates whether the alert should be automatically resolved or not. Value should be `true` or `false`. The default is `false`. */ autoMitigationEnabled?: pulumi.Input; /** * A `criteria` block as defined below. */ criterias: pulumi.Input[]>; /** * Specifies the description of the scheduled query rule. */ description?: pulumi.Input; /** * Specifies the display name of the alert rule. */ displayName?: pulumi.Input; /** * Specifies the flag which indicates whether this scheduled query rule is enabled. Value should be `true` or `false`. Defaults to `true`. */ enabled?: pulumi.Input; /** * How often the scheduled query rule is evaluated, represented in ISO 8601 duration format. Possible values are `PT1M`, `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D`. * * > **Note:** `evaluationFrequency` cannot be greater than the query look back which is `windowDuration`*`numberOfEvaluationPeriods`. * * > **Note:** `evaluationFrequency` cannot be greater than the `muteActionsAfterAlertDuration`. */ evaluationFrequency: pulumi.Input; /** * An `identity` block as defined below. */ identity?: pulumi.Input; /** * Specifies the Azure Region where the Monitor Scheduled Query Rule should exist. Changing this forces a new resource to be created. */ location?: pulumi.Input; /** * Mute actions for the chosen period of time in ISO 8601 duration format after the alert is fired. Possible values are `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D` and `P2D`. * * > **Note:** `autoMitigationEnabled` and `muteActionsAfterAlertDuration` are mutually exclusive and cannot both be set. */ muteActionsAfterAlertDuration?: pulumi.Input; /** * Specifies the name which should be used for this Monitor Scheduled Query Rule. Changing this forces a new resource to be created. */ name?: pulumi.Input; /** * Set this if the alert evaluation period is different from the query time range. If not specified, the value is `windowDuration`*`numberOfEvaluationPeriods`. Possible values are `PT5M`, `PT10M`, `PT15M`, `PT20M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D` and `P2D`. * * > **Note:** `queryTimeRangeOverride` cannot be less than the query look back which is `windowDuration`*`numberOfEvaluationPeriods`. */ queryTimeRangeOverride?: pulumi.Input; /** * Specifies the name of the Resource Group where the Monitor Scheduled Query Rule should exist. Changing this forces a new resource to be created. */ resourceGroupName: pulumi.Input; /** * Specifies the list of resource IDs that this scheduled query rule is scoped to. Changing this forces a new resource to be created. Currently, the API supports exactly 1 resource ID in the scopes list. */ scopes: pulumi.Input; /** * Severity of the alert. Should be an integer between 0 and 4. Value of 0 is severest. */ severity: pulumi.Input; /** * Specifies the flag which indicates whether the provided query should be validated or not. The default is false. */ skipQueryValidation?: pulumi.Input; /** * A mapping of tags which should be assigned to the Monitor Scheduled Query Rule. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is `Microsoft.Compute/virtualMachines`, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. */ targetResourceTypes?: pulumi.Input[]>; /** * Specifies the period of time in ISO 8601 duration format on which the Scheduled Query Rule will be executed (bin size). If `evaluationFrequency` is `PT1M`, possible values are `PT1M`, `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, and `PT6H`. Otherwise, possible values are `PT5M`, `PT10M`, `PT15M`, `PT30M`, `PT45M`, `PT1H`, `PT2H`, `PT3H`, `PT4H`, `PT5H`, `PT6H`, `P1D`, and `P2D`. */ windowDuration: pulumi.Input; /** * Specifies the flag which indicates whether this scheduled query rule check if storage is configured. Value should be `true` or `false`. The default is `false`. */ workspaceAlertsStorageEnabled?: pulumi.Input; }