"Migrating from Monaco to Terraform for management zone: CD_VDLM"

CD_VDLM
Patryk Gudalewicz 2023-03-01 19:06:59 +01:00
parent d6fd1dd6fc
commit c5bf197d73
4 changed files with 622 additions and 0 deletions

View File

@ -0,0 +1,38 @@
# DEFINE dynatrace_alerting.CD_VDLM_PROD.id = vu9U3hXa3q0AAAABABhidWlsdGluOmFsZXJ0aW5nLnByb2ZpbGUABnRlbmFudAAGdGVuYW50ACRiMjE1YjBjMy1hYjZkLTMxODctOTI5Zi1mZDdjNjZjNWQzMDG-71TeFdrerQ
data "dynatrace_management_zone" "CD_VDLM_PROD"{ name="CD_VDLM" }
resource "dynatrace_alerting" "CD_VDLM_PROD" {
name = "CD_VDLM PROD"
management_zone = data.dynatrace_management_zone.CD_VDLM_PROD.id
rules {
rule {
delay_in_minutes = 0
include_mode = "INCLUDE_ALL"
severity_level = "AVAILABILITY"
tags = [ "Environment:PROD" ]
}
rule {
delay_in_minutes = 10
include_mode = "INCLUDE_ALL"
severity_level = "CUSTOM_ALERT"
tags = [ "Environment:PROD" ]
}
rule {
delay_in_minutes = 10
include_mode = "INCLUDE_ALL"
severity_level = "ERRORS"
tags = [ "Environment:PROD" ]
}
rule {
delay_in_minutes = 30
include_mode = "INCLUDE_ALL"
severity_level = "PERFORMANCE"
tags = [ "Environment:PROD" ]
}
rule {
delay_in_minutes = 30
include_mode = "INCLUDE_ALL"
severity_level = "RESOURCE_CONTENTION"
tags = [ "Environment:PROD" ]
}
}
}

View File

@ -0,0 +1,219 @@
# DEFINE dynatrace_dashboard.CD_VDLM_CBS_Demands.id = d11480b8-dad1-4ef0-a365-3c7e94f98a83
data "dynatrace_management_zone" "CD_VDLM_CBS_Demands"{ name="CD_VDLM" }
resource "dynatrace_dashboard" "CD_VDLM_CBS_Demands" {
dashboard_metadata {
name = "CD_VDLM_CBS_Demands"
owner = "Tobias.M.Mueller@bmwgroup.com"
# preset = false
# shared = false
filter {
management_zone {
name = "CD_VDLM"
id = data.dynatrace_management_zone.CD_VDLM_CBS_Demands.id
}
}
}
tile {
name = "Health Checks"
configured = true
tile_type = "HEADER"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 38
left = 0
top = 0
width = 304
}
}
tile {
name = "Honeycomb"
configured = true
custom_name = "Honeycomb"
tile_type = "DATA_EXPLORER"
unknowns = jsonencode({
"isAutoRefreshDisabled": false,
"metricExpressions": [
"resolution=Inf\u0026(builtin:synthetic.location.healthStatus:splitBy():count:auto:sort(value(avg,descending)):limit(100)):names"
],
"queries": [
{
"enabled": true,
"filterBy": {
"criteria": [],
"nestedFilters": []
},
"id": "A",
"limit": 100,
"metric": "builtin:synthetic.location.healthStatus",
"rate": "NONE",
"sortBy": "DESC",
"spaceAggregation": "COUNT",
"splitBy": [],
"timeAggregation": "DEFAULT"
}
],
"queriesSettings": {
"resolution": ""
},
"visualConfig": {
"axes": {
"xAxis": {
"visible": true
},
"yAxes": []
},
"global": {
"hideLegend": false
},
"graphChartSettings": {
"connectNulls": false
},
"heatmapSettings": {
"yAxis": "VALUE"
},
"honeycombSettings": {
"showHive": true,
"showLabels": false,
"showLegend": true
},
"rules": [
{
"matcher": "A:",
"properties": {
"color": "DEFAULT"
},
"seriesOverrides": []
}
],
"tableSettings": {
"isThresholdBackgroundAppliedToCell": false
},
"thresholds": [
{
"axisTarget": "LEFT",
"queryId": "",
"rules": [
{
"color": "#7dc540"
},
{
"color": "#f5d30f"
},
{
"color": "#dc172a"
}
],
"visible": true
}
],
"type": "HONEYCOMB"
}
})
bounds {
height = 304
left = 0
top = 38
width = 304
}
filter {
management_zone {
name = "CD_VDLM_scallservice"
id = "4595690812423012030"
}
}
}
tile {
name = "VDLM_scallservice - VDLM_scallservice - ifs-002 (JOYNR) notifyMaintenanceStatus - IN - prod"
assigned_entities = [ "SERVICE-8CFCE6C843EE0A3F" ]
configured = true
tile_type = "SERVICE_VERSATILE"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 342
left = 0
top = 342
width = 1216
}
}
tile {
name = "postgres"
assigned_entities = [ "SERVICE-BEA24C1EEE574072" ]
configured = true
tile_type = "DATABASE"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 152
left = 304
top = 38
width = 304
}
}
tile {
name = "Service health"
chart_visible = true
configured = true
tile_type = "SERVICES"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 304
left = 1102
top = 38
width = 304
}
filter {
management_zone {
name = "CD_VDLM_scallservice"
id = "4595690812423012030"
}
}
}
tile {
name = "Service Health"
configured = true
custom_name = "Service Health"
tile_type = "DATA_EXPLORER"
unknowns = jsonencode({
"isAutoRefreshDisabled": false,
"metricExpressions": [],
"queries": [],
"visualConfig": {
"axes": {
"xAxis": {
"visible": true
},
"yAxes": []
},
"global": {},
"rules": [],
"thresholds": [],
"type": "HONEYCOMB"
}
})
bounds {
height = 304
left = 1520
top = 38
width = 304
}
}
}
# DEFINE dynatrace_dashboard_sharing.CD_VDLM_CBS_Demands.id = d11480b8-dad1-4ef0-a365-3c7e94f98a83
resource "dynatrace_dashboard_sharing" "CD_VDLM_CBS_Demands" {
# enabled = false
dashboard_id = dynatrace_dashboard.CD_VDLM_CBS_Demands.id
# preset = false
permissions {
permission {
type = "ALL"
level = "VIEW"
}
}
}

