upgrade monitoring tests to 0.12 syntax (#2754)

<!-- This change is generated by MagicModules. -->
/cc @chrisst
This commit is contained in:
The Magician 2018-12-26 15:44:30 -08:00 committed by Chris Stephens
parent e55e6a403f
commit 4a706f7225
4 changed files with 68 additions and 77 deletions

View File

@ -120,24 +120,20 @@ resource "google_monitoring_alert_policy" "basic" {
enabled = true enabled = true
combiner = "OR" combiner = "OR"
conditions = [ conditions {
{ display_name = "%s"
display_name = "%s"
condition_threshold = { condition_threshold {
aggregations = [ aggregations {
{ alignment_period = "60s"
alignment_period = "60s" per_series_aligner = "%s"
per_series_aligner = "%s"
},
]
duration = "60s"
comparison = "COMPARISON_GT"
filter = "%s"
} }
},
] duration = "60s"
comparison = "COMPARISON_GT"
filter = "%s"
}
}
} }
`, alertName, conditionName, aligner, filter) `, alertName, conditionName, aligner, filter)
} }
@ -149,66 +145,61 @@ resource "google_monitoring_alert_policy" "full" {
combiner = "OR" combiner = "OR"
enabled = true enabled = true
conditions = [ conditions {
{ display_name = "%s"
display_name = "%s"
condition_threshold = { condition_threshold {
threshold_value = 50 threshold_value = 50
filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""
duration = "60s"
comparison = "COMPARISON_GT"
aggregations = [ aggregations {
{ alignment_period = "60s"
alignment_period = "60s" per_series_aligner = "ALIGN_RATE"
per_series_aligner = "ALIGN_RATE" cross_series_reducer = "REDUCE_MEAN"
cross_series_reducer = "REDUCE_MEAN"
group_by_fields = [ group_by_fields = [
"metric.label.device_name", "metric.label.device_name",
"project", "project",
"resource.label.instance_id", "resource.label.instance_id",
"resource.label.zone", "resource.label.zone",
]
},
] ]
duration = "60s"
comparison = "COMPARISON_GT"
trigger = {
percent = 10
}
filter = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""
}
},
{
condition_absent {
duration = "3600s"
filter = "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" AND resource.type=\"gce_instance\""
aggregations {
alignment_period = "60s"
cross_series_reducer = "REDUCE_MEAN"
per_series_aligner = "ALIGN_MEAN"
group_by_fields = [
"project",
"resource.label.instance_id",
"resource.label.zone",
]
}
trigger {
count = 1
}
} }
display_name = "%s" trigger {
}, percent = 10
] }
}
}
conditions {
display_name = "%s"
condition_absent {
duration = "3600s"
filter = "metric.type=\"compute.googleapis.com/instance/cpu/utilization\" AND resource.type=\"gce_instance\""
aggregations {
alignment_period = "60s"
cross_series_reducer = "REDUCE_MEAN"
per_series_aligner = "ALIGN_MEAN"
group_by_fields = [
"project",
"resource.label.instance_id",
"resource.label.zone",
]
}
trigger {
count = 1
}
}
}
documentation { documentation {
content = "test content" content = "test content"
mime_type = "text/markdown" mime_type = "text/markdown"
} }
} }

View File

@ -49,7 +49,7 @@ resource "google_monitoring_uptime_check_config" "http" {
display_name = "http-uptime-check-%s" display_name = "http-uptime-check-%s"
timeout = "60s" timeout = "60s"
http_check = { http_check {
path = "/some-path" path = "/some-path"
port = "8010" port = "8010"
} }
@ -62,7 +62,7 @@ resource "google_monitoring_uptime_check_config" "http" {
} }
} }
content_matchers = { content_matchers {
content = "example" content = "example"
} }
} }
@ -96,7 +96,7 @@ resource "google_monitoring_uptime_check_config" "tcp_group" {
display_name = "tcp-uptime-check-%s" display_name = "tcp-uptime-check-%s"
timeout = "60s" timeout = "60s"
tcp_check = { tcp_check {
port = 888 port = 888
} }

View File

@ -45,10 +45,10 @@ resource "google_monitoring_uptime_check_config" "http" {
display_name = "http-uptime-check-%s" display_name = "http-uptime-check-%s"
timeout = "60s" timeout = "60s"
http_check = { http_check {
path = "/%s" path = "/%s"
port = "8010" port = "8010"
auth_info = { auth_info {
username = "name" username = "name"
password = "%s" password = "%s"
} }
@ -62,7 +62,7 @@ resource "google_monitoring_uptime_check_config" "http" {
} }
} }
content_matchers = { content_matchers {
content = "example" content = "example"
} }
} }

View File

@ -43,7 +43,7 @@ resource "google_monitoring_uptime_check_config" "http" {
display_name = "http-uptime-check" display_name = "http-uptime-check"
timeout = "60s" timeout = "60s"
http_check = { http_check {
path = "/some-path" path = "/some-path"
port = "8010" port = "8010"
} }
@ -56,7 +56,7 @@ resource "google_monitoring_uptime_check_config" "http" {
} }
} }
content_matchers = { content_matchers {
content = "example" content = "example"
} }
} }
@ -74,7 +74,7 @@ resource "google_monitoring_uptime_check_config" "tcp_group" {
display_name = "tcp-uptime-check" display_name = "tcp-uptime-check"
timeout = "60s" timeout = "60s"
tcp_check = { tcp_check {
port = 888 port = 888
} }