adding custom anomalies function

M_sloFix
rforstner 2022-04-04 18:00:51 +02:00
parent f2ecde7ac9
commit 5d57a14198
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# General Variables
variable "name" { default = "" }
variable "description" { default = "The {metricname} value of {severity} was {alert_condition} your custom threshold of {threshold}." }
variable "ownerMail" { default = "" }
variable "enabled" { default = true } //currently nothing else possible
#Target and warning percentage of the SLO as integer
variable "severity" { default = "CUSTOM_ALERT" }
#Metrics to be evaluated, must result in a percentage metric
variable "metric_selector" { default = "" }
variable "alert_condition" { default = "BELOW" }
variable "alerting_on_missing_data" { default = true }
variable "dealerting_samples" { default = 15 }
variable "samples" { default = 15 }
variable "threshold" { default = 10 }
variable "unit" { default = "UNSPECIFIED" }
variable "violating_samples" { default = 5 }

View File

@ -0,0 +1,26 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
}
resource dynatrace_custom_anomalies main {
name = "${var.name}"
description = "${var.description}"
enabled = "${var.enabled}"
metric_selector = trimspace("${var.metric_selector}")
severity = "${var.severity}"
strategy {
static {
alert_condition = "${var.alert_condition}"
alerting_on_missing_data = "${var.alerting_on_missing_data}"
dealerting_samples = "${var.dealerting_samples}"
samples = "${var.samples}"
threshold = "${var.threshold}"
unit = "${var.unit}"
violating_samples = "${var.violating_samples}"
}
}
}