View File

@ -0,0 +1,337 @@
# DEFINE dynatrace_dashboard.CD_VDLM_orp_Training2_crp_PROD.id = 6aa4ba33-21b5-486d-b255-ee4689d87b87
data "dynatrace_management_zone" "CD_VDLM_orp_Training2_crp_PROD"{ name="CD_VDLM" }
resource "dynatrace_dashboard" "CD_VDLM_orp_Training2_crp_PROD" {
dashboard_metadata {
name = "CD_VDLM (Training2) PROD"
owner = "Bernd.Brandl@bmw.de"
# preset = false
# shared = false
tags = [ "CD_VDLM_rtchandler" ]
filter {
timeframe = "-24h to now"
management_zone {
name = "CD_VDLM"
id = data.dynatrace_management_zone.CD_VDLM_orp_Training2_crp_PROD.id
}
}
}
tile {
name = "Custom chart"
configured = true
tile_type = "CUSTOM_CHARTING"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 304
left = 38
top = 228
width = 1064
}
filter_config {
type = "MIXED"
custom_name = "Failure rate (HTTP 4xx/5xx errors)"
default_name = "Custom chart"
chart_config {
type = "TIMESERIES"
legend = true
result_metadata {
config {
custom_color = "#ff0000"
key = "nullbuiltin:service.errors.fivexx.rate|AVG|TOTAL|BAR|SERVICE"
last_modified = 1617956393463
}
config {
custom_color = "#fff29a"
key = "nullbuiltin:service.errors.fourxx.rate|AVG|TOTAL|BAR|SERVICE"
last_modified = 1617956441725
}
}
series {
type = "BAR"
aggregation = "AVG"
aggregation_rate = "TOTAL"
entity_type = "SERVICE"
metric = "builtin:service.errors.fourxx.rate"
# sort_ascending = false
# sort_column = false
}
series {
type = "BAR"
aggregation = "AVG"
aggregation_rate = "TOTAL"
entity_type = "SERVICE"
metric = "builtin:service.errors.fivexx.rate"
# sort_ascending = false
sort_column = true
}
}
filters {
filter {
entity_type = "SERVICE"
match {
key = "AUTO_TAGS"
values = [ "Environment:PROD" ]
}
}
}
}
}
tile {
name = "Problems"
configured = true
tile_type = "OPEN_PROBLEMS"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 152
left = 950
top = 38
width = 152
}
}
tile {
name = "Overall Health"
configured = true
tile_type = "HEADER"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 38
left = 38
top = 0
width = 1064
}
filter {
management_zone {
name = "CD_VDLM_rtchandler"
id = "-3831743600975224830"
}
}
}
tile {
name = "Markdown"
configured = true
markdown =<<-EOT
---
EOT
tile_type = "MARKDOWN"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 38
left = 38
top = 532
width = 1064
}
}
tile {
name = "Custom chart"
configured = true
tile_type = "CUSTOM_CHARTING"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 304
left = 38
top = 570
width = 1064
}
filter_config {
type = "MIXED"
custom_name = "Response time, Request Count and Number of Errors"
default_name = "Custom chart"
chart_config {
type = "TIMESERIES"
legend = true
result_metadata {
config {
custom_color = "#008cdb"
key = "nullbuiltin:service.requestCount.total|NONE|TOTAL|BAR|SERVICE"
last_modified = 1595275720776
}
config {
custom_color = "#b4e5f9"
key = "nullbuiltin:service.response.time|AVG|TOTAL|LINE|SERVICE"
last_modified = 1595275686773
}
config {
custom_color = "#ef651f"
key = "nullbuiltin:service.errors.total.count|NONE|TOTAL|BAR|SERVICE"
last_modified = 1595275955999
}
}
series {
type = "LINE"
aggregation = "AVG"
aggregation_rate = "TOTAL"
entity_type = "SERVICE"
metric = "builtin:service.response.time"
# sort_ascending = false
# sort_column = false
}
series {
type = "BAR"
aggregation = "NONE"
aggregation_rate = "TOTAL"
entity_type = "SERVICE"
metric = "builtin:service.requestCount.total"
# sort_ascending = false
# sort_column = false
}
series {
type = "BAR"
aggregation = "NONE"
aggregation_rate = "TOTAL"
entity_type = "SERVICE"
metric = "builtin:service.errors.total.count"
# sort_ascending = false
sort_column = true
}
}
filters {
filter {
entity_type = "SERVICE"
match {
key = "AUTO_TAGS"
values = [ "Environment:PROD" ]
}
}
}
}
}
tile {
name = "Markdown"
configured = true
markdown =<<-EOT
---
EOT
tile_type = "MARKDOWN"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 38
left = 38
top = 190
width = 1064
}
}
tile {
name = ""
chart_visible = true
configured = true
tile_type = "DATABASES_OVERVIEW"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 152
left = 646
top = 38
width = 190
}
filter_config {
type = "DATABASE"
custom_name = "Databases"
default_name = "Databases"
chart_config {
type = "TIMESERIES"
legend = true
}
filters {
filter {
entity_type = "DATABASE"
match {
key = "AUTO_TAGS"
values = [ "Environment:PROD" ]
}
}
}
}
}
tile {
name = ""
chart_visible = true
configured = true
tile_type = "SERVICES"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 152
left = 342
top = 38
width = 190
}
filter_config {
type = "SERVICE"
custom_name = "Services"
default_name = "Services"
chart_config {
type = "TIMESERIES"
legend = true
}
filters {
filter {
entity_type = "SERVICE"
match {
key = "AUTO_TAGS"
values = [ "Environment:PROD" ]
}
}
}
}
}
tile {
name = ""
chart_visible = true
configured = true
tile_type = "HOSTS"
unknowns = jsonencode({
"isAutoRefreshDisabled": false
})
bounds {
height = 152
left = 38
top = 38
width = 190
}
filter_config {
type = "HOST"
custom_name = "Hosts"
default_name = "Hosts"
chart_config {
type = "TIMESERIES"
legend = true
}
filters {
filter {
entity_type = "HOST"
match {
key = "AUTO_TAGS"
values = [ "Environment:PROD" ]
}
}
}
}
}
}
# DEFINE dynatrace_dashboard_sharing.CD_VDLM_orp_Training2_crp_PROD.id = 6aa4ba33-21b5-486d-b255-ee4689d87b87
resource "dynatrace_dashboard_sharing" "CD_VDLM_orp_Training2_crp_PROD" {
# enabled = false
dashboard_id = dynatrace_dashboard.CD_VDLM_orp_Training2_crp_PROD.id
# preset = false
permissions {
permission {
type = "ALL"
level = "VIEW"
}
}
}

