From c3ef50e1b900acde209559be2fafe8acca3d51e7 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Tue, 11 Sep 2018 13:25:28 +0200 Subject: [PATCH 1/2] MON-290 make the status monitor more tolerant --- middleware/php-fpm/README.md | 10 +++-- middleware/php-fpm/inputs.tf | 20 ++++++++-- middleware/php-fpm/monitors-fpm.tf | 62 +++++++++++++++--------------- middleware/php-fpm/outputs.tf | 10 ++--- 4 files changed, 58 insertions(+), 44 deletions(-) diff --git a/middleware/php-fpm/README.md b/middleware/php-fpm/README.md index fbf269b..4b4ab24 100644 --- a/middleware/php-fpm/README.md +++ b/middleware/php-fpm/README.md @@ -37,10 +37,12 @@ Creates DataDog monitors with the following checks: | php_fpm_busy_threshold_warning | php fpm busy warning threshold | string | `80` | no | | php_fpm_busy_time_aggregator | Monitor aggregator for PHP FPM busy worker [available values: min, max or avg] | string | `avg` | no | | php_fpm_busy_timeframe | Monitor timeframe for PHP FPM busy worker [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_10m` | no | -| php_fpm_connect_enabled | Flag to enable PHP FPM process monitor | string | `true` | no | -| php_fpm_connect_extra_tags | Extra tags for PHP FPM process monitor | list | `` | no | -| php_fpm_connect_message | Custom message for PHP FPM process monitor | string | `` | no | -| php_fpm_connect_silenced | Groups to mute for PHP FPM process monitor | map | `` | no | +| php_fpm_connect_enabled | Flag to enable PHP FPM status monitor | string | `true` | no | +| php_fpm_connect_extra_tags | Extra tags for PHP FPM status monitor | list | `` | no | +| php_fpm_connect_message | Custom message for PHP FPM status monitor | string | `` | no | +| php_fpm_connect_no_data_timeframe | PHP FPM status monitor no data timeframe | string | `10` | no | +| php_fpm_connect_silenced | Groups to mute for PHP FPM status monitor | map | `` | no | +| php_fpm_connect_threshold_warning | PHP FPM status monitor (warning threshold) | string | `3` | no | ## Outputs diff --git a/middleware/php-fpm/inputs.tf b/middleware/php-fpm/inputs.tf index 9fbeb84..96c6e5e 100644 --- a/middleware/php-fpm/inputs.tf +++ b/middleware/php-fpm/inputs.tf @@ -78,25 +78,37 @@ variable "php_fpm_busy_threshold_critical" { } variable "php_fpm_connect_silenced" { - description = "Groups to mute for PHP FPM process monitor" + description = "Groups to mute for PHP FPM status monitor" type = "map" default = {} } variable "php_fpm_connect_enabled" { - description = "Flag to enable PHP FPM process monitor" + description = "Flag to enable PHP FPM status monitor" type = "string" default = "true" } variable "php_fpm_connect_extra_tags" { - description = "Extra tags for PHP FPM process monitor" + description = "Extra tags for PHP FPM status monitor" type = "list" default = [] } variable "php_fpm_connect_message" { - description = "Custom message for PHP FPM process monitor" + description = "Custom message for PHP FPM status monitor" type = "string" default = "" } + +variable "php_fpm_connect_threshold_warning" { + description = "PHP FPM status monitor (warning threshold)" + type = "string" + default = 3 +} + +variable "php_fpm_connect_no_data_timeframe" { + description = "PHP FPM status monitor no data timeframe" + type = "string" + default = 10 +} diff --git a/middleware/php-fpm/monitors-fpm.tf b/middleware/php-fpm/monitors-fpm.tf index cb74a08..15ce0d1 100644 --- a/middleware/php-fpm/monitors-fpm.tf +++ b/middleware/php-fpm/monitors-fpm.tf @@ -1,3 +1,34 @@ +resource "datadog_monitor" "datadog_fpm_process" { + count = "${var.php_fpm_connect_enabled ? 1 : 0}" + name = "[${var.environment}] Php-fpm ping url does not respond" + message = "${coalesce(var.php_fpm_connect_message, var.message)}" + + type = "service check" + + query = < Date: Tue, 11 Sep 2018 16:02:50 +0200 Subject: [PATCH 2/2] MON-290 fix naming --- middleware/php-fpm/README.md | 4 ++-- middleware/php-fpm/monitors-fpm.tf | 4 ++-- middleware/php-fpm/outputs.tf | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/middleware/php-fpm/README.md b/middleware/php-fpm/README.md index 4b4ab24..f7b5a38 100644 --- a/middleware/php-fpm/README.md +++ b/middleware/php-fpm/README.md @@ -48,8 +48,8 @@ Creates DataDog monitors with the following checks: | Name | Description | |------|-------------| -| datadog_fpm_process_id | id for monitor datadog_fpm_process | -| datadog_php_fpm_connect_idle_id | id for monitor datadog_php_fpm_connect_idle | +| php_fpm_connect_id | id for monitor php_fpm_connect | +| php_fpm_connect_idle_id | id for monitor php_fpm_connect_idle | ## Related documentation diff --git a/middleware/php-fpm/monitors-fpm.tf b/middleware/php-fpm/monitors-fpm.tf index 15ce0d1..50facf9 100644 --- a/middleware/php-fpm/monitors-fpm.tf +++ b/middleware/php-fpm/monitors-fpm.tf @@ -1,4 +1,4 @@ -resource "datadog_monitor" "datadog_fpm_process" { +resource "datadog_monitor" "php_fpm_connect" { count = "${var.php_fpm_connect_enabled ? 1 : 0}" name = "[${var.environment}] Php-fpm ping url does not respond" message = "${coalesce(var.php_fpm_connect_message, var.message)}" @@ -29,7 +29,7 @@ resource "datadog_monitor" "datadog_fpm_process" { tags = ["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" "datadog_php_fpm_connect_idle" { +resource "datadog_monitor" "php_fpm_connect_idle" { count = "${var.php_fpm_busy_enabled ? 1 : 0}" name = "[${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)}" diff --git a/middleware/php-fpm/outputs.tf b/middleware/php-fpm/outputs.tf index f70420c..5aa48d2 100644 --- a/middleware/php-fpm/outputs.tf +++ b/middleware/php-fpm/outputs.tf @@ -1,9 +1,9 @@ -output "datadog_fpm_process_id" { - description = "id for monitor datadog_fpm_process" - value = "${datadog_monitor.datadog_fpm_process.*.id}" +output "php_fpm_connect_id" { + description = "id for monitor php_fpm_connect" + value = "${datadog_monitor.php_fpm_connect.*.id}" } -output "datadog_php_fpm_connect_idle_id" { - description = "id for monitor datadog_php_fpm_connect_idle" - value = "${datadog_monitor.datadog_php_fpm_connect_idle.*.id}" +output "php_fpm_connect_idle_id" { + description = "id for monitor php_fpm_connect_idle" + value = "${datadog_monitor.php_fpm_connect_idle.*.id}" }