Created
March 5, 2019 15:48
-
-
Save charlesbaer/f379999ec1201320af2503fca8a5df37 to your computer and use it in GitHub Desktop.
Stackdriver Alerting Policies configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "google" { | |
project = "abab-cdcd-023991" | |
region = "us-central1" | |
zone = "us-central1-c" | |
} | |
locals { | |
email0_id = "projects/abab-cdcd-023991/notificationChannels/11497409249297891355", | |
email1_id = "projects/abab-cdcd-023991/notificationChannels/12532464389112270325" | |
} | |
resource "google_monitoring_alert_policy" "alert_policy0" { | |
display_name = "1 - Availability - Google Cloud HTTP/S Load Balancing Rule - Request count (filtered) [COUNT]" | |
combiner = "OR" | |
conditions { | |
display_name = "Google Cloud HTTP/S Load Balancing Rule - Request count (filtered) [COUNT]" | |
condition_threshold { | |
filter = "metric.type=\"loadbalancing.googleapis.com/https/request_count\" resource.type=\"https_lb_rule\" metric.label.response_code!=\"200\"" | |
duration = "60s" | |
comparison = "COMPARISON_GT" | |
threshold_value = 1 | |
trigger { | |
count = 1 | |
} | |
aggregations { | |
alignment_period = "60s" | |
per_series_aligner = "ALIGN_RATE" | |
cross_series_reducer = "REDUCE_COUNT" | |
} | |
} | |
} | |
documentation { | |
content = "The load balancer rule $${condition.display_name} has generated this alert for the $${metric.display_name}." | |
} | |
notification_channels = [ | |
"${local.email0_id}", | |
"${local.email1_id}", | |
] | |
} | |
resource "google_monitoring_alert_policy" "alert_policy1" { | |
display_name = "2 - Latency - Google Cloud HTTP/S Load Balancing Rule - Total Latency (filtered) [99 percentile]" | |
combiner = "OR" | |
conditions { | |
display_name = "Google Cloud HTTP/S Load Balancing Rule - Total Latency (filtered) [99 percentile]" | |
condition_threshold { | |
filter = "metric.type=\"loadbalancing.googleapis.com/https/total_latencies\" resource.type=\"https_lb_rule\" resource.label.url_map_name=\"web-map\"" | |
duration = "60s" | |
comparison = "COMPARISON_GT" | |
threshold_value = 100 | |
trigger { | |
count = 1 | |
} | |
aggregations { | |
alignment_period = "60s" | |
per_series_aligner = "ALIGN_PERCENTILE_99" | |
} | |
} | |
} | |
documentation { | |
content = "The load balancer rule $${condition.display_name} has generated this alert for the $${metric.display_name}." | |
} | |
notification_channels = [ | |
"${local.email0_id}", | |
"${local.email1_id}", | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good help man.