View File

@ -0,0 +1,28 @@
# DEFINE dynatrace_management_zone.CD_VDLM.id = 8293591792367801898
resource "dynatrace_management_zone" "CD_VDLM" {
name = "CD_VDLM"
entity_selector_based_rule {
enabled = true
selector =<<-EOT
type(PROCESS_GROUP_INSTANCE),tag("compass-id:scallservice","compass-id:ts-asc","compass-id:seam","compass-id:rtchandler","compass-id:ts-mbike-di","compass-id:tsbgservice","compass-id:ts-sdi","compass-id:ts-ccm-di","compass-id:ts-base-ffs","compass-id:ts-asc","compass-id:ts-customer-adapter","compass-id:ts-lead-demand-api","compass-id:tsdd","compass-id:tscs","compass-id:ts-cts-ui","compass-id:rsurservice","compass-id:ttbs","compass-id:ts-tyrewf","compass-id:ts-tyredi","compass-id:ts-tyrews","compass-id:ts-tyrewt","compass-id:tssb-bt","compass-id:tssb-bti","compass-id:tssb-tsp","compass-id:ts-pffs","compass-id:pdmmanager","compass-id:pdmupdater","compass-id:wlmanager","compass-id:wlupdater","compass-id:ts-ena-ui","compass-id:tsrd","compass-id:diagservice","compass-id:ts-bcallhandler","compass-id:cas-spm","compass-id:cas-stm","compass-id:eshad","compass-id:patchcampaign","compass-id:rtcservice","compass-id:rtcad","compass-id:ts-pat-ui","compass-id:ts-rtc-ui")
EOT
}
entity_selector_based_rule {
enabled = true
selector =<<-EOT
type(HOST),tag("compass-id:scallservice","compass-id:ts-asc","compass-id:seam","compass-id:rtchandler","compass-id:ts-mbike-di","compass-id:tsbgservice","compass-id:ts-sdi","compass-id:ts-ccm-di","compass-id:ts-base-ffs","compass-id:ts-asc","compass-id:ts-customer-adapter","compass-id:ts-lead-demand-api","compass-id:tsdd","compass-id:tscs","compass-id:ts-cts-ui","compass-id:rsurservice","compass-id:ttbs","compass-id:ts-tyrewf","compass-id:ts-tyredi","compass-id:ts-tyrews","compass-id:ts-tyrewt","compass-id:tssb-bt","compass-id:tssb-bti","compass-id:tssb-tsp","compass-id:ts-pffs","compass-id:pdmmanager","compass-id:pdmupdater","compass-id:wlmanager","compass-id:wlupdater","compass-id:ts-ena-ui","compass-id:tsrd","compass-id:diagservice","compass-id:ts-bcallhandler","compass-id:cas-spm","compass-id:cas-stm","compass-id:eshad","compass-id:patchcampaign","compass-id:rtcservice","compass-id:rtcad","compass-id:ts-pat-ui","compass-id:ts-rtc-ui")
EOT
}
entity_selector_based_rule {
enabled = true
selector =<<-EOT
type(SERVICE),tag("compass-id:scallservice","compass-id:ts-asc","compass-id:seam","compass-id:rtchandler","compass-id:ts-mbike-di","compass-id:tsbgservice","compass-id:ts-sdi","compass-id:ts-ccm-di","compass-id:ts-base-ffs","compass-id:ts-asc","compass-id:ts-customer-adapter","compass-id:ts-lead-demand-api","compass-id:tsdd","compass-id:tscs","compass-id:ts-cts-ui","compass-id:rsurservice","compass-id:ttbs","compass-id:ts-tyrewf","compass-id:ts-tyredi","compass-id:ts-tyrews","compass-id:ts-tyrewt","compass-id:tssb-bt","compass-id:tssb-bti","compass-id:tssb-tsp","compass-id:ts-pffs","compass-id:pdmmanager","compass-id:pdmupdater","compass-id:wlmanager","compass-id:wlupdater","compass-id:ts-ena-ui","compass-id:tsrd","compass-id:diagservice","compass-id:ts-bcallhandler","compass-id:cas-spm","compass-id:cas-stm","compass-id:eshad","compass-id:patchcampaign","compass-id:rtcservice","compass-id:rtcad","compass-id:ts-pat-ui","compass-id:ts-rtc-ui"),not(entityName.contains("HealthResource")),not(entityName.contains("PingResource")),not(entityName.contains("StatusResource")),not(entityName.contains("PrometheusResource"))
EOT
}
entity_selector_based_rule {
enabled = true
selector =<<-EOT
type(SERVICE),databaseName.exists(),toRelationship.calls(type(SERVICE),tag("compass-id:scallservice","compass-id:ts-asc","compass-id:seam","compass-id:rtchandler","compass-id:ts-mbike-di","compass-id:tsbgservice","compass-id:ts-sdi","compass-id:ts-ccm-di","compass-id:ts-base-ffs","compass-id:ts-asc","compass-id:ts-customer-adapter","compass-id:ts-lead-demand-api","compass-id:tsdd","compass-id:tscs","compass-id:ts-cts-ui","compass-id:rsurservice","compass-id:ttbs","compass-id:ts-tyrewf","compass-id:ts-tyredi","compass-id:ts-tyrews","compass-id:ts-tyrewt","compass-id:tssb-bt","compass-id:tssb-bti","compass-id:tssb-tsp","compass-id:ts-pffs","compass-id:pdmmanager","compass-id:pdmupdater","compass-id:wlmanager","compass-id:wlupdater","compass-id:ts-ena-ui","compass-id:tsrd","compass-id:diagservice","compass-id:ts-bcallhandler","compass-id:cas-spm","compass-id:cas-stm","compass-id:eshad","compass-id:patchcampaign","compass-id:rtcservice","compass-id:rtcad","compass-id:ts-pat-ui","compass-id:ts-rtc-ui"))
EOT
}
}