MON-290 make the status monitor more tolerant

This commit is contained in:
Quentin Manfroi 2018-09-11 13:25:28 +02:00
parent 391240f597
commit c3ef50e1b9
4 changed files with 58 additions and 44 deletions

View File

@ -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 | `<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 | `<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 | `<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 | `<map>` | no |
| php_fpm_connect_threshold_warning | PHP FPM status monitor (warning threshold) | string | `3` | no |
## Outputs

View File

@ -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
}

View File

@ -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 = <<EOF
"php_fpm.can_ping".over${module.filter-tags.service_check}.by("ping_url").last(6).count_by_status()
EOF
thresholds = {
warning = "${var.php_fpm_connect_threshold_warning}"
critical = 5
}
notify_no_data = true
no_data_timeframe = "${var.php_fpm_connect_no_data_timeframe}"
new_host_delay = "${var.new_host_delay}"
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
locked = false
require_full_window = true
silenced = "${var.php_fpm_connect_silenced}"
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" {
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}}"
@ -31,34 +62,3 @@ resource "datadog_monitor" "datadog_php_fpm_connect_idle" {
tags = ["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform", "${var.php_fpm_busy_extra_tags}"]
}
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 = <<EOF
"php_fpm.can_ping".over${module.filter-tags.service_check}.by("host","ping_url").last(6).count_by_status()
EOF
thresholds = {
ok = 1
warning = 2
critical = 5
}
notify_no_data = true
new_host_delay = "${var.new_host_delay}"
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
locked = false
require_full_window = true
silenced = "${var.php_fpm_connect_silenced}"
tags = ["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform", "${var.php_fpm_connect_extra_tags}"]
}

View File

@ -1,9 +1,9 @@
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 "datadog_fpm_process_id" {
description = "id for monitor datadog_fpm_process"
value = "${datadog_monitor.datadog_fpm_process.*.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}"
}