Merged in MON-290-monitors-for-php-fpm (pull request #150)

MON-290 make the status monitor more tolerant

Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr>
Approved-by: Rafael Romero Carmona <rafael.romero.carmona@fr.clara.net>
Approved-by: Adrien Broyere <adrien.broyere@fr.clara.net>
Approved-by: Jean-Philippe LAINÉ <jean-philippe.laine@fr.clara.net>
This commit is contained in:
Quentin Manfroi 2018-09-14 13:08:05 +00:00
commit 62ebd3aa0d
4 changed files with 62 additions and 48 deletions

View File

@ -37,17 +37,19 @@ 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
| 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

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,4 +1,35 @@
resource "datadog_monitor" "datadog_php_fpm_connect_idle" {
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)}"
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" "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)}"
@ -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 "php_fpm_connect_id" {
description = "id for monitor php_fpm_connect"
value = "${datadog_monitor.php_fpm_connect.*.id}"
}
output "datadog_fpm_process_id" {
description = "id for monitor datadog_fpm_process"
value = "${datadog_monitor.datadog_fpm_process.*.id}"
output "php_fpm_connect_idle_id" {
description = "id for monitor php_fpm_connect_idle"
value = "${datadog_monitor.php_fpm_connect_idle.*.id}"
}