adding tag_filters to alerting profiles
parent
b7aa1833d5
commit
d7a3d180a9
|
|
@ -1,7 +1,7 @@
|
||||||
## --- variables
|
## --- variables
|
||||||
|
|
||||||
# AlertingProfiles Variables
|
# AlertingProfiles Variables
|
||||||
variable mzId {default = ""}
|
variable mzId {default = ""}
|
||||||
variable alertingProfileName {default = ""}
|
variable alertingProfileName {default = ""}
|
||||||
variable delay_AVAILABILITY {default = 0}
|
variable delay_AVAILABILITY {default = 0}
|
||||||
variable delay_CUSTOM_ALERT {default = 0}
|
variable delay_CUSTOM_ALERT {default = 0}
|
||||||
|
|
@ -9,3 +9,5 @@ variable delay_ERROR {default = 0}
|
||||||
variable delay_MONITORING_UNAVAILABLE {default = 0}
|
variable delay_MONITORING_UNAVAILABLE {default = 0}
|
||||||
variable delay_PERFORMANCE {default = 0}
|
variable delay_PERFORMANCE {default = 0}
|
||||||
variable delay_RESOURCE_CONTENTION {default = 0}
|
variable delay_RESOURCE_CONTENTION {default = 0}
|
||||||
|
variable tag_filters {}
|
||||||
|
variable include_mode {default = "NONE"}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,15 @@ resource dynatrace_alerting_profile main {
|
||||||
delay_in_minutes = "${var.delay_AVAILABILITY}"
|
delay_in_minutes = "${var.delay_AVAILABILITY}"
|
||||||
severity_level = "AVAILABILITY"
|
severity_level = "AVAILABILITY"
|
||||||
tag_filter {
|
tag_filter {
|
||||||
include_mode = "NONE"
|
include_mode = "${var.include_mode}"
|
||||||
|
dynamic "tag_filters" {
|
||||||
|
for_each = var.include_mode != "NONE" ? var.tag_filters : []
|
||||||
|
content {
|
||||||
|
context = tag_filters.value["context"]
|
||||||
|
key = tag_filters.value["key"]
|
||||||
|
value = tag_filters.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,7 +31,15 @@ resource dynatrace_alerting_profile main {
|
||||||
delay_in_minutes = "${var.delay_CUSTOM_ALERT}"
|
delay_in_minutes = "${var.delay_CUSTOM_ALERT}"
|
||||||
severity_level = "CUSTOM_ALERT"
|
severity_level = "CUSTOM_ALERT"
|
||||||
tag_filter {
|
tag_filter {
|
||||||
include_mode = "NONE"
|
include_mode = "${var.include_mode}"
|
||||||
|
dynamic "tag_filters" {
|
||||||
|
for_each = var.include_mode != "NONE" ? var.tag_filters : []
|
||||||
|
content {
|
||||||
|
context = tag_filters.value["context"]
|
||||||
|
key = tag_filters.value["key"]
|
||||||
|
value = tag_filters.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,7 +47,15 @@ resource dynatrace_alerting_profile main {
|
||||||
delay_in_minutes = "${var.delay_ERROR}"
|
delay_in_minutes = "${var.delay_ERROR}"
|
||||||
severity_level = "ERROR"
|
severity_level = "ERROR"
|
||||||
tag_filter {
|
tag_filter {
|
||||||
include_mode = "NONE"
|
include_mode = "${var.include_mode}"
|
||||||
|
dynamic "tag_filters" {
|
||||||
|
for_each = var.include_mode != "NONE" ? var.tag_filters : []
|
||||||
|
content {
|
||||||
|
context = tag_filters.value["context"]
|
||||||
|
key = tag_filters.value["key"]
|
||||||
|
value = tag_filters.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -39,14 +63,30 @@ resource dynatrace_alerting_profile main {
|
||||||
delay_in_minutes = "${var.delay_MONITORING_UNAVAILABLE}"
|
delay_in_minutes = "${var.delay_MONITORING_UNAVAILABLE}"
|
||||||
severity_level = "MONITORING_UNAVAILABLE"
|
severity_level = "MONITORING_UNAVAILABLE"
|
||||||
tag_filter {
|
tag_filter {
|
||||||
include_mode = "NONE"
|
include_mode = "${var.include_mode}"
|
||||||
|
dynamic "tag_filters" {
|
||||||
|
for_each = var.include_mode != "NONE" ? var.tag_filters : []
|
||||||
|
content {
|
||||||
|
context = tag_filters.value["context"]
|
||||||
|
key = tag_filters.value["key"]
|
||||||
|
value = tag_filters.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rules {
|
rules {
|
||||||
delay_in_minutes = "${var.delay_PERFORMANCE}"
|
delay_in_minutes = "${var.delay_PERFORMANCE}"
|
||||||
severity_level = "PERFORMANCE"
|
severity_level = "PERFORMANCE"
|
||||||
tag_filter {
|
tag_filter {
|
||||||
include_mode = "NONE"
|
include_mode = "${var.include_mode}"
|
||||||
|
dynamic "tag_filters" {
|
||||||
|
for_each = var.include_mode != "NONE" ? var.tag_filters : []
|
||||||
|
content {
|
||||||
|
context = tag_filters.value["context"]
|
||||||
|
key = tag_filters.value["key"]
|
||||||
|
value = tag_filters.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +94,15 @@ resource dynatrace_alerting_profile main {
|
||||||
delay_in_minutes = "${var.delay_RESOURCE_CONTENTION}"
|
delay_in_minutes = "${var.delay_RESOURCE_CONTENTION}"
|
||||||
severity_level = "RESOURCE_CONTENTION"
|
severity_level = "RESOURCE_CONTENTION"
|
||||||
tag_filter {
|
tag_filter {
|
||||||
include_mode = "NONE"
|
include_mode = "${var.include_mode}"
|
||||||
|
dynamic "tag_filters" {
|
||||||
|
for_each = var.include_mode != "NONE" ? var.tag_filters : []
|
||||||
|
content {
|
||||||
|
context = tag_filters.value["context"]
|
||||||
|
key = tag_filters.value["key"]
|
||||||
|
value = tag_filters.value["value"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ module ap1 {
|
||||||
source = "../../_dynatrace-base-modules/dynatrace-alerting-profile"
|
source = "../../_dynatrace-base-modules/dynatrace-alerting-profile"
|
||||||
|
|
||||||
mzId = module.mz1.id
|
mzId = module.mz1.id
|
||||||
#mzId = "12323"
|
|
||||||
alertingProfileName = "Test123"
|
alertingProfileName = "Test123"
|
||||||
delay_AVAILABILITY = 0
|
delay_AVAILABILITY = 0
|
||||||
delay_CUSTOM_ALERT = 10
|
delay_CUSTOM_ALERT = 10
|
||||||
|
|
@ -12,5 +11,18 @@ module ap1 {
|
||||||
delay_PERFORMANCE = 10
|
delay_PERFORMANCE = 10
|
||||||
delay_RESOURCE_CONTENTION = 0
|
delay_RESOURCE_CONTENTION = 0
|
||||||
|
|
||||||
|
#Tag Filters
|
||||||
|
include_mode = "INCLUDE_ALL"
|
||||||
|
tag_filters = [{
|
||||||
|
context = "CONTEXTLESS"
|
||||||
|
key = "Environment"
|
||||||
|
value = "PROD"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
context = "CONTEXTLESS"
|
||||||
|
key = "ms-id"
|
||||||
|
value = "ABC"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue