Merged in MON-289-monitors-for-nginx (pull request #133)
MON-289 add dropped connections monitor Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr> Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net> Approved-by: Jérôme Respaut <shr3ps@gmail.com> Approved-by: Jean-Philippe LAINÉ <jean-philippe.laine@fr.clara.net>
This commit is contained in:
commit
86981e8287
@ -16,6 +16,7 @@ module "datadog-monitors-middleware-nginx" {
|
|||||||
|
|
||||||
Creates DataDog monitors with the following checks:
|
Creates DataDog monitors with the following checks:
|
||||||
|
|
||||||
|
- Nginx dropped connections
|
||||||
- Nginx vhost status does not respond
|
- Nginx vhost status does not respond
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
@ -33,11 +34,18 @@ Creates DataDog monitors with the following checks:
|
|||||||
| nginx_connect_message | Custom message for Nginx status monitor | string | `` | no |
|
| nginx_connect_message | Custom message for Nginx status monitor | string | `` | no |
|
||||||
| nginx_connect_silenced | Groups to mute for Nginx status monitor | map | `<map>` | no |
|
| nginx_connect_silenced | Groups to mute for Nginx status monitor | map | `<map>` | no |
|
||||||
| nginx_connect_threshold_critical | Nginx status monitor (critical threshold) | string | `1.1754943508222875e-38` | no |
|
| nginx_connect_threshold_critical | Nginx status monitor (critical threshold) | string | `1.1754943508222875e-38` | no |
|
||||||
|
| nginx_dropped_extra_tags | Extra tags for Nginx dropped connections monitor | list | `<list>` | no |
|
||||||
|
| nginx_dropped_message | Custom message for Nginx dropped connections monitor | string | `` | no |
|
||||||
|
| nginx_dropped_silenced | Groups to mute for Nginx dropped connections monitor | map | `<map>` | no |
|
||||||
|
| nginx_dropped_threshold_critical | Nginx dropped connections critical threshold | string | `0` | no |
|
||||||
|
| nginx_dropped_time_aggregator | Monitor aggregator for Nginx dropped connections [available values: min, max or avg] | string | `min` | no |
|
||||||
|
| nginx_dropped_timeframe | Monitor timeframe for Nginx dropped connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
|
| datadog_nginx_dropped_connections_id | id for monitor datadog_nginx_dropped_connections |
|
||||||
| datadog_nginx_process_id | id for monitor datadog_nginx_process |
|
| datadog_nginx_process_id | id for monitor datadog_nginx_process |
|
||||||
|
|
||||||
## Related documentation
|
## Related documentation
|
||||||
|
|||||||
@ -60,3 +60,38 @@ variable "nginx_connect_threshold_critical" {
|
|||||||
type = "string"
|
type = "string"
|
||||||
default = "1.1754943508222875e-38"
|
default = "1.1754943508222875e-38"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "nginx_dropped_silenced" {
|
||||||
|
description = "Groups to mute for Nginx dropped connections monitor"
|
||||||
|
type = "map"
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nginx_dropped_extra_tags" {
|
||||||
|
description = "Extra tags for Nginx dropped connections monitor"
|
||||||
|
type = "list"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nginx_dropped_message" {
|
||||||
|
description = "Custom message for Nginx dropped connections monitor"
|
||||||
|
type = "string"
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nginx_dropped_time_aggregator" {
|
||||||
|
description = "Monitor aggregator for Nginx dropped connections [available values: min, max or avg]"
|
||||||
|
type = "string"
|
||||||
|
default = "min"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nginx_dropped_timeframe" {
|
||||||
|
description = "Monitor timeframe for Nginx dropped connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||||
|
type = "string"
|
||||||
|
default = "last_5m"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "nginx_dropped_threshold_critical" {
|
||||||
|
description = "Nginx dropped connections critical threshold"
|
||||||
|
default = 0
|
||||||
|
}
|
||||||
|
|||||||
@ -27,3 +27,29 @@ resource "datadog_monitor" "datadog_nginx_process" {
|
|||||||
|
|
||||||
tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", "${var.nginx_connect_extra_tags}"]
|
tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", "${var.nginx_connect_extra_tags}"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "datadog_monitor" "datadog_nginx_dropped_connections" {
|
||||||
|
name = "[${var.environment}] Nginx dropped connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}"
|
||||||
|
message = "${coalesce(var.nginx_dropped_message, var.message)}"
|
||||||
|
|
||||||
|
type = "metric alert"
|
||||||
|
|
||||||
|
query = "${var.nginx_dropped_time_aggregator}(${var.nginx_dropped_timeframe}):avg:nginx.net.conn_dropped_per_s${module.filter-tags.query_alert} by {host} > ${var.nginx_dropped_threshold_critical}"
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
critical = "${var.nginx_dropped_threshold_critical}"
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_no_data = false
|
||||||
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
new_host_delay = "${var.new_host_delay}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = true
|
||||||
|
|
||||||
|
silenced = "${var.nginx_dropped_silenced}"
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", "${var.nginx_dropped_extra_tags}"]
|
||||||
|
}
|
||||||
|
|||||||
@ -2,3 +2,8 @@ output "datadog_nginx_process_id" {
|
|||||||
description = "id for monitor datadog_nginx_process"
|
description = "id for monitor datadog_nginx_process"
|
||||||
value = "${datadog_monitor.datadog_nginx_process.*.id}"
|
value = "${datadog_monitor.datadog_nginx_process.*.id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "datadog_nginx_dropped_connections_id" {
|
||||||
|
description = "id for monitor datadog_nginx_dropped_connections"
|
||||||
|
value = "${datadog_monitor.datadog_nginx_dropped_connections.*.id}"
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user