Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions aws/elasticache/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ resource "datadog_monitor" "cpu_utilization" {

query = <<END
avg(${var.cpu_utilization_evaluation_window}):
avg:aws.elasticache.cpuutilization${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}
avg:aws.elasticache.cpuutilization${local.query_filter} by {${var.query_organize_by_fields}}
>= ${var.cpu_utilization_threshold_critical}
END

Expand Down Expand Up @@ -56,7 +56,7 @@ resource "datadog_monitor" "cpu_utilization_anomaly" {

query = <<END
avg(${var.cpu_utilization_evaluation_window}):anomalies(
avg:aws.elasticache.cpuutilization${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}, 'agile', ${var.cpu_utilization_anomaly_deviations},
avg:aws.elasticache.cpuutilization${local.query_filter} by {${var.query_organize_by_fields}}, 'agile', ${var.cpu_utilization_anomaly_deviations},
direction='above', count_default_zero='true', interval=${var.cpu_utilization_anomaly_rollup},
seasonality='${var.cpu_utilization_anomaly_seasonality}'
) >= ${var.cpu_utilization_anomaly_threshold_critical}
Expand Down Expand Up @@ -86,7 +86,7 @@ resource "datadog_monitor" "evictions" {

query = <<END
sum(${var.evictions_evaluation_window}): (
avg:aws.elasticache.evictions${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}
avg:aws.elasticache.evictions${local.query_filter} by {${var.query_organize_by_fields}}
) >= ${var.evictions_threshold_critical}
END

Expand Down Expand Up @@ -115,7 +115,7 @@ resource "datadog_monitor" "hit_rate" {

query = <<END
max(${var.hit_rate_evaluation_window}):(
avg:aws.elasticache.cache_hit_rate${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}
avg:aws.elasticache.cache_hit_rate${local.query_filter} by {${var.query_organize_by_fields}}
) >= ${var.hit_rate_threshold_critical}
END

Expand Down Expand Up @@ -144,7 +144,7 @@ resource "datadog_monitor" "hit_rate_anomaly" {

query = <<END
avg(${var.hit_rate_evaluation_window}):anomalies(
avg:aws.elasticache.cache_hit_rate${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}, 'agile', ${var.hit_rate_anomaly_deviations},
avg:aws.elasticache.cache_hit_rate${local.query_filter} by {${var.query_organize_by_fields}}, 'agile', ${var.hit_rate_anomaly_deviations},
direction='below', count_default_zero='true',
seasonality='${var.hit_rate_anomaly_seasonality}'
) >= ${var.hit_rate_anomaly_threshold_critical}
Expand Down Expand Up @@ -174,7 +174,7 @@ resource "datadog_monitor" "max_connections" {

query = <<END
max(${var.max_connections_evaluation_window}):(
avg:aws.elasticache.curr_connections${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}
avg:aws.elasticache.curr_connections${local.query_filter} by {${var.query_organize_by_fields}}
) >= ${var.max_connections_threshold_critical}
END

Expand Down Expand Up @@ -203,7 +203,7 @@ resource "datadog_monitor" "swap_usage" {

query = <<END
max(${var.swap_usage_evaluation_window}):(
avg:aws.elasticache.swap_usage${local.query_filter} by {cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed}
avg:aws.elasticache.swap_usage${local.query_filter} by {${var.query_organize_by_fields}}
) <= ${var.swap_usage_threshold_critical}
END

Expand Down
5 changes: 5 additions & 0 deletions aws/elasticache/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ variable "base_tags" {
type = list(string)
}

variable "query_organize_by_fields" {
default = "cachenodeid,cacheclusterid,region,aws_account,env,datadog_managed"
description = "Fields (in order) by which to organize the results of the monitor queries for this module. An example modification would be to add replication_group to the front of the default value."
}

########################################
# Node CPU Utilization
########################################
Expand Down
Loading