azurermMonitorSmartDetectorAlertRule
Manages an Monitor Smart Detector Alert Rule.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermApplicationInsightsExample =
new azurerm.applicationInsights.ApplicationInsights(this, "example_1", {
application_type: "web",
location: azurermResourceGroupExample.location,
name: "example-appinsights",
resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApplicationInsightsExample.overrideLogicalId("example");
const azurermMonitorActionGroupExample =
new azurerm.monitorActionGroup.MonitorActionGroup(this, "example_2", {
name: "example-action-group",
resource_group_name: azurermResourceGroupExample.name,
short_name: "example",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMonitorActionGroupExample.overrideLogicalId("example");
const azurermMonitorSmartDetectorAlertRuleExample =
new azurerm.monitorSmartDetectorAlertRule.MonitorSmartDetectorAlertRule(
this,
"example_3",
{
action_group: [
{
ids: [azurermMonitorActionGroupExample.id],
},
],
detector_type: "FailureAnomaliesDetector",
frequency: "PT1M",
name: "example-smart-detector-alert-rule",
resource_group_name: azurermResourceGroupExample.name,
scope_resource_ids: [azurermApplicationInsightsExample.id],
severity: "Sev0",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMonitorSmartDetectorAlertRuleExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the Monitor Smart Detector Alert Rule. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) Specifies the name of the resource group in which the Monitor Smart Detector Alert Rule should exist. Changing this forces a new resource to be created. -
detectorType
- (Required) Specifies the Built-In Smart Detector type that this alert rule will use. Currently the only possible values arefailureAnomaliesDetector
,requestPerformanceDegradationDetector
,dependencyPerformanceDegradationDetector
,exceptionVolumeChangedDetector
,traceSeverityDetector
,memoryLeakDetector
. -
scopeResourceIds
- (Required) Specifies the scopes of this Smart Detector Alert Rule. -
actionGroup
- (Required) AnactionGroup
block as defined below. -
severity
- (Required) Specifies the severity of this Smart Detector Alert Rule. Possible values aresev0
,sev1
,sev2
,sev3
orsev4
. -
frequency
- (Required) Specifies the frequency of this Smart Detector Alert Rule in ISO8601 format. -
description
- (Optional) Specifies a description for the Smart Detector Alert Rule. -
enabled
- (Optional) Is the Smart Detector Alert Rule enabled? Defaults totrue
. -
throttlingDuration
- (Optional) Specifies the duration (in ISO8601 format) to wait before notifying on the alert rule again. -
tags
- (Optional) A mapping of tags to assign to the resource.
The actionGroup
block supports the following:
-
ids
- (Required) Specifies the action group ids. -
emailSubject
- (Optional) Specifies a custom email subject if Email Receiver is specified in Monitor Action Group resource. -
webhookPayload
- (Optional) A JSON String which Specifies the custom webhook payload if Webhook Receiver is specified in Monitor Action Group resource.
Attributes Reference
The following attributes are exported:
id
- The ID of the Monitor Smart Detector Alert Rule.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Monitor Smart Detector Alert Rule.read
- (Defaults to 5 minutes) Used when retrieving the Monitor Smart Detector Alert Rule.update
- (Defaults to 30 minutes) Used when updating the Monitor Smart Detector Alert Rule.delete
- (Defaults to 30 minutes) Used when deleting the Monitor Smart Detector Alert Rule.
Import
Monitor Smart Detector Alert Rule can be imported using the resourceId
, e.g.