From 67b3580d7fe8043baada4fc6898b1712bf8d04fb Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 3 Jul 2019 18:22:24 +0200 Subject: [PATCH] MON-459 apply hack for fmt --- caas/kubernetes/ark/monitors-ark.tf | 18 +- .../cluster/monitors-k8s-cluster.tf | 16 +- .../ingress/vts/monitors-ingress.tf | 56 +- caas/kubernetes/node/monitors-k8s-node.tf | 226 ++++---- caas/kubernetes/pod/monitors-k8s-pod.tf | 52 +- .../workload/monitors-k8s-workload.tf | 106 ++-- cloud/aws/alb/monitors-alb.tf | 132 ++--- cloud/aws/apigateway/monitors-api.tf | 80 +-- .../common/monitors-elasticache.tf | 136 ++--- .../memcached/monitors-memcached.tf | 56 +- cloud/aws/elasticache/redis/monitors-redis.tf | 88 ++-- .../elasticsearch/monitors-elasticsearch.tf | 92 ++-- cloud/aws/elb/monitors-elb.tf | 152 +++--- .../monitors-kinesis-firehose.tf | 16 +- .../aurora/mysql/monitors-rds-aurora-mysql.tf | 16 +- .../monitors-rds-aurora-postgresql.tf | 16 +- cloud/aws/rds/common/monitors-rds-common.tf | 86 ++-- cloud/aws/vpn/monitors-vpn.tf | 14 +- .../monitors-azure-apimanagement.tf | 112 ++-- .../app-services/monitors-app_services.tf | 128 ++--- .../azure-search/monitors-azure-search.tf | 48 +- cloud/azure/cosmosdb/monitors-cosmosdb.tf | 96 ++-- .../datalakestore/monitors-datalakestore.tf | 16 +- cloud/azure/eventgrid/monitors-eventgrid.tf | 90 ++-- cloud/azure/eventhub/monitors-eventhub.tf | 90 ++-- cloud/azure/functions/monitors-functions.tf | 80 +-- cloud/azure/iothubs/monitors-iothubs.tf | 330 ++++++------ cloud/azure/keyvault/monitors-keyvault.tf | 90 ++-- .../load-balancer/monitors-load-balancer.tf | 16 +- cloud/azure/mysql/monitors-mysql.tf | 96 ++-- .../azure/postgresql/monitors-postegresql.tf | 106 ++-- cloud/azure/redis/monitors-azure-redis.tf | 94 ++-- .../serverfarms/monitors-azure-serverfarms.tf | 90 ++-- .../azure/servicebus/monitors-service-bus.tf | 86 ++-- .../sql-database/monitors-sql-database.tf | 110 ++-- .../monitors-sql-elasticpool.tf | 92 ++-- cloud/azure/storage/monitors-azure-storage.tf | 210 ++++---- .../monitors-stream-analytics.tf | 112 ++-- .../monitors-virtual-machine.tf | 90 ++-- cloud/gcp/big-query/monitors-big-query.tf | 210 ++++---- .../common/monitors-cloud-sql-common.tf | 158 +++--- .../mysql/monitors-cloudsql-mysql.tf | 18 +- .../gcp/gce/instance/monitors-gce-instance.tf | 92 ++-- cloud/gcp/lb/monitors-lb.tf | 114 ++-- cloud/gcp/pubsub/monitors-pubsub.tf | 54 +- common/alerting-message/main.tf | 8 +- .../elasticsearch/monitors-elasticsearch.tf | 486 +++++++++--------- database/mongodb/monitors-mongo.tf | 88 ++-- database/mysql/monitors-mysql.tf | 180 +++---- database/postgresql/monitors-postgresql.tf | 84 +-- database/redis/monitors-redis.tf | 248 ++++----- middleware/apache/monitors-apache.tf | 16 +- middleware/nginx/monitors-nginx.tf | 52 +- middleware/php-fpm/monitors-fpm.tf | 54 +- system/generic/monitors-system.tf | 144 +++--- system/unreachable/monitors-unreachable.tf | 18 +- 56 files changed, 2782 insertions(+), 2782 deletions(-) diff --git a/caas/kubernetes/ark/monitors-ark.tf b/caas/kubernetes/ark/monitors-ark.tf index 94039ab..1e91228 100644 --- a/caas/kubernetes/ark/monitors-ark.tf +++ b/caas/kubernetes/ark/monitors-ark.tf @@ -10,19 +10,19 @@ EOQ thresholds = { critical = 1 - warning = 0 + warning = 0 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay no_data_timeframe = var.ark_schedules_monitor_no_data_timeframe - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform"], var.ark_schedules_extra_tags) diff --git a/caas/kubernetes/cluster/monitors-k8s-cluster.tf b/caas/kubernetes/cluster/monitors-k8s-cluster.tf index f5a8fbc..f6f9406 100644 --- a/caas/kubernetes/cluster/monitors-k8s-cluster.tf +++ b/caas/kubernetes/cluster/monitors-k8s-cluster.tf @@ -10,17 +10,17 @@ resource "datadog_monitor" "apiserver" { EOQ thresholds = { - warning = var.apiserver_threshold_warning + warning = var.apiserver_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.apiserver_extra_tags) diff --git a/caas/kubernetes/ingress/vts/monitors-ingress.tf b/caas/kubernetes/ingress/vts/monitors-ingress.tf index ebdecf1..811a129 100644 --- a/caas/kubernetes/ingress/vts/monitors-ingress.tf +++ b/caas/kubernetes/ingress/vts/monitors-ingress.tf @@ -12,28 +12,28 @@ resource "datadog_monitor" "nginx_ingress_too_many_5xx" { EOQ thresholds = { - warning = var.ingress_5xx_threshold_warning + warning = var.ingress_5xx_threshold_warning critical = var.ingress_5xx_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_5xx_extra_tags) } resource "datadog_monitor" "nginx_ingress_too_many_4xx" { - count = var.ingress_4xx_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.ingress_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.ingress_4xx_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.ingress_4xx_threshold_critical} EOQ -thresholds = { -warning = var.ingress_4xx_threshold_warning -critical = var.ingress_4xx_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_4xx_extra_tags) + thresholds = { + warning = var.ingress_4xx_threshold_warning + critical = var.ingress_4xx_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_4xx_extra_tags) } diff --git a/caas/kubernetes/node/monitors-k8s-node.tf b/caas/kubernetes/node/monitors-k8s-node.tf index cd2af34..b60f729 100644 --- a/caas/kubernetes/node/monitors-k8s-node.tf +++ b/caas/kubernetes/node/monitors-k8s-node.tf @@ -9,81 +9,81 @@ resource "datadog_monitor" "disk_pressure" { EOQ thresholds = { - warning = var.disk_pressure_threshold_warning + warning = var.disk_pressure_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.disk_pressure_extra_tags) } resource "datadog_monitor" "disk_out" { - count = var.disk_out_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node Out of disk" + count = var.disk_out_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node Out of disk" message = coalesce(var.disk_out_message, var.message) - type = "service check" + type = "service check" query = < ${var.unregister_net_device_threshold_critical} EOQ -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false -tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.unregister_net_device_extra_tags) + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.unregister_net_device_extra_tags) } resource "datadog_monitor" "node_unschedulable" { -count = var.node_unschedulable_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" -message = coalesce(var.node_unschedulable_message, var.message) -type = "metric alert" + count = var.node_unschedulable_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" + message = coalesce(var.node_unschedulable_message, var.message) + type = "metric alert" query = < ${var.volume_inodes_threshold_critical} EOQ -thresholds = { -critical = var.volume_inodes_threshold_critical -warning = var.volume_inodes_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_inodes_extra_tags) + thresholds = { + critical = var.volume_inodes_threshold_critical + warning = var.volume_inodes_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_inodes_extra_tags) } diff --git a/caas/kubernetes/pod/monitors-k8s-pod.tf b/caas/kubernetes/pod/monitors-k8s-pod.tf index c6e1898..ab5154c 100644 --- a/caas/kubernetes/pod/monitors-k8s-pod.tf +++ b/caas/kubernetes/pod/monitors-k8s-pod.tf @@ -14,24 +14,24 @@ EOQ } evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay + new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.pod_phase_status_extra_tags) } resource "datadog_monitor" "error" { - count = var.error_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod waiting errors" + count = var.error_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod waiting errors" message = coalesce(var.error_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.error_threshold_critical} EOQ -thresholds = { -critical = var.error_threshold_critical -warning = var.error_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.error_extra_tags) + thresholds = { + critical = var.error_threshold_critical + warning = var.error_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.error_extra_tags) } diff --git a/caas/kubernetes/workload/monitors-k8s-workload.tf b/caas/kubernetes/workload/monitors-k8s-workload.tf index 88a6777..60308b8 100644 --- a/caas/kubernetes/workload/monitors-k8s-workload.tf +++ b/caas/kubernetes/workload/monitors-k8s-workload.tf @@ -9,54 +9,54 @@ resource "datadog_monitor" "job" { EOQ thresholds = { - warning = var.job_threshold_warning + warning = var.job_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.job_extra_tags) } resource "datadog_monitor" "cronjob" { - count = var.cronjob_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes cronjob scheduling failed" + count = var.cronjob_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes cronjob scheduling failed" message = coalesce(var.cronjob_message, var.message) - type = "service check" + type = "service check" query = < ${var.latency_threshold_critical} EOQ -thresholds = { -critical = var.latency_threshold_critical -warning = var.latency_threshold_warning -} + thresholds = { + critical = var.latency_threshold_critical + warning = var.latency_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.latency_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "ALB_httpcode_5xx" { -count = var.httpcode_alb_5xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.httpcode_alb_5xx_message, var.message) -type = "query alert" + count = var.httpcode_alb_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.httpcode_alb_5xx_message, var.message) + type = "query alert" query = < ${var.httpcode_alb_5xx_threshold_critical} EOQ -thresholds = { -critical = var.httpcode_alb_5xx_threshold_critical -warning = var.httpcode_alb_5xx_threshold_warning -} + thresholds = { + critical = var.httpcode_alb_5xx_threshold_critical + warning = var.httpcode_alb_5xx_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_alb_5xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_alb_5xx_extra_tags) } resource "datadog_monitor" "ALB_httpcode_4xx" { -count = var.httpcode_alb_4xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.httpcode_alb_4xx_message, var.message) -type = "query alert" + count = var.httpcode_alb_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.httpcode_alb_4xx_message, var.message) + type = "query alert" query = < ${var.httpcode_target_4xx_threshold_critical} EOQ -thresholds = { -critical = var.httpcode_target_4xx_threshold_critical -warning = var.httpcode_target_4xx_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_target_4xx_extra_tags) + thresholds = { + critical = var.httpcode_target_4xx_threshold_critical + warning = var.httpcode_target_4xx_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_target_4xx_extra_tags) } diff --git a/cloud/aws/apigateway/monitors-api.tf b/cloud/aws/apigateway/monitors-api.tf index 8d60e3f..d318f81 100644 --- a/cloud/aws/apigateway/monitors-api.tf +++ b/cloud/aws/apigateway/monitors-api.tf @@ -12,27 +12,27 @@ resource "datadog_monitor" "API_Gateway_latency" { EOQ thresholds = { - warning = var.latency_threshold_warning + warning = var.latency_threshold_warning critical = var.latency_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 0 - include_tags = true + timeout_h = 0 + include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } # Monitoring API Gateway 5xx errors percent resource "datadog_monitor" "API_http_5xx_errors_count" { - count = var.http_5xx_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.http_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.http_5xx_requests_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.http_5xx_requests_threshold_critical} EOQ -thresholds = { -warning = var.http_5xx_requests_threshold_warning -critical = var.http_5xx_requests_threshold_critical -} + thresholds = { + warning = var.http_5xx_requests_threshold_warning + critical = var.http_5xx_requests_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) } # Monitoring API Gateway 4xx errors percent resource "datadog_monitor" "API_http_4xx_errors_count" { -count = var.http_4xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.http_4xx_requests_message, var.message) -type = "query alert" + count = var.http_4xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.http_4xx_requests_message, var.message) + type = "query alert" query = < ${var.http_4xx_requests_threshold_critical} EOQ -thresholds = { -warning = var.http_4xx_requests_threshold_warning -critical = var.http_4xx_requests_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_4xx_requests_extra_tags) + thresholds = { + warning = var.http_4xx_requests_threshold_warning + critical = var.http_4xx_requests_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_4xx_requests_extra_tags) } diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 149a361..c59fb54 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -11,28 +11,28 @@ resource "datadog_monitor" "elasticache_eviction" { EOQ thresholds = { - warning = var.eviction_threshold_warning + warning = var.eviction_threshold_warning critical = var.eviction_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.eviction_extra_tags) } resource "datadog_monitor" "elasticache_max_connection" { - count = var.max_connection_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" + count = var.max_connection_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" message = coalesce(var.max_connection_message, var.message) - type = "query alert" + type = "query alert" query = <= 65000 EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = true -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.max_connection_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.max_connection_extra_tags) } resource "datadog_monitor" "elasticache_no_connection" { -count = var.no_connection_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" -message = coalesce(var.no_connection_message, var.message) -type = "query alert" + count = var.no_connection_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" + message = coalesce(var.no_connection_message, var.message) + type = "query alert" query = < ${var.eviction_growing_threshold_critical} EOQ -thresholds = { -warning = var.eviction_growing_threshold_warning -critical = var.eviction_growing_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.eviction_growing_extra_tags) + thresholds = { + warning = var.eviction_growing_threshold_warning + critical = var.eviction_growing_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.eviction_growing_extra_tags) } diff --git a/cloud/aws/elasticache/memcached/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 558d6f4..4dcb3d0 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -13,28 +13,28 @@ resource "datadog_monitor" "memcached_get_hits" { EOQ thresholds = { - warning = var.get_hits_threshold_warning + warning = var.get_hits_threshold_warning critical = var.get_hits_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.get_hits_extra_tags) } resource "datadog_monitor" "memcached_cpu_high" { - count = var.cpu_high_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache memcached CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.cpu_high_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache memcached CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.cpu_high_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.cpu_high_threshold_critical} EOQ -thresholds = { -warning = var.cpu_high_threshold_warning -critical = var.cpu_high_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = true -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.cpu_high_extra_tags) + thresholds = { + warning = var.cpu_high_threshold_warning + critical = var.cpu_high_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.cpu_high_extra_tags) } diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index 22aab16..c3bf595 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -13,28 +13,28 @@ resource "datadog_monitor" "redis_cache_hits" { EOQ thresholds = { - warning = var.cache_hits_threshold_warning + warning = var.cache_hits_threshold_warning critical = var.cache_hits_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cache_hits_extra_tags) } resource "datadog_monitor" "redis_cpu_high" { - count = var.cpu_high_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.cpu_high_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.cpu_high_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.cpu_high_threshold_critical} EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = true -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cpu_high_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cpu_high_extra_tags) } resource "datadog_monitor" "redis_replication_lag" { -count = var.replication_lag_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis replication lag {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" -message = coalesce(var.replication_lag_message, var.message) -type = "query alert" + count = var.replication_lag_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis replication lag {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" + message = coalesce(var.replication_lag_message, var.message) + type = "query alert" query = < ${var.replication_lag_threshold_critical} EOQ -thresholds = { -warning = var.replication_lag_threshold_warning -critical = var.replication_lag_threshold_critical -} + thresholds = { + warning = var.replication_lag_threshold_warning + critical = var.replication_lag_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.replication_lag_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.replication_lag_extra_tags) } resource "datadog_monitor" "redis_commands" { -count = var.commands_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis is receiving no commands" -message = coalesce(var.commands_message, var.message) -type = "query alert" + count = var.commands_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis is receiving no commands" + message = coalesce(var.commands_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} EOQ -thresholds = { -warning = var.cpu_threshold_warning -critical = var.cpu_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) + thresholds = { + warning = var.cpu_threshold_warning + critical = var.cpu_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } diff --git a/cloud/aws/elb/monitors-elb.tf b/cloud/aws/elb/monitors-elb.tf index ada02fa..aca05f2 100644 --- a/cloud/aws/elb/monitors-elb.tf +++ b/cloud/aws/elb/monitors-elb.tf @@ -14,27 +14,27 @@ EOQ thresholds = { critical = 1 - warning = 100 + warning = 100 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_no_healthy_instance_extra_tags) } resource "datadog_monitor" "ELB_too_much_4xx" { - count = var.elb_4xx_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.elb_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.elb_4xx_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.elb_4xx_threshold_critical} EOQ -thresholds = { -warning = var.elb_4xx_threshold_warning -critical = var.elb_4xx_threshold_critical -} + thresholds = { + warning = var.elb_4xx_threshold_warning + critical = var.elb_4xx_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_4xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_4xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_5xx" { -count = var.elb_5xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.elb_5xx_message, var.message) -type = "query alert" + count = var.elb_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.elb_5xx_message, var.message) + type = "query alert" query = < ${var.elb_5xx_threshold_critical} EOQ -thresholds = { -warning = var.elb_5xx_threshold_warning -critical = var.elb_5xx_threshold_critical -} + thresholds = { + warning = var.elb_5xx_threshold_warning + critical = var.elb_5xx_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_5xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_5xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_4xx_backend" { -count = var.elb_backend_4xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.elb_backend_4xx_message, var.message) -type = "query alert" + count = var.elb_backend_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.elb_backend_4xx_message, var.message) + type = "query alert" query = < ${var.elb_backend_latency_critical} EOQ -thresholds = { -warning = var.elb_backend_latency_warning -critical = var.elb_backend_latency_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_latency_extra_tags) + thresholds = { + warning = var.elb_backend_latency_warning + critical = var.elb_backend_latency_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_latency_extra_tags) } diff --git a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf index b7b4f2b..41faf73 100644 --- a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf +++ b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf @@ -15,14 +15,14 @@ EOQ critical = 0 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:kinesis-firehose", "team:claranet", "created-by:terraform"], var.incoming_records_extra_tags) diff --git a/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf b/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf index 222fad6..9f2555f 100644 --- a/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf +++ b/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf @@ -12,17 +12,17 @@ resource "datadog_monitor" "rds_aurora_mysql_replica_lag" { EOQ thresholds = { - warning = var.aurora_replicalag_threshold_warning + warning = var.aurora_replicalag_threshold_warning critical = var.aurora_replicalag_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform"], var.aurora_replicalag_extra_tags) diff --git a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf index 4e05f70..399c0ce 100644 --- a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf +++ b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf @@ -12,17 +12,17 @@ resource "datadog_monitor" "rds_aurora_postgresql_replica_lag" { EOQ thresholds = { - warning = var.aurora_replicalag_threshold_warning + warning = var.aurora_replicalag_threshold_warning critical = var.aurora_replicalag_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform"], var.aurora_replicalag_extra_tags) diff --git a/cloud/aws/rds/common/monitors-rds-common.tf b/cloud/aws/rds/common/monitors-rds-common.tf index 327f584..d8c7931 100644 --- a/cloud/aws/rds/common/monitors-rds-common.tf +++ b/cloud/aws/rds/common/monitors-rds-common.tf @@ -12,17 +12,17 @@ resource "datadog_monitor" "rds_cpu_90_15min" { EOQ thresholds = { - warning = var.cpu_threshold_warning + warning = var.cpu_threshold_warning critical = var.cpu_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) @@ -30,10 +30,10 @@ EOQ ### RDS instance free space monitor ### resource "datadog_monitor" "rds_free_space_low" { - count = var.diskspace_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance free space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance free space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.diskspace_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.replicalag_threshold_critical} EOQ -thresholds = { -warning = var.replicalag_threshold_warning -critical = var.replicalag_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.replicalag_extra_tags) + thresholds = { + warning = var.replicalag_threshold_warning + critical = var.replicalag_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.replicalag_extra_tags) } diff --git a/cloud/aws/vpn/monitors-vpn.tf b/cloud/aws/vpn/monitors-vpn.tf index 56f380c..10480a3 100644 --- a/cloud/aws/vpn/monitors-vpn.tf +++ b/cloud/aws/vpn/monitors-vpn.tf @@ -10,13 +10,13 @@ resource "datadog_monitor" "VPN_status" { ) < 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:vpn", "team:claranet", "created-by:terraform"], var.vpn_status_extra_tags) diff --git a/cloud/azure/apimanagement/monitors-azure-apimanagement.tf b/cloud/azure/apimanagement/monitors-azure-apimanagement.tf index 672f140..492c25b 100644 --- a/cloud/azure/apimanagement/monitors-azure-apimanagement.tf +++ b/cloud/azure/apimanagement/monitors-azure-apimanagement.tf @@ -12,24 +12,24 @@ EOQ critical = 1 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "apimgt_failed_requests" { - count = var.failed_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.failed_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_requests_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.failed_requests_threshold_critical} EOQ -thresholds = { -critical = var.failed_requests_threshold_critical -warning = var.failed_requests_threshold_warning -} + thresholds = { + critical = var.failed_requests_threshold_critical + warning = var.failed_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.failed_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.failed_requests_extra_tags) } resource "datadog_monitor" "apimgt_other_requests" { -count = var.other_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.other_requests_message, var.message) -type = "query alert" + count = var.other_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.other_requests_message, var.message) + type = "query alert" query = < ${var.other_requests_threshold_critical} EOQ -thresholds = { -critical = var.other_requests_threshold_critical -warning = var.other_requests_threshold_warning -} + thresholds = { + critical = var.other_requests_threshold_critical + warning = var.other_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.other_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.other_requests_extra_tags) } resource "datadog_monitor" "apimgt_unauthorized_requests" { -count = var.unauthorized_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.unauthorized_requests_message, var.message) -type = "query alert" + count = var.unauthorized_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.unauthorized_requests_message, var.message) + type = "query alert" query = < ${var.memory_usage_threshold_critical} EOQ -thresholds = { -warning = var.memory_usage_threshold_warning -critical = var.memory_usage_threshold_critical -} + thresholds = { + warning = var.memory_usage_threshold_warning + critical = var.memory_usage_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) } # Monitoring App Services 5xx errors percent resource "datadog_monitor" "appservices_http_5xx_errors_count" { -count = var.http_5xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.http_5xx_requests_message, var.message) -type = "query alert" + count = var.http_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.http_5xx_requests_message, var.message) + type = "query alert" query = < ${var.http_5xx_requests_threshold_critical} EOQ -thresholds = { -warning = var.http_5xx_requests_threshold_warning -critical = var.http_5xx_requests_threshold_critical -} + thresholds = { + warning = var.http_5xx_requests_threshold_warning + critical = var.http_5xx_requests_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) } # Monitoring App Services 4xx errors percent resource "datadog_monitor" "appservices_http_4xx_errors_count" { -count = var.http_4xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.http_4xx_requests_message, var.message) -type = "query alert" + count = var.http_4xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.http_4xx_requests_message, var.message) + type = "query alert" query = < ${var.throttled_queries_rate_threshold_critical} EOQ -thresholds = { -warning = var.throttled_queries_rate_threshold_warning -critical = var.throttled_queries_rate_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform"], var.throttled_queries_rate_extra_tags) + thresholds = { + warning = var.throttled_queries_rate_threshold_warning + critical = var.throttled_queries_rate_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform"], var.throttled_queries_rate_extra_tags) } diff --git a/cloud/azure/cosmosdb/monitors-cosmosdb.tf b/cloud/azure/cosmosdb/monitors-cosmosdb.tf index a55c99d..df3ed86 100644 --- a/cloud/azure/cosmosdb/monitors-cosmosdb.tf +++ b/cloud/azure/cosmosdb/monitors-cosmosdb.tf @@ -14,24 +14,24 @@ EOQ critical = 1 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "cosmos_db_4xx_requests" { - count = var.cosmos_db_4xx_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 4xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.cosmos_db_4xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 4xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.cosmos_db_4xx_requests_message, var.message) - type = "query alert" + type = "query alert" # List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb query = < ${var.cosmos_db_4xx_request_rate_threshold_critical} EOQ -thresholds = { -critical = var.cosmos_db_4xx_request_rate_threshold_critical -warning = var.cosmos_db_4xx_request_rate_threshold_warning -} + thresholds = { + critical = var.cosmos_db_4xx_request_rate_threshold_critical + warning = var.cosmos_db_4xx_request_rate_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_4xx_request_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_4xx_request_extra_tags) } resource "datadog_monitor" "cosmos_db_5xx_requests" { -count = var.cosmos_db_5xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 5xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.cosmos_db_5xx_requests_message, var.message) -type = "query alert" + count = var.cosmos_db_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 5xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.cosmos_db_5xx_requests_message, var.message) + type = "query alert" query = < ${var.cosmos_db_5xx_request_rate_threshold_critical} EOQ -thresholds = { -critical = var.cosmos_db_5xx_request_rate_threshold_critical -warning = var.cosmos_db_5xx_request_rate_threshold_warning -} + thresholds = { + critical = var.cosmos_db_5xx_request_rate_threshold_critical + warning = var.cosmos_db_5xx_request_rate_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_5xx_request_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_5xx_request_rate_extra_tags) } resource "datadog_monitor" "cosmos_db_scaling" { -count = var.cosmos_db_scaling_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB max scaling reached for collection {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.cosmos_db_scaling_message, var.message) -type = "query alert" + count = var.cosmos_db_scaling_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB max scaling reached for collection {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.cosmos_db_scaling_message, var.message) + type = "query alert" -# List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb + # List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb query = < ${var.failed_messages_rate_thresold_critical} EOQ -thresholds = { -critical = var.failed_messages_rate_thresold_critical -warning = var.failed_messages_rate_thresold_warning -} + thresholds = { + critical = var.failed_messages_rate_thresold_critical + warning = var.failed_messages_rate_thresold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.failed_messages_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.failed_messages_rate_extra_tags) } resource "datadog_monitor" "eventgrid_unmatched_events" { -count = var.unmatched_events_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Grid too many unmatched events {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.unmatched_events_rate_message, var.message) -type = "query alert" + count = var.unmatched_events_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Grid too many unmatched events {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.unmatched_events_rate_message, var.message) + type = "query alert" query = < ${var.unmatched_events_rate_thresold_critical} EOQ -thresholds = { -critical = var.unmatched_events_rate_thresold_critical -warning = var.unmatched_events_rate_thresold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.unmatched_events_rate_extra_tags) + thresholds = { + critical = var.unmatched_events_rate_thresold_critical + warning = var.unmatched_events_rate_thresold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.unmatched_events_rate_extra_tags) } diff --git a/cloud/azure/eventhub/monitors-eventhub.tf b/cloud/azure/eventhub/monitors-eventhub.tf index 05c7209..aa2945b 100644 --- a/cloud/azure/eventhub/monitors-eventhub.tf +++ b/cloud/azure/eventhub/monitors-eventhub.tf @@ -10,24 +10,24 @@ resource "datadog_monitor" "eventhub_status" { ) != 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "eventhub_failed_requests" { - count = var.failed_requests_rate_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.failed_requests_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_requests_rate_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.failed_requests_rate_thresold_critical} EOQ -thresholds = { -critical = var.failed_requests_rate_thresold_critical -warning = var.failed_requests_rate_thresold_warning -} + thresholds = { + critical = var.failed_requests_rate_thresold_critical + warning = var.failed_requests_rate_thresold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.failed_requests_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.failed_requests_rate_extra_tags) } resource "datadog_monitor" "eventhub_errors" { -count = var.errors_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.errors_rate_message, var.message) -type = "query alert" + count = var.errors_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.errors_rate_message, var.message) + type = "query alert" query = < ${var.errors_rate_thresold_critical} EOQ -thresholds = { -critical = var.errors_rate_thresold_critical -warning = var.errors_rate_thresold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.errors_rate_extra_tags) + thresholds = { + critical = var.errors_rate_thresold_critical + warning = var.errors_rate_thresold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.errors_rate_extra_tags) } diff --git a/cloud/azure/functions/monitors-functions.tf b/cloud/azure/functions/monitors-functions.tf index 1860351..2d97cce 100644 --- a/cloud/azure/functions/monitors-functions.tf +++ b/cloud/azure/functions/monitors-functions.tf @@ -12,26 +12,26 @@ resource "datadog_monitor" "function_http_5xx_errors_rate" { EOQ thresholds = { - warning = var.http_5xx_errors_rate_threshold_warning + warning = var.http_5xx_errors_rate_threshold_warning critical = var.http_5xx_errors_rate_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 1 - include_tags = true + timeout_h = 1 + include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.http_5xx_errors_rate_extra_tags) } resource "datadog_monitor" "function_high_connections_count" { - count = var.high_connections_count_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App connections count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + count = var.high_connections_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App connections count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = coalesce(var.high_connections_count_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.high_connections_count_threshold_critical} EOQ -thresholds = { -warning = var.high_connections_count_threshold_warning -critical = var.high_connections_count_threshold_critical -} + thresholds = { + warning = var.high_connections_count_threshold_warning + critical = var.high_connections_count_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_connections_count_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_connections_count_extra_tags) } resource "datadog_monitor" "function_high_threads_count" { -count = var.high_threads_count_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App threads count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.high_threads_count_message, var.message) -type = "query alert" + count = var.high_threads_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App threads count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.high_threads_count_message, var.message) + type = "query alert" query = < ${var.high_threads_count_threshold_critical} EOQ -thresholds = { -warning = var.high_threads_count_threshold_warning -critical = var.high_threads_count_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_threads_count_extra_tags) + thresholds = { + warning = var.high_threads_count_threshold_warning + critical = var.high_threads_count_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_threads_count_extra_tags) } diff --git a/cloud/azure/iothubs/monitors-iothubs.tf b/cloud/azure/iothubs/monitors-iothubs.tf index b55499e..ed1b3ee 100644 --- a/cloud/azure/iothubs/monitors-iothubs.tf +++ b/cloud/azure/iothubs/monitors-iothubs.tf @@ -14,28 +14,28 @@ resource "datadog_monitor" "too_many_jobs_failed" { EOQ thresholds = { - warning = var.failed_jobs_rate_threshold_warning + warning = var.failed_jobs_rate_threshold_warning critical = var.failed_jobs_rate_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_jobs_rate_extra_tags) } resource "datadog_monitor" "too_many_list_jobs_failed" { - count = var.failed_listjobs_rate_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many list_jobs failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.failed_listjobs_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many list_jobs failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_listjobs_rate_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.failed_listjobs_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_listjobs_rate_threshold_warning -critical = var.failed_listjobs_rate_threshold_critical -} + thresholds = { + warning = var.failed_listjobs_rate_threshold_warning + critical = var.failed_listjobs_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_listjobs_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_listjobs_rate_extra_tags) } resource "datadog_monitor" "too_many_query_jobs_failed" { -count = var.failed_queryjobs_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many query_jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_queryjobs_rate_message, var.message) -type = "query alert" + count = var.failed_queryjobs_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many query_jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_queryjobs_rate_message, var.message) + type = "query alert" query = < ${var.failed_queryjobs_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_queryjobs_rate_threshold_warning -critical = var.failed_queryjobs_rate_threshold_critical -} + thresholds = { + warning = var.failed_queryjobs_rate_threshold_warning + critical = var.failed_queryjobs_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_queryjobs_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_queryjobs_rate_extra_tags) } resource "datadog_monitor" "status" { -count = var.status_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub is down" -message = coalesce(var.status_message, var.message) -type = "query alert" + count = var.status_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub is down" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.failed_c2d_methods_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_c2d_methods_rate_threshold_warning -critical = var.failed_c2d_methods_rate_threshold_critical -} + thresholds = { + warning = var.failed_c2d_methods_rate_threshold_warning + critical = var.failed_c2d_methods_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_methods_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_methods_rate_extra_tags) } resource "datadog_monitor" "too_many_c2d_twin_read_failed" { -count = var.failed_c2d_twin_read_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_c2d_twin_read_rate_message, var.message) -type = "query alert" + count = var.failed_c2d_twin_read_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_c2d_twin_read_rate_message, var.message) + type = "query alert" query = < ${var.failed_c2d_twin_read_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_c2d_twin_read_rate_threshold_warning -critical = var.failed_c2d_twin_read_rate_threshold_critical -} + thresholds = { + warning = var.failed_c2d_twin_read_rate_threshold_warning + critical = var.failed_c2d_twin_read_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_twin_read_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_twin_read_rate_extra_tags) } resource "datadog_monitor" "too_many_c2d_twin_update_failed" { -count = var.failed_c2d_twin_update_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_c2d_twin_update_rate_message, var.message) -type = "query alert" + count = var.failed_c2d_twin_update_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_c2d_twin_update_rate_message, var.message) + type = "query alert" query = < ${var.failed_d2c_twin_update_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_d2c_twin_update_rate_threshold_warning -critical = var.failed_d2c_twin_update_rate_threshold_critical -} + thresholds = { + warning = var.failed_d2c_twin_update_rate_threshold_warning + critical = var.failed_d2c_twin_update_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_d2c_twin_update_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_d2c_twin_update_rate_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_dropped" { -count = var.dropped_d2c_telemetry_egress_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress dropped {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.dropped_d2c_telemetry_egress_message, var.message) -type = "query alert" + count = var.dropped_d2c_telemetry_egress_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress dropped {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.dropped_d2c_telemetry_egress_message, var.message) + type = "query alert" query = < ${var.dropped_d2c_telemetry_egress_rate_threshold_critical} EOQ -thresholds = { -warning = var.dropped_d2c_telemetry_egress_rate_threshold_warning -critical = var.dropped_d2c_telemetry_egress_rate_threshold_critical -} + thresholds = { + warning = var.dropped_d2c_telemetry_egress_rate_threshold_warning + critical = var.dropped_d2c_telemetry_egress_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.dropped_d2c_telemetry_egress_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.dropped_d2c_telemetry_egress_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_orphaned" { -count = var.orphaned_d2c_telemetry_egress_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress orphaned {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.orphaned_d2c_telemetry_egress_message, var.message) -type = "query alert" + count = var.orphaned_d2c_telemetry_egress_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress orphaned {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.orphaned_d2c_telemetry_egress_message, var.message) + type = "query alert" query = < 0 EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.too_many_d2c_telemetry_ingress_nosent_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.too_many_d2c_telemetry_ingress_nosent_extra_tags) } diff --git a/cloud/azure/keyvault/monitors-keyvault.tf b/cloud/azure/keyvault/monitors-keyvault.tf index c9e214e..d814756 100644 --- a/cloud/azure/keyvault/monitors-keyvault.tf +++ b/cloud/azure/keyvault/monitors-keyvault.tf @@ -10,24 +10,24 @@ resource "datadog_monitor" "keyvault_status" { ) < 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "keyvault_api_result" { - count = var.api_result_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Key Vault API result rate is low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.api_result_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Key Vault API result rate is low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.status_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.api_latency_threshold_critical} EOQ -thresholds = { -critical = var.api_latency_threshold_critical -warning = var.api_latency_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.api_latency_extra_tags) + thresholds = { + critical = var.api_latency_threshold_critical + warning = var.api_latency_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.api_latency_extra_tags) } diff --git a/cloud/azure/load-balancer/monitors-load-balancer.tf b/cloud/azure/load-balancer/monitors-load-balancer.tf index 6b760e9..a782a31 100644 --- a/cloud/azure/load-balancer/monitors-load-balancer.tf +++ b/cloud/azure/load-balancer/monitors-load-balancer.tf @@ -10,14 +10,14 @@ resource "datadog_monitor" "loadbalancer_status" { ) < 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:load-balancer", "team:claranet", "created-by:terraform"], var.status_extra_tags) diff --git a/cloud/azure/mysql/monitors-mysql.tf b/cloud/azure/mysql/monitors-mysql.tf index 03fa5d0..c8a3399 100644 --- a/cloud/azure/mysql/monitors-mysql.tf +++ b/cloud/azure/mysql/monitors-mysql.tf @@ -12,27 +12,27 @@ EOQ thresholds = { critical = var.cpu_usage_threshold_critical - warning = var.cpu_usage_threshold_warning + warning = var.cpu_usage_threshold_warning } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "mysql_free_storage" { - count = var.free_storage_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server storage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.free_storage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server storage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.free_storage_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.io_consumption_threshold_critical} EOQ -thresholds = { -critical = var.io_consumption_threshold_critical -warning = var.io_consumption_threshold_warning -} + thresholds = { + critical = var.io_consumption_threshold_critical + warning = var.io_consumption_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.io_consumption_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.io_consumption_extra_tags) } resource "datadog_monitor" "mysql_memory_usage" { -count = var.memory_usage_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.memory_usage_message, var.message) -type = "query alert" + count = var.memory_usage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.memory_usage_message, var.message) + type = "query alert" query = < ${var.evictedkeys_limit_threshold_critical} EOQ -thresholds = { -warning = var.evictedkeys_limit_threshold_warning -critical = var.evictedkeys_limit_threshold_critical -} + thresholds = { + warning = var.evictedkeys_limit_threshold_warning + critical = var.evictedkeys_limit_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_limit_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_limit_extra_tags) } resource "datadog_monitor" "percent_processor_time" { -count = var.percent_processor_time_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis processor time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.percent_processor_time_message, var.message) -type = "query alert" + count = var.percent_processor_time_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis processor time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.percent_processor_time_message, var.message) + type = "query alert" query = < ${var.percent_processor_time_threshold_critical} EOQ -thresholds = { -warning = var.percent_processor_time_threshold_warning -critical = var.percent_processor_time_threshold_critical -} + thresholds = { + warning = var.percent_processor_time_threshold_warning + critical = var.percent_processor_time_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.percent_processor_time_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.percent_processor_time_extra_tags) } resource "datadog_monitor" "server_load" { -count = var.server_load_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis server load too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.server_load_rate_message, var.message) -type = "query alert" + count = var.server_load_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis server load too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.server_load_rate_message, var.message) + type = "query alert" query = < ${var.cpu_percentage_threshold_critical} EOQ -thresholds = { -warning = var.cpu_percentage_threshold_warning -critical = var.cpu_percentage_threshold_critical -} + thresholds = { + warning = var.cpu_percentage_threshold_warning + critical = var.cpu_percentage_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.cpu_percentage_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.cpu_percentage_extra_tags) } resource "datadog_monitor" "memory_percentage" { -count = var.memory_percentage_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm memory percentage is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.memory_percentage_message, var.message) - type = "query alert" + count = var.memory_percentage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm memory percentage is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.memory_percentage_message, var.message) + type = "query alert" query = < ${var.memory_percentage_threshold_critical} EOQ -thresholds = { -warning = var.memory_percentage_threshold_warning -critical = var.memory_percentage_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.memory_percentage_extra_tags) + thresholds = { + warning = var.memory_percentage_threshold_warning + critical = var.memory_percentage_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.memory_percentage_extra_tags) } diff --git a/cloud/azure/servicebus/monitors-service-bus.tf b/cloud/azure/servicebus/monitors-service-bus.tf index 3da9b9f..31e810c 100644 --- a/cloud/azure/servicebus/monitors-service-bus.tf +++ b/cloud/azure/servicebus/monitors-service-bus.tf @@ -10,24 +10,24 @@ resource "datadog_monitor" "servicebus_status" { ) != 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "service_bus_no_active_connections" { - count = var.no_active_connections_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus has no active connection" + count = var.no_active_connections_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus has no active connection" message = coalesce(var.no_active_connections_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.user_errors_threshold_critical} EOQ -thresholds = { -critical = var.user_errors_threshold_critical -warning = var.user_errors_threshold_warning -} + thresholds = { + critical = var.user_errors_threshold_critical + warning = var.user_errors_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.user_errors_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.user_errors_extra_tags) } resource "datadog_monitor" "service_bus_server_errors" { -count = var.server_errors_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus server errors rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.server_errors_message, var.message) -type = "query alert" + count = var.server_errors_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus server errors rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.server_errors_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} EOQ -thresholds = { -critical = var.cpu_threshold_critical -warning = var.cpu_threshold_warning -} + thresholds = { + critical = var.cpu_threshold_critical + warning = var.cpu_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "sql-database_free_space_low" { -count = var.diskspace_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.diskspace_message, var.message) -type = "query alert" + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.diskspace_message, var.message) + type = "query alert" query = < ${var.diskspace_threshold_critical} EOQ -thresholds = { -warning = var.diskspace_threshold_warning -critical = var.diskspace_threshold_critical -} + thresholds = { + warning = var.diskspace_threshold_warning + critical = var.diskspace_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } resource "datadog_monitor" "sql-database_dtu_consumption_high" { -count = var.dtu_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.dtu_message, var.message) -type = "query alert" + count = var.dtu_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.dtu_message, var.message) + type = "query alert" query = < ${var.diskspace_threshold_critical} EOQ -thresholds = { -warning = var.diskspace_threshold_warning -critical = var.diskspace_threshold_critical -} + thresholds = { + warning = var.diskspace_threshold_warning + critical = var.diskspace_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } resource "datadog_monitor" "sql_elasticpool_dtu_consumption_high" { -count = var.dtu_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.dtu_message, var.message) -type = "query alert" + count = var.dtu_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.dtu_message, var.message) + type = "query alert" query = < ${var.dtu_threshold_critical} EOQ -thresholds = { -warning = var.dtu_threshold_warning -critical = var.dtu_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.dtu_extra_tags) + thresholds = { + warning = var.dtu_threshold_warning + critical = var.dtu_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.dtu_extra_tags) } diff --git a/cloud/azure/storage/monitors-azure-storage.tf b/cloud/azure/storage/monitors-azure-storage.tf index 9c25114..8b9f3f6 100644 --- a/cloud/azure/storage/monitors-azure-storage.tf +++ b/cloud/azure/storage/monitors-azure-storage.tf @@ -12,27 +12,27 @@ EOQ thresholds = { critical = var.availability_threshold_critical - warning = var.availability_threshold_warning + warning = var.availability_threshold_warning } - new_host_delay = var.new_host_delay - evaluation_delay = var.evaluation_delay - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - renotify_interval = 0 + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.availability_extra_tags) } resource "datadog_monitor" "successful_requests" { - count = var.successful_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too few successful requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.successful_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too few successful requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.successful_requests_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.latency_threshold_critical} EOQ -thresholds = { -critical = var.latency_threshold_critical -warning = var.latency_threshold_warning -} + thresholds = { + critical = var.latency_threshold_critical + warning = var.latency_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.latency_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "timeout_error_requests" { -count = var.timeout_error_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many timeout errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.timeout_error_requests_message, var.message) -type = "query alert" + count = var.timeout_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many timeout errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.timeout_error_requests_message, var.message) + type = "query alert" query = < ${var.throttling_error_requests_threshold_critical} EOQ -thresholds = { -critical = var.throttling_error_requests_threshold_critical -warning = var.throttling_error_requests_threshold_warning -} + thresholds = { + critical = var.throttling_error_requests_threshold_critical + warning = var.throttling_error_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.throttling_error_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.throttling_error_requests_extra_tags) } resource "datadog_monitor" "server_other_error_requests" { -count = var.server_other_error_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many server_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.server_other_error_requests_message, var.message) -type = "query alert" + count = var.server_other_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many server_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.server_other_error_requests_message, var.message) + type = "query alert" query = < ${var.server_other_error_requests_threshold_critical} EOQ -thresholds = { -critical = var.server_other_error_requests_threshold_critical -warning = var.server_other_error_requests_threshold_warning -} + thresholds = { + critical = var.server_other_error_requests_threshold_critical + warning = var.server_other_error_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.server_other_error_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.server_other_error_requests_extra_tags) } resource "datadog_monitor" "client_other_error_requests" { -count = var.client_other_error_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many client_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.client_other_error_requests_message, var.message) -type = "query alert" + count = var.client_other_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many client_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.client_other_error_requests_message, var.message) + type = "query alert" query = < ${var.su_utilization_threshold_critical} EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -thresholds = { -warning = var.su_utilization_threshold_warning -critical = var.su_utilization_threshold_critical -} + thresholds = { + warning = var.su_utilization_threshold_warning + critical = var.su_utilization_threshold_critical + } -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.su_utilization_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.su_utilization_extra_tags) } resource "datadog_monitor" "failed_function_requests" { -count = var.failed_function_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_function_requests_message, var.message) -type = "query alert" + count = var.failed_function_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_function_requests_message, var.message) + type = "query alert" query = < ${var.failed_function_requests_threshold_critical} EOQ -thresholds = { -warning = var.failed_function_requests_threshold_warning -critical = var.failed_function_requests_threshold_critical -} + thresholds = { + warning = var.failed_function_requests_threshold_warning + critical = var.failed_function_requests_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 60 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 60 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.failed_function_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.failed_function_requests_extra_tags) } resource "datadog_monitor" "conversion_errors" { -count = var.conversion_errors_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many conversion errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.conversion_errors_message, var.message) -type = "query alert" + count = var.conversion_errors_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many conversion errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.conversion_errors_message, var.message) + type = "query alert" query = < ${var.cpu_usage_threshold_critical} EOQ -thresholds = { -critical = var.cpu_usage_threshold_critical -warning = var.cpu_usage_threshold_warning -} + thresholds = { + critical = var.cpu_usage_threshold_critical + warning = var.cpu_usage_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "virtualmachine_credit_cpu_remaining_too_low" { -count = var.cpu_remaining_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine credit CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.cpu_remaining_rate_message, var.message) -type = "query alert" + count = var.cpu_remaining_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine credit CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.cpu_remaining_rate_message, var.message) + type = "query alert" query = < ${var.execution_time_threshold_critical} EOQ -thresholds = { -warning = var.execution_time_threshold_warning -critical = var.execution_time_threshold_critical -} + thresholds = { + warning = var.execution_time_threshold_warning + critical = var.execution_time_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.execution_time_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.execution_time_extra_tags) } # # Scanned Bytes # resource "datadog_monitor" "scanned_bytes" { -count = var.scanned_bytes_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" -message = coalesce(var.scanned_bytes_message, var.message) -type = "query alert" + count = var.scanned_bytes_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" + message = coalesce(var.scanned_bytes_message, var.message) + type = "query alert" query = < ${var.scanned_bytes_threshold_critical} EOQ -thresholds = { -warning = var.scanned_bytes_threshold_warning -critical = var.scanned_bytes_threshold_critical -} + thresholds = { + warning = var.scanned_bytes_threshold_warning + critical = var.scanned_bytes_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.scanned_bytes_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.scanned_bytes_extra_tags) } # # Scanned Bytes Billed # resource "datadog_monitor" "scanned_bytes_billed" { -count = var.scanned_bytes_billed_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" -message = coalesce(var.scanned_bytes_billed_message, var.message) -type = "query alert" + count = var.scanned_bytes_billed_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" + message = coalesce(var.scanned_bytes_billed_message, var.message) + type = "query alert" query = < ${var.stored_bytes_threshold_critical} EOQ -thresholds = { -warning = var.stored_bytes_threshold_warning -critical = var.stored_bytes_threshold_critical -} + thresholds = { + warning = var.stored_bytes_threshold_warning + critical = var.stored_bytes_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.stored_bytes_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.stored_bytes_extra_tags) } # # Table Count # resource "datadog_monitor" "table_count" { -count = var.table_count_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Table Count {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.table_count_message, var.message) -type = "metric alert" + count = var.table_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Table Count {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.table_count_message, var.message) + type = "metric alert" query = < ${var.table_count_threshold_critical} EOQ -thresholds = { -warning = var.table_count_threshold_warning -critical = var.table_count_threshold_critical -} + thresholds = { + warning = var.table_count_threshold_warning + critical = var.table_count_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.table_count_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.table_count_extra_tags) } # # Uploaded Bytes # resource "datadog_monitor" "uploaded_bytes" { -count = var.uploaded_bytes_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" -message = coalesce(var.uploaded_bytes_message, var.message) -type = "query alert" + count = var.uploaded_bytes_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" + message = coalesce(var.uploaded_bytes_message, var.message) + type = "query alert" query = < ${var.disk_utilization_threshold_critical} EOQ -thresholds = { -warning = var.disk_utilization_threshold_warning -critical = var.disk_utilization_threshold_critical -} + thresholds = { + warning = var.disk_utilization_threshold_warning + critical = var.disk_utilization_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = true -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = true + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.disk_utilization_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.disk_utilization_extra_tags) } # # Disk Utilization Forecast # resource "datadog_monitor" "disk_utilization_forecast" { -count = var.disk_utilization_forecast_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" -message = coalesce(var.disk_utilization_forecast_message, var.message) - type = "query alert" + count = var.disk_utilization_forecast_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" + message = coalesce(var.disk_utilization_forecast_message, var.message) + type = "query alert" query = <= ${var.memory_utilization_forecast_threshold_critical} EOQ - thresholds = { - critical = var.memory_utilization_forecast_threshold_critical - critical_recovery = var.memory_utilization_forecast_threshold_critical_recovery - } + thresholds = { + critical = var.memory_utilization_forecast_threshold_critical + critical_recovery = var.memory_utilization_forecast_threshold_critical_recovery + } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 - tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_forecast_extra_tags) - } + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_forecast_extra_tags) +} - # - # Failover Unavailable - # - resource "datadog_monitor" "failover_unavailable" { - count = var.failover_unavailable_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" - message = coalesce(var.failover_unavailable_message, var.message) - type = "metric alert" +# +# Failover Unavailable +# +resource "datadog_monitor" "failover_unavailable" { + count = var.failover_unavailable_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" + message = coalesce(var.failover_unavailable_message, var.message) + type = "metric alert" query = < ${var.disk_throttled_bps_threshold_critical} EOQ -thresholds = { -warning = var.disk_throttled_bps_threshold_warning -critical = var.disk_throttled_bps_threshold_critical -} + thresholds = { + warning = var.disk_throttled_bps_threshold_warning + critical = var.disk_throttled_bps_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = var.disk_throttled_bps_notify_no_data -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = var.disk_throttled_bps_notify_no_data + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_bps_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_bps_extra_tags) } # # Disk Throttled OPS # resource "datadog_monitor" "disk_throttled_ops" { -count = var.disk_throttled_ops_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled OPS {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.disk_throttled_ops_message, var.message) -type = "query alert" + count = var.disk_throttled_ops_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled OPS {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_throttled_ops_message, var.message) + type = "query alert" query = < ${var.disk_throttled_ops_threshold_critical} EOQ -thresholds = { -warning = var.disk_throttled_ops_threshold_warning -critical = var.disk_throttled_ops_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = var.disk_throttled_ops_notify_no_data -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -renotify_interval = 0 - -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_ops_extra_tags) + thresholds = { + warning = var.disk_throttled_ops_threshold_warning + critical = var.disk_throttled_ops_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = var.disk_throttled_ops_notify_no_data + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + renotify_interval = 0 + + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_ops_extra_tags) } diff --git a/cloud/gcp/lb/monitors-lb.tf b/cloud/gcp/lb/monitors-lb.tf index 810800e..e193b78 100644 --- a/cloud/gcp/lb/monitors-lb.tf +++ b/cloud/gcp/lb/monitors-lb.tf @@ -15,19 +15,19 @@ resource "datadog_monitor" "error_rate_4xx" { EOQ thresholds = { - warning = var.error_rate_4xx_threshold_warning + warning = var.error_rate_4xx_threshold_warning critical = var.error_rate_4xx_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_4xx_extra_tags) } @@ -36,10 +36,10 @@ EOQ # 5XX Errors # resource "datadog_monitor" "error_rate_5xx" { - count = var.error_rate_5xx_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.error_rate_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.error_rate_5xx_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.error_rate_5xx_threshold_critical} EOQ -thresholds = { -warning = var.error_rate_5xx_threshold_warning -critical = var.error_rate_5xx_threshold_critical -} + thresholds = { + warning = var.error_rate_5xx_threshold_warning + critical = var.error_rate_5xx_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = false -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_5xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_5xx_extra_tags) } # # Backend Latency for service # resource "datadog_monitor" "backend_latency_service" { -count = var.backend_latency_service_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.backend_latency_service_message, var.message) -type = "query alert" + count = var.backend_latency_service_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.backend_latency_service_message, var.message) + type = "query alert" query = < ${var.backend_latency_service_threshold_critical} EOQ -thresholds = { -warning = var.backend_latency_service_threshold_warning -critical = var.backend_latency_service_threshold_critical -} + thresholds = { + warning = var.backend_latency_service_threshold_warning + critical = var.backend_latency_service_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = false -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_service_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_service_extra_tags) } # # Backend Latency for bucket # resource "datadog_monitor" "backend_latency_bucket" { -count = var.backend_latency_bucket_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.backend_latency_bucket_message, var.message) -type = "query alert" + count = var.backend_latency_bucket_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.backend_latency_bucket_message, var.message) + type = "query alert" query = <= ${var.unavailable_sending_operations_count_threshold_critical} EOQ -thresholds = { -warning = var.unavailable_sending_operations_count_threshold_warning -critical = var.unavailable_sending_operations_count_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = false -renotify_interval = 0 - -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform"], var.unavailable_sending_operations_count_extra_tags) + thresholds = { + warning = var.unavailable_sending_operations_count_threshold_warning + critical = var.unavailable_sending_operations_count_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 + + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform"], var.unavailable_sending_operations_count_extra_tags) } diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 1f81058..3c45dd7 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -12,11 +12,11 @@ EOF vars = { - message_alert = var.message_alert + message_alert = var.message_alert message_warning = var.message_warning - message_nodata = coalesce(var.message_nodata, var.message_alert) - prepend_text = var.prepend_text - append_text = var.append_text + message_nodata = coalesce(var.message_nodata, var.message_alert) + prepend_text = var.prepend_text + append_text = var.append_text } } diff --git a/database/elasticsearch/monitors-elasticsearch.tf b/database/elasticsearch/monitors-elasticsearch.tf index c380c4e..d5bd81c 100644 --- a/database/elasticsearch/monitors-elasticsearch.tf +++ b/database/elasticsearch/monitors-elasticsearch.tf @@ -12,19 +12,19 @@ resource "datadog_monitor" "not_responding" { EOQ thresholds = { - warning = var.not_responding_threshold_warning + warning = var.not_responding_threshold_warning critical = 5 } - no_data_timeframe = var.not_responding_no_data_timeframe - new_host_delay = var.new_host_delay - notify_no_data = true - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + no_data_timeframe = var.not_responding_no_data_timeframe + new_host_delay = var.new_host_delay + notify_no_data = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = true - renotify_interval = 0 + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.not_responding_extra_tags) } @@ -33,10 +33,10 @@ EOQ # Cluster Status Not Green # resource "datadog_monitor" "cluster_status_not_green" { - count = var.cluster_status_not_green_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster status not green" + count = var.cluster_status_not_green_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster status not green" message = coalesce(var.cluster_status_not_green_message, var.message) - type = "metric alert" + type = "metric alert" query = < ${var.cluster_initializing_shards_threshold_critical} EOQ -thresholds = { -warning = var.cluster_initializing_shards_threshold_warning -critical = var.cluster_initializing_shards_threshold_critical -} + thresholds = { + warning = var.cluster_initializing_shards_threshold_warning + critical = var.cluster_initializing_shards_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_initializing_shards_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_initializing_shards_extra_tags) } # # Cluster Relocating Shards # resource "datadog_monitor" "cluster_relocating_shards" { -count = var.cluster_relocating_shards_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster is relocating shards" -message = coalesce(var.cluster_relocating_shards_message, var.message) -type = "metric alert" + count = var.cluster_relocating_shards_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster is relocating shards" + message = coalesce(var.cluster_relocating_shards_message, var.message) + type = "metric alert" query = < ${var.jvm_heap_memory_usage_threshold_critical} EOQ -thresholds = { -warning = var.jvm_heap_memory_usage_threshold_warning -critical = var.jvm_heap_memory_usage_threshold_critical -} + thresholds = { + warning = var.jvm_heap_memory_usage_threshold_warning + critical = var.jvm_heap_memory_usage_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_heap_memory_usage_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_heap_memory_usage_extra_tags) } # # JVM Memory Young Usage # resource "datadog_monitor" "jvm_memory_young_usage" { -count = var.jvm_memory_young_usage_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Young usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.jvm_memory_young_usage_message, var.message) -type = "query alert" + count = var.jvm_memory_young_usage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Young usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.jvm_memory_young_usage_message, var.message) + type = "query alert" query = < ${var.jvm_gc_old_collection_latency_threshold_critical} EOQ -thresholds = { -warning = var.jvm_gc_old_collection_latency_threshold_warning -critical = var.jvm_gc_old_collection_latency_threshold_critical -} + thresholds = { + warning = var.jvm_gc_old_collection_latency_threshold_warning + critical = var.jvm_gc_old_collection_latency_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_old_collection_latency_extra_tags) } @@ -317,10 +317,10 @@ notify_no_data = false # JVM Garbace Collector Young Collection Latency # resource "datadog_monitor" "jvm_gc_young_collection_latency" { -count = var.jvm_gc_young_collection_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Young-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.jvm_gc_young_collection_latency_message, var.message) -type = "query alert" + count = var.jvm_gc_young_collection_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Young-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.jvm_gc_young_collection_latency_message, var.message) + type = "query alert" query = < ${var.jvm_gc_young_collection_latency_threshold_critical} EOQ -thresholds = { -warning = var.jvm_gc_young_collection_latency_threshold_warning -critical = var.jvm_gc_young_collection_latency_threshold_critical -} + thresholds = { + warning = var.jvm_gc_young_collection_latency_threshold_warning + critical = var.jvm_gc_young_collection_latency_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_young_collection_latency_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_young_collection_latency_extra_tags) } # # Indexing Latency # resource "datadog_monitor" "indexing_latency" { -count = var.indexing_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average indexing time by document {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.indexing_latency_message, var.message) -type = "query alert" + count = var.indexing_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average indexing time by document {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.indexing_latency_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = <= ${var.http_connections_anomaly_threshold_critical} EOQ -thresholds = { -warning = var.http_connections_anomaly_threshold_warning -critical = var.http_connections_anomaly_threshold_critical -} + thresholds = { + warning = var.http_connections_anomaly_threshold_warning + critical = var.http_connections_anomaly_threshold_critical + } -threshold_windows = { -trigger_window = var.http_connections_anomaly_alert_window -recovery_window = var.http_connections_anomaly_alert_window -} + threshold_windows = { + trigger_window = var.http_connections_anomaly_alert_window + recovery_window = var.http_connections_anomaly_alert_window + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.http_connections_anomaly_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.http_connections_anomaly_extra_tags) } # # Query Latency # resource "datadog_monitor" "search_query_latency" { -count = var.search_query_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search query latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.search_query_latency_message, var.message) -type = "query alert" + count = var.search_query_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search query latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.search_query_latency_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.search_query_latency_threshold_critical} EOQ -thresholds = { -warning = var.search_query_latency_threshold_warning -critical = var.search_query_latency_threshold_critical -} + thresholds = { + warning = var.search_query_latency_threshold_warning + critical = var.search_query_latency_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.search_query_latency_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.search_query_latency_extra_tags) } # # Fetch Latency # resource "datadog_monitor" "fetch_latency" { -count = var.fetch_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search fetch latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.fetch_latency_message, var.message) -type = "query alert" + count = var.fetch_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search fetch latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.fetch_latency_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = <= ${var.fetch_change_threshold_critical} EOQ -thresholds = { -warning = var.fetch_change_threshold_warning -critical = var.fetch_change_threshold_critical -} + thresholds = { + warning = var.fetch_change_threshold_warning + critical = var.fetch_change_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.fetch_change_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.fetch_change_extra_tags) } # # Field Data Evictions # resource "datadog_monitor" "field_data_evictions_change" { -count = var.field_data_evictions_change_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the total number of evictions from the fielddata cache" -message = coalesce(var.field_data_evictions_change_message, var.message) -type = "query alert" + count = var.field_data_evictions_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the total number of evictions from the fielddata cache" + message = coalesce(var.field_data_evictions_change_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // 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} EOQ -thresholds = { -warning = var.field_data_evictions_change_threshold_warning -critical = var.field_data_evictions_change_threshold_critical -} + thresholds = { + warning = var.field_data_evictions_change_threshold_warning + critical = var.field_data_evictions_change_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.field_data_evictions_change_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.field_data_evictions_change_extra_tags) } # # Query Cache Evictions # resource "datadog_monitor" "query_cache_evictions_change" { -count = var.query_cache_evictions_change_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of query cache evictions" -message = coalesce(var.query_cache_evictions_change_message, var.message) -type = "query alert" + count = var.query_cache_evictions_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of query cache evictions" + message = coalesce(var.query_cache_evictions_change_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.task_time_in_queue_change_threshold_critical} EOQ -thresholds = { -warning = var.task_time_in_queue_change_threshold_warning -critical = var.task_time_in_queue_change_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false - -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.task_time_in_queue_change_extra_tags) + thresholds = { + warning = var.task_time_in_queue_change_threshold_warning + critical = var.task_time_in_queue_change_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false + + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.task_time_in_queue_change_extra_tags) } diff --git a/database/mongodb/monitors-mongo.tf b/database/mongodb/monitors-mongo.tf index cacc3ea..2c92c67 100644 --- a/database/mongodb/monitors-mongo.tf +++ b/database/mongodb/monitors-mongo.tf @@ -8,23 +8,23 @@ resource "datadog_monitor" "mongodb_primary" { ${var.mongodb_primary_aggregator}(${var.mongodb_primary_timeframe}): min:mongodb.replset.state${module.filter-tags.query_alert} by {replset_name} >= 2 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true require_full_window = true tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_primary_extra_tags) } resource "datadog_monitor" "mongodb_secondary" { - count = var.mongodb_secondary_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB secondary missing" + count = var.mongodb_secondary_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB secondary missing" message = coalesce(var.mongodb_secondary_message, var.message) - type = "query alert" + type = "query alert" query = < 1 EOQ -thresholds = { -critical = 1 -warning = 0 -} + thresholds = { + critical = 1 + warning = 0 + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + require_full_window = true -tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) } resource "datadog_monitor" "mongodb_server_count" { -count = var.mongodb_server_count_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB too much servers or wrong monitoring config" -message = coalesce(var.mongodb_server_count_message, var.message) -type = "metric alert" + count = var.mongodb_server_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB too much servers or wrong monitoring config" + message = coalesce(var.mongodb_server_count_message, var.message) + type = "metric alert" query = < 99 EOQ -thresholds = { -critical = 99 -warning = var.mongodb_desired_servers_count -} + thresholds = { + critical = 99 + warning = var.mongodb_desired_servers_count + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + require_full_window = true -tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) } resource "datadog_monitor" "mongodb_replication" { -count = var.mongodb_replication_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB replication lag" -message = coalesce(var.mongodb_replication_message, var.message) -type = "metric alert" + count = var.mongodb_replication_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB replication lag" + message = coalesce(var.mongodb_replication_message, var.message) + type = "metric alert" query = < ${var.mysql_connection_threshold_critical} EOQ -thresholds = { -warning = var.mysql_connection_threshold_warning -critical = var.mysql_connection_threshold_critical -} + thresholds = { + warning = var.mysql_connection_threshold_warning + critical = var.mysql_connection_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_connection_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_connection_extra_tags) } resource "datadog_monitor" "mysql_aborted" { -count = var.mysql_aborted_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.mysql_aborted_message, var.message) -type = "query alert" + count = var.mysql_aborted_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.mysql_aborted_message, var.message) + type = "query alert" query = < ${var.mysql_aborted_threshold_critical} EOQ -thresholds = { -warning = var.mysql_aborted_threshold_warning -critical = var.mysql_aborted_threshold_critical -} + thresholds = { + warning = var.mysql_aborted_threshold_warning + critical = var.mysql_aborted_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_aborted_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_aborted_extra_tags) } resource "datadog_monitor" "mysql_slow" { -count = var.mysql_slow_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.mysql_slow_message, var.message) -type = "query alert" + count = var.mysql_slow_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.mysql_slow_message, var.message) + type = "query alert" query = < ${var.mysql_pool_utilization_threshold_critical} EOQ -thresholds = { -warning = var.mysql_pool_utilization_threshold_warning -critical = var.mysql_pool_utilization_threshold_critical -} + thresholds = { + warning = var.mysql_pool_utilization_threshold_warning + critical = var.mysql_pool_utilization_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_pool_utilization_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_pool_utilization_extra_tags) } resource "datadog_monitor" "mysql_threads_anomaly" { -count = var.mysql_threads_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" -message = coalesce(var.mysql_threads_message, var.message) -type = "metric alert" + count = var.mysql_threads_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" + message = coalesce(var.mysql_threads_message, var.message) + type = "metric alert" query = <= ${var.mysql_threads_threshold_critical} EOQ -thresholds = { -critical = var.mysql_threads_threshold_critical -critical_recovery = 0 -} + thresholds = { + critical = var.mysql_threads_threshold_critical + critical_recovery = 0 + } -threshold_windows = { -trigger_window = var.mysql_threads_alert_window -recovery_window = var.mysql_threads_alert_window -} + threshold_windows = { + trigger_window = var.mysql_threads_alert_window + recovery_window = var.mysql_threads_alert_window + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_threads_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_threads_extra_tags) } resource "datadog_monitor" "mysql_questions_anomaly" { -count = var.mysql_questions_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" -message = coalesce(var.mysql_questions_message, var.message) -type = "metric alert" + count = var.mysql_questions_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" + message = coalesce(var.mysql_questions_message, var.message) + type = "metric alert" query = < ${var.postgresql_connection_threshold_critical} EOQ -thresholds = { -warning = var.postgresql_connection_threshold_warning -critical = var.postgresql_connection_threshold_critical -} + thresholds = { + warning = var.postgresql_connection_threshold_warning + critical = var.postgresql_connection_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_connection_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_connection_extra_tags) } resource "datadog_monitor" "postgresql_too_many_locks" { -count = var.postgresql_lock_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.postgresql_lock_message, var.message) -type = "query alert" + count = var.postgresql_lock_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.postgresql_lock_message, var.message) + type = "query alert" query = < ${var.postgresql_lock_threshold_critical} EOQ -thresholds = { -warning = var.postgresql_lock_threshold_warning -critical = var.postgresql_lock_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true - -tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_lock_extra_tags) + thresholds = { + warning = var.postgresql_lock_threshold_warning + critical = var.postgresql_lock_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true + + tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_lock_extra_tags) } diff --git a/database/redis/monitors-redis.tf b/database/redis/monitors-redis.tf index baa501c..6352db8 100644 --- a/database/redis/monitors-redis.tf +++ b/database/redis/monitors-redis.tf @@ -12,28 +12,28 @@ resource "datadog_monitor" "not_responding" { EOQ thresholds = { - warning = var.not_responding_threshold_warning + warning = var.not_responding_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - no_data_timeframe = var.not_responding_no_data_timeframe - notify_no_data = true - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + new_host_delay = var.new_host_delay + no_data_timeframe = var.not_responding_no_data_timeframe + notify_no_data = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = true - renotify_interval = 0 + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.not_responding_extra_tags) } resource "datadog_monitor" "evicted_keys" { - count = var.evictedkeys_change_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}" + count = var.evictedkeys_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}" message = coalesce(var.evictedkeys_change_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.evictedkeys_change_threshold_critical} EOQ -thresholds = { -warning = var.evictedkeys_change_threshold_warning -critical = var.evictedkeys_change_threshold_critical -} + thresholds = { + warning = var.evictedkeys_change_threshold_warning + critical = var.evictedkeys_change_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_change_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_change_extra_tags) } resource "datadog_monitor" "expirations" { -count = var.expirations_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.expirations_rate_message, var.message) -type = "query alert" + count = var.expirations_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.expirations_rate_message, var.message) + type = "query alert" query = < ${var.expirations_rate_threshold_critical} EOQ -thresholds = { -warning = var.expirations_rate_threshold_warning -critical = var.expirations_rate_threshold_critical -} + thresholds = { + warning = var.expirations_rate_threshold_warning + critical = var.expirations_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.expirations_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.expirations_rate_extra_tags) } resource "datadog_monitor" "blocked_clients" { -count = var.blocked_clients_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.blocked_clients_message, var.message) -type = "query alert" + count = var.blocked_clients_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.blocked_clients_message, var.message) + type = "query alert" query = < ${var.mem_used_threshold_critical} EOQ -thresholds = { -warning = var.mem_used_threshold_warning -critical = var.mem_used_threshold_critical -} + thresholds = { + warning = var.mem_used_threshold_warning + critical = var.mem_used_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_used_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_used_extra_tags) } resource "datadog_monitor" "memory_frag" { -count = var.mem_frag_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.mem_frag_message, var.message) -type = "query alert" + count = var.mem_frag_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.mem_frag_message, var.message) + type = "query alert" query = < ${var.mem_frag_threshold_critical} EOQ -thresholds = { -warning = var.mem_frag_threshold_warning -critical = var.mem_frag_threshold_critical -} + thresholds = { + warning = var.mem_frag_threshold_warning + critical = var.mem_frag_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_frag_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_frag_extra_tags) } resource "datadog_monitor" "rejected_connections" { -count = var.rejected_con_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.rejected_con_message, var.message) -type = "query alert" + count = var.rejected_con_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.rejected_con_message, var.message) + type = "query alert" query = < ${var.nginx_dropped_threshold_critical} EOQ -thresholds = { -critical = var.nginx_dropped_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform"], var.nginx_dropped_extra_tags) + thresholds = { + critical = var.nginx_dropped_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform"], var.nginx_dropped_extra_tags) } diff --git a/middleware/php-fpm/monitors-fpm.tf b/middleware/php-fpm/monitors-fpm.tf index 44f5b20..11e6323 100644 --- a/middleware/php-fpm/monitors-fpm.tf +++ b/middleware/php-fpm/monitors-fpm.tf @@ -9,28 +9,28 @@ resource "datadog_monitor" "php_fpm_connect" { EOQ thresholds = { - warning = var.php_fpm_connect_threshold_warning + warning = var.php_fpm_connect_threshold_warning critical = 5 } - no_data_timeframe = var.php_fpm_connect_no_data_timeframe - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + no_data_timeframe = var.php_fpm_connect_no_data_timeframe + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_connect_extra_tags) } resource "datadog_monitor" "php_fpm_connect_idle" { - count = var.php_fpm_busy_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Php-fpm busy worker {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.php_fpm_busy_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Php-fpm busy worker {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.php_fpm_busy_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.php_fpm_busy_threshold_critical} EOQ -thresholds = { -warning = var.php_fpm_busy_threshold_warning -critical = var.php_fpm_busy_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_busy_extra_tags) + thresholds = { + warning = var.php_fpm_busy_threshold_warning + critical = var.php_fpm_busy_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_busy_extra_tags) } diff --git a/system/generic/monitors-system.tf b/system/generic/monitors-system.tf index 192c038..d61bc0e 100644 --- a/system/generic/monitors-system.tf +++ b/system/generic/monitors-system.tf @@ -11,27 +11,27 @@ resource "datadog_monitor" "cpu" { EOQ thresholds = { - warning = var.cpu_threshold_warning + warning = var.cpu_threshold_warning critical = var.cpu_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "load" { - count = var.load_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU load 5 ratio {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + count = var.load_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU load 5 ratio {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = coalesce(var.load_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.load_threshold_critical} EOQ -thresholds = { -warning = var.load_threshold_warning -critical = var.load_threshold_critical -} + thresholds = { + warning = var.load_threshold_warning + critical = var.load_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true -tags = concat(["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform"], var.load_extra_tags) + tags = concat(["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform"], var.load_extra_tags) } resource "datadog_monitor" "disk_space" { -count = var.disk_space_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.disk_space_message, var.message) -type = "query alert" + count = var.disk_space_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_space_message, var.message) + type = "query alert" query = < ${var.disk_space_threshold_critical} EOQ -thresholds = { -warning = var.disk_space_threshold_warning -critical = var.disk_space_threshold_critical -} + thresholds = { + warning = var.disk_space_threshold_warning + critical = var.disk_space_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true -tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_space_extra_tags) + tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_space_extra_tags) } resource "datadog_monitor" "disk_space_forecast" { -count = var.disk_space_forecast_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk Space usage could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" -message = coalesce(var.disk_space_forecast_message, var.message) -type = "query alert" + count = var.disk_space_forecast_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk Space usage could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" + message = coalesce(var.disk_space_forecast_message, var.message) + type = "query alert" query = <