@@ -4,14 +4,14 @@ locals {
44 monitor_warn_default_priority = null
55 monitor_nodata_default_priority = null
66
7- title_prefix = " ${ var . title_prefix == null ? " " : " [${ var . title_prefix } ]" } [ ${ var . env } ] "
7+ title_prefix = " ${ var . title_prefix == null ? " " : " [${ var . title_prefix } ]" } "
88 title_suffix = var. title_suffix == null ? " " : " (${ var . title_suffix } )"
99}
1010
1111resource "datadog_monitor" "http_5xx_responses" {
1212 count = var. http_5xx_responses_enabled ? 1 : 0
1313
14- name = join (" " , [local . title_prefix , " ALB 5xx Responses - {{host .name}}" , local . title_suffix ])
14+ name = join (" " , [local . title_prefix , " ALB 5xx Responses - {{loadbalancer .name}}" , local . title_suffix ])
1515 include_tags = true
1616 message = local. query_alert_base_message
1717 tags = concat (local. common_tags , var. base_tags , var. additional_tags )
@@ -27,8 +27,8 @@ resource "datadog_monitor" "http_5xx_responses" {
2727
2828 query = << END
2929 min(${ var . http_5xx_responses_evaluation_window } ):
30- default(avg:aws.applicationelb.httpcode_elb_5xx${ local . query_filter } by {loadbalancer,region,aws_account }.as_rate(), 0) / (
31- default(avg:aws.applicationelb.request_count${ local . query_filter } by {loadbalancer,region,aws_account }.as_rate(), 1)
30+ default(avg:aws.applicationelb.httpcode_elb_5xx${ local . query_filter } by {aws_account,env, loadbalancer,region}.as_rate(), 0) / (
31+ default(avg:aws.applicationelb.request_count${ local . query_filter } by {aws_account,env, loadbalancer,region}.as_rate(), 1)
3232 ) * 100 > ${ var . http_5xx_responses_threshold_critical }
3333END
3434
4141resource "datadog_monitor" "http_5xx_tg_responses" {
4242 count = var. http_5xx_tg_responses_enabled ? 1 : 0
4343
44- name = join (" " , [local . title_prefix , " ALB Target Group 5xx Responses - {{host .name}}" , local . title_suffix ])
44+ name = join (" " , [local . title_prefix , " ALB Target Group 5xx Responses - {{loadbalancer .name}}" , local . title_suffix ])
4545 include_tags = true
4646 message = local. query_alert_base_message
4747 tags = concat (local. common_tags , var. base_tags , var. additional_tags )
@@ -57,8 +57,8 @@ resource "datadog_monitor" "http_5xx_tg_responses" {
5757
5858 query = << END
5959 min(${ var . http_5xx_tg_responses_evaluation_window } ):
60- default(avg:aws.applicationelb.httpcode_elb_5xx${ local . query_filter } by {loadbalancer,region,aws_account,targetgroup}.as_rate(), 0) / (
61- default(avg:aws.applicationelb.request_count${ local . query_filter } by {loadbalancer,region,aws_account,targetgroup}.as_rate(), 1)
60+ default(avg:aws.applicationelb.httpcode_elb_5xx${ local . query_filter } by {loadbalancer,region,aws_account,targetgroup,env }.as_rate(), 0) / (
61+ default(avg:aws.applicationelb.request_count${ local . query_filter } by {loadbalancer,region,aws_account,targetgroup,env }.as_rate(), 1)
6262 ) * 100 > ${ var . http_5xx_tg_responses_threshold_critical }
6363END
6464
7272resource "datadog_monitor" "latency" {
7373 count = var. latency_enabled ? 1 : 0
7474
75- name = join (" " , [local . title_prefix , " ALB latency - {{host.name}} " , local . title_suffix ])
75+ name = join (" " , [local . title_prefix , " {{loadbalancer.name}} ALB latency - {{value}}s " , local . title_suffix ])
7676 include_tags = true
7777 message = local. query_alert_base_message
7878 tags = concat (local. common_tags , var. base_tags , var. additional_tags )
@@ -88,7 +88,7 @@ resource "datadog_monitor" "latency" {
8888
8989 query = << END
9090 avg(${ var . latency_evaluation_window } ):
91- default(avg:aws.applicationelb.target_response_time.average${ local . query_filter } by {loadbalancer,region,aws_account }, 0
91+ default(avg:aws.applicationelb.target_response_time.average${ local . query_filter } by {aws_account,env, loadbalancer,region}, 0
9292 ) > ${ var . latency_threshold_critical }
9393END
9494
101101resource "datadog_monitor" "no_healthy_instances" {
102102 count = var. no_healthy_instances_enabled ? 1 : 0
103103
104- name = join (" " , [local . title_prefix , " ALB healthy instances - {{host.name}} " , local . title_suffix ])
104+ name = join (" " , [local . title_prefix , " {{loadbalancer.name}} ALB healthy instances is at {{value}}% " , local . title_suffix ])
105105 include_tags = true
106106 message = local. query_alert_base_message
107107 tags = concat (local. common_tags , var. base_tags , var. additional_tags )
@@ -117,10 +117,10 @@ resource "datadog_monitor" "no_healthy_instances" {
117117
118118 query = << END
119119 min(${ var . no_healthy_instances_evaluation_window } ): (
120- sum:aws.applicationelb.healthy_host_count.minimum${ local . query_filter } by {loadbalancer, region,aws_account } / (
121- sum:aws.applicationelb.healthy_host_count.minimum${ local . query_filter } by {loadbalancer, region,aws_account } +
122- sum:aws.applicationelb.un_healthy_host_count.maximum${ local . query_filter } by {loadbalancer, region,aws_account } )
123- ) <= ${ var . no_healthy_instances_threshold_critical }
120+ sum:aws.applicationelb.healthy_host_count.minimum${ local . query_filter } by {aws_account,env, region,loadbalancer } / (
121+ sum:aws.applicationelb.healthy_host_count.minimum${ local . query_filter } by {aws_account,env, region,loadbalancer } +
122+ sum:aws.applicationelb.un_healthy_host_count.maximum${ local . query_filter } by {aws_account,env, region,loadbalancer } )
123+ ) * 100 <= ${ var . no_healthy_instances_threshold_critical }
124124END
125125
126126 monitor_thresholds {
0 commit comments