adding central alerting & notification

PerseusSLO
rforstner 2022-04-19 13:13:47 +02:00
parent 24d9503512
commit f274d0525f
12 changed files with 294 additions and 0 deletions

View File

@ -0,0 +1,18 @@
resource "dynatrace_alerting_profile" "SLO_Alerting_Central" {
display_name = "SLO_Alerting_Central"
event_type_filters {
custom_event_filter {
custom_title_filter {
enabled = true
case_insensitive = true
# negate = false
operator = "CONTAINS"
value = "TP_"
}
}
}
}
output "SLO_Alerting_Central_id" {
value = dynatrace_alerting_profile.SLO_Alerting_Central.id
}

View File

@ -0,0 +1,26 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
backend "s3" {
bucket = "coco-dynatrace-tfstate"
key = "cnprod/alerting_profiles/terraform.tfstate"
region = "eu-central-1"
dynamodb_table = "coco-dynatrace-tfstate"
encrypt = true
}
}
variable CN_PROD_ENV_URL {}
variable CN_PROD_API_TOKEN {}
provider "dynatrace" {
dt_env_url = "${var.CN_PROD_ENV_URL}"
dt_api_token = "${var.CN_PROD_API_TOKEN}"
}

View File

@ -0,0 +1,17 @@
resource "dynatrace_notification" "SLO_Alerting_Central" {
web_hook {
name = "[TEAMS] SLO_Alerting_Central"
accept_any_certificate = true
active = true
alerting_profile = data.terraform_remote_state.alerting_profiles.outputs.SLO_Alerting_Central_id
notify_event_merges = true
payload = <<-EOT
{
"title":"{ProblemTitle}",
"text":"{ProblemDetailsHTML}",
"themeColor":"EA4300"
}
EOT
url = "https://bmwgroup.webhook.office.com/webhookb2/483edc00-c925-4672-8088-8299a0139fca@ce849bab-cc1c-465b-b62e-18f07c9ac198/IncomingWebhook/c44b5bc7c0094aba8b870dcf12b7e55e/af36b177-c3fb-4707-a2d4-c75dbce454a2"
}
}

View File

@ -0,0 +1,37 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
backend "s3" {
bucket = "coco-dynatrace-tfstate"
key = "cnprod/problem_notification/terraform.tfstate"
region = "eu-central-1"
dynamodb_table = "coco-dynatrace-tfstate"
encrypt = true
}
}
data "terraform_remote_state" "alerting_profiles" {
backend = "s3"
config = {
bucket = "coco-dynatrace-tfstate"
key = "cnprod/alerting_profiles/terraform.tfstate"
region = "eu-central-1"
encrypt = true
dynamodb_table = "coco-dynatrace-tfstate"
}
}
variable CN_PROD_ENV_URL {}
variable CN_PROD_API_TOKEN {}
provider "dynatrace" {
dt_env_url = "${var.CN_PROD_ENV_URL}"
dt_api_token = "${var.CN_PROD_API_TOKEN}"
}

View File

@ -0,0 +1,18 @@
resource "dynatrace_alerting_profile" "SLO_Alerting_Central" {
display_name = "SLO_Alerting_Central"
event_type_filters {
custom_event_filter {
custom_title_filter {
enabled = true
case_insensitive = true
# negate = false
operator = "CONTAINS"
value = "TP_"
}
}
}
}
output "SLO_Alerting_Central_id" {
value = dynatrace_alerting_profile.SLO_Alerting_Central.id
}

View File

@ -0,0 +1,26 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
backend "s3" {
bucket = "coco-dynatrace-tfstate"
key = "euprod/alerting_profiles/terraform.tfstate"
region = "eu-central-1"
dynamodb_table = "coco-dynatrace-tfstate"
encrypt = true
}
}
variable EMEA_PROD_ENV_URL {}
variable EMEA_PROD_API_TOKEN {}
provider "dynatrace" {
dt_env_url = "${var.EMEA_PROD_ENV_URL}"
dt_api_token = "${var.EMEA_PROD_API_TOKEN}"
}

View File

