diff --git a/database/elasticsearch/modules.tf b/database/elasticsearch/modules.tf new file mode 100644 index 0000000..9b9328e --- /dev/null +++ b/database/elasticsearch/modules.tf @@ -0,0 +1,8 @@ +module "filter-tags" { + source = "../../common/filter-tags" + + environment = "${var.environment}" + resource = "elasticsearch" + filter_tags_use_defaults = "${var.filter_tags_use_defaults}" + filter_tags_custom = "${var.filter_tags_custom}" +} diff --git a/database/elasticsearch/monitors-elasticsearch.tf b/database/elasticsearch/monitors-elasticsearch.tf index 6c94622..76f3ea8 100644 --- a/database/elasticsearch/monitors-elasticsearch.tf +++ b/database/elasticsearch/monitors-elasticsearch.tf @@ -1,11 +1,3 @@ -data "template_file" "filter" { - template = "$${filter}" - - vars { - filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}" - } -} - # # Cluster Status Not Green # @@ -17,7 +9,7 @@ resource "datadog_monitor" "cluster_status_not_green" { query = < ${var.cluster_initializing_shards_threshold_critical} EOF @@ -100,7 +92,7 @@ resource "datadog_monitor" "cluster_relocating_shards" { query = < ${var.cluster_relocating_shards_threshold_critical} EOF @@ -141,7 +133,7 @@ resource "datadog_monitor" "cluster_unassigned_shards" { query = < ${var.cluster_unassigned_shards_threshold_critical} EOF @@ -182,9 +174,9 @@ resource "datadog_monitor" "node_free_space" { query = < ${var.jvm_heap_memory_usage_threshold_critical} EOF @@ -267,7 +259,7 @@ resource "datadog_monitor" "jvm_memory_young_usage" { query = < ${var.jvm_memory_young_usage_threshold_critical} EOF @@ -308,7 +300,7 @@ resource "datadog_monitor" "jvm_memory_old_usage" { query = < ${var.jvm_memory_old_usage_threshold_critical} EOF @@ -349,7 +341,7 @@ resource "datadog_monitor" "jvm_gc_old_collection_latency" { query = < ${var.jvm_gc_old_collection_latency_threshold_critical} EOF @@ -390,7 +382,7 @@ resource "datadog_monitor" "jvm_gc_young_collection_latency" { query = < ${var.jvm_gc_young_collection_latency_threshold_critical} EOF @@ -432,7 +424,7 @@ resource "datadog_monitor" "indexing_latency" { // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.indexing_latency_threshold_critical} EOF @@ -474,7 +466,7 @@ resource "datadog_monitor" "flush_latency" { // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.flush_latency_threshold_critical} EOF @@ -515,7 +507,7 @@ resource "datadog_monitor" "http_connections_anomaly" { query = < ${var.search_query_latency_threshold_critical} EOF @@ -607,7 +599,7 @@ resource "datadog_monitor" "fetch_latency" { // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.fetch_latency_threshold_critical} EOF @@ -648,7 +640,7 @@ resource "datadog_monitor" "search_query_change" { query = <= ${var.search_query_change_threshold_critical} EOF @@ -689,7 +681,7 @@ resource "datadog_monitor" "fetch_change" { query = <= ${var.fetch_change_threshold_critical} EOF @@ -731,7 +723,7 @@ resource "datadog_monitor" "field_data_evictions_change" { // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.field_data_evictions_change_threshold_critical} EOF @@ -773,7 +765,7 @@ resource "datadog_monitor" "query_cache_evictions_change" { // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.query_cache_evictions_change_threshold_critical} EOF @@ -815,7 +807,7 @@ resource "datadog_monitor" "request_cache_evictions_change" { // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.request_cache_evictions_change_threshold_critical} EOF @@ -856,7 +848,7 @@ resource "datadog_monitor" "task_time_in_queue_change" { query = < ${var.task_time_in_queue_change_threshold_critical} EOF @@ -894,7 +886,7 @@ resource "datadog_monitor" "not_responding" { message = "${coalesce(var.not_responding_message, var.message)}" query = <