From febc38eec7e284dedc92f6629612b5e0da210a49 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Wed, 21 Feb 2018 16:55:06 +0100 Subject: [PATCH] MON-96 - Apply conventions and update middleware directory --- .../elasticsearch/monitors-elasticsearch.tf | 7 ++- middleware/apache/README.md | 30 ++++++++++ middleware/apache/inputs.tf | 22 +++++++- middleware/apache/monitors-apache.tf | 15 +++-- middleware/nginx/README.md | 30 ++++++++++ middleware/nginx/inputs.tf | 22 +++++++- middleware/nginx/monitors-nginx.tf | 15 +++-- middleware/php-fpm/README.md | 35 ++++++++++++ middleware/php-fpm/inputs.tf | 43 ++++++++++++++- middleware/php-fpm/monitors-fpm.tf | 55 +++++++++++-------- 10 files changed, 230 insertions(+), 44 deletions(-) create mode 100644 middleware/apache/README.md mode change 120000 => 100644 middleware/apache/inputs.tf create mode 100644 middleware/nginx/README.md mode change 120000 => 100644 middleware/nginx/inputs.tf create mode 100644 middleware/php-fpm/README.md mode change 120000 => 100644 middleware/php-fpm/inputs.tf diff --git a/cloud/aws/elasticsearch/monitors-elasticsearch.tf b/cloud/aws/elasticsearch/monitors-elasticsearch.tf index 7ba3aa2..8880a02 100644 --- a/cloud/aws/elasticsearch/monitors-elasticsearch.tf +++ b/cloud/aws/elasticsearch/monitors-elasticsearch.tf @@ -42,14 +42,15 @@ EOF ### Elasticsearch cluster free storage space monitor ### resource "datadog_monitor" "es_free_space_low" { - name = "[${var.environment}] ElasticSearch cluster free storage space < ${var.diskspace_threshold_critical}%" + name = "[${var.environment}] ElasticSearch cluster free storage space {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)" message = "${var.message}" type = "query alert" query = < ${var.php_fpm_busy_threshold_critical} + EOF thresholds { - warning = "${var.php_fpm_busy_threshold["warning"]}" - critical = "${var.php_fpm_busy_threshold["critical"]}" + warning = "${var.php_fpm_busy_threshold_warning}" + critical = "${var.php_fpm_busy_threshold_critical}" } - notify_no_data = "${var.apache_nginx_fpm_config["notify_no_data"]}" - evaluation_delay = "${var.apache_nginx_fpm_config["delay"]}" - new_host_delay = "${var.apache_nginx_fpm_config["delay"]}" - renotify_interval = 60 + notify_no_data = false + evaluation_delay = "${var.evaluation_delay_metric}" + new_host_delay = "${var.evaluation_delay_metric}" notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = true - renotify_interval = 0 no_data_timeframe = 20 - tags = ["env:${var.env}", "type:php-fpm"] + tags = ["env:${var.environment}", "type:php-fpm"] } resource "datadog_monitor" "FPM_process" { - name = "[${var.env}] FPM process is down on {{host.name}}" - message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group}\n{{/is_recovery}}\n{{#is_warning}}\n${var.ho_escalation_group} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.ho_escalation_group}\n{{/is_warning_recovery}}" + name = "[${var.environment}] FPM process is down on {{host.name}}" + message = "${var.message}" type = "service check" - query = "\"process.up\".over(\"dd_monitoring:enabled\",\"dd_php_fpm:enabled\",\"process:php_fpm\",\"env:${var.env}\").by(\"host\",\"process\", \"app\").last(4).count_by_status()" - count = "${var.dd_nginx == "enabled" ? 1 : 0 }" + query = "\"process.up\".over(\"dd_monitoring:enabled\",\"dd_php_fpm:enabled\",\"process:php_fpm\",\"env:${var.environment}\").by(\"host\",\"process\", \"app\").last(4).count_by_status()" thresholds = { ok = 1 @@ -40,9 +51,9 @@ resource "datadog_monitor" "FPM_process" { critical = 4 } - notify_no_data = "${var.apache_nginx_fpm_config["notify_no_data"]}" - evaluation_delay = "${var.apache_nginx_fpm_config["delay"]}" - new_host_delay = "${var.apache_nginx_fpm_config["delay"]}" + notify_no_data = true + evaluation_delay = "${var.evaluation_delay_service}" + new_host_delay = "${var.evaluation_delay_service}" renotify_interval = 60 notify_audit = false timeout_h = 0 @@ -51,5 +62,5 @@ resource "datadog_monitor" "FPM_process" { require_full_window = true no_data_timeframe = 20 - tags = ["env:${var.env}", "type:php-fpm"] + tags = ["env:${var.environment}", "type:php-fpm"] }