@ -0,0 +1,17 @@
resource "dynatrace_notification" "SLO_Alerting_Central" {
web_hook {
name = "[TEAMS] SLO_Alerting_Central"
accept_any_certificate = true
active = true
alerting_profile = data.terraform_remote_state.alerting_profiles.outputs.SLO_Alerting_Central_id
notify_event_merges = true
payload = <<-EOT
{
"title":"{ProblemTitle}",
"text":"{ProblemDetailsHTML}",
"themeColor":"EA4300"
}
EOT
url = "https://bmwgroup.webhook.office.com/webhookb2/483edc00-c925-4672-8088-8299a0139fca@ce849bab-cc1c-465b-b62e-18f07c9ac198/IncomingWebhook/c44b5bc7c0094aba8b870dcf12b7e55e/af36b177-c3fb-4707-a2d4-c75dbce454a2"
}
}

View File

@ -0,0 +1,37 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
backend "s3" {
bucket = "coco-dynatrace-tfstate"
key = "euprod/problem_notification/terraform.tfstate"
region = "eu-central-1"
dynamodb_table = "coco-dynatrace-tfstate"
encrypt = true
}
}
data "terraform_remote_state" "alerting_profiles" {
backend = "s3"
config = {
bucket = "coco-dynatrace-tfstate"
key = "euprod/alerting_profiles/terraform.tfstate"
region = "eu-central-1"
encrypt = true
dynamodb_table = "coco-dynatrace-tfstate"
}
}
variable EMEA_PROD_ENV_URL {}
variable EMEA_PROD_API_TOKEN {}
provider "dynatrace" {
dt_env_url = "${var.EMEA_PROD_ENV_URL}"
dt_api_token = "${var.EMEA_PROD_API_TOKEN}"
}

View File

@ -0,0 +1,18 @@
resource "dynatrace_alerting_profile" "SLO_Alerting_Central" {
display_name = "SLO_Alerting_Central"
event_type_filters {
custom_event_filter {
custom_title_filter {
enabled = true
case_insensitive = true
# negate = false
operator = "CONTAINS"
value = "TP_"
}
}
}
}
output "SLO_Alerting_Central_id" {
value = dynatrace_alerting_profile.SLO_Alerting_Central.id
}

View File

@ -0,0 +1,26 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
backend "s3" {
bucket = "coco-dynatrace-tfstate"
key = "naprod/alerting_profiles/terraform.tfstate"
region = "eu-central-1"
dynamodb_table = "coco-dynatrace-tfstate"
encrypt = true
}
}
variable NA_PROD_ENV_URL {}
variable NA_PROD_API_TOKEN {}
provider "dynatrace" {
dt_env_url = "${var.NA_PROD_ENV_URL}"
dt_api_token = "${var.NA_PROD_API_TOKEN}"
}

View File

@ -0,0 +1,17 @@
resource "dynatrace_notification" "SLO_Alerting_Central" {
web_hook {
name = "[TEAMS] SLO_Alerting_Central"
accept_any_certificate = true
active = true
alerting_profile = data.terraform_remote_state.alerting_profiles.outputs.SLO_Alerting_Central_id
notify_event_merges = true
payload = <<-EOT
{
"title":"{ProblemTitle}",
"text":"{ProblemDetailsHTML}",
"themeColor":"EA4300"
}
EOT
url = "https://bmwgroup.webhook.office.com/webhookb2/483edc00-c925-4672-8088-8299a0139fca@ce849bab-cc1c-465b-b62e-18f07c9ac198/IncomingWebhook/c44b5bc7c0094aba8b870dcf12b7e55e/af36b177-c3fb-4707-a2d4-c75dbce454a2"
}
}

View File

@ -0,0 +1,37 @@
terraform {
required_providers {
dynatrace = {
version = "1.11.0"
source = "dynatrace-oss/dynatrace"
}
}
backend "s3" {
bucket = "coco-dynatrace-tfstate"
key = "naprod/problem_notification/terraform.tfstate"
region = "eu-central-1"
dynamodb_table = "coco-dynatrace-tfstate"
encrypt = true
}
}
data "terraform_remote_state" "alerting_profiles" {
backend = "s3"
config = {
bucket = "coco-dynatrace-tfstate"
key = "naprod/alerting_profiles/terraform.tfstate"
region = "eu-central-1"
encrypt = true
dynamodb_table = "coco-dynatrace-tfstate"
}
}
variable NA_PROD_ENV_URL {}
variable NA_PROD_API_TOKEN {}
provider "dynatrace" {
dt_env_url = "${var.NA_PROD_ENV_URL}"
dt_api_token = "${var.NA_PROD_API_TOKEN}"
}