MON-96 - Update middleware monitors with EOF best practice
This commit is contained in:
parent
999019339c
commit
84f4e8d5ba
@ -24,8 +24,10 @@ Inputs
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| apache_process_message | Custom message for Apache process monitor | string | `` | no |
|
||||
| apache_process_silenced | Groups to mute for Apache process monitor | map | `<map>` | no |
|
||||
| apache_connect_message | Custom message for Apache process monitor | string | `` | no |
|
||||
| apache_connect_silenced | Groups to mute for Apache process monitor | map | `<map>` | no |
|
||||
| environment | Architecture Environment | string | - | yes |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `15` | no |
|
||||
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||
| message | Message sent when an alert is triggered | string | - | yes |
|
||||
@ -14,6 +14,16 @@ variable "message" {
|
||||
description = "Message sent when an alert is triggered"
|
||||
}
|
||||
|
||||
variable "filter_tags_use_defaults" {
|
||||
description = "Use default filter tags convention"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
# Apache Middleware specific
|
||||
|
||||
variable "apache_connect_silenced" {
|
||||
|
||||
@ -1,9 +1,20 @@
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_apache:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "datadog_apache_process" {
|
||||
name = "[${var.environment}] Can't connect to apache vhost status"
|
||||
message = "${coalesce(var.apache_connect_message, var.message)}"
|
||||
|
||||
type = "service check"
|
||||
query = "\"apache.can_connect\".over(\"dd_monitoring:enabled\",\"dd_apache:enabled\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
||||
type = "service check"
|
||||
|
||||
query = <<EOF
|
||||
"apache.can_connect".over(${data.template_file.filter.rendered}).by("host","port").last(6).count_by_status()
|
||||
EOF
|
||||
|
||||
thresholds = {
|
||||
ok = 1
|
||||
|
||||
@ -26,6 +26,8 @@ Inputs
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| environment | Architecture Environment | string | - | yes |
|
||||
| evaluation_delay | Delay in seconds for the metric evaluation | string | `15` | no |
|
||||
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
|
||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||
| message | Message sent when an alert is triggered | string | - | yes |
|
||||
| nginx_process_message | Custom message for Nginx process monitor | string | `` | no |
|
||||
| nginx_process_silenced | Groups to mute for Nginx process monitor | map | `<map>` | no |
|
||||
| nginx_connect_message | Custom message for Nginx process monitor | string | `` | no |
|
||||
| nginx_connect_silenced | Groups to mute for Nginx process monitor | map | `<map>` | no |
|
||||
@ -14,6 +14,16 @@ variable "message" {
|
||||
description = "Message sent when an alert is triggered"
|
||||
}
|
||||
|
||||
variable "filter_tags_use_defaults" {
|
||||
description = "Use default filter tags convention"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
# Nginx Middleware specific
|
||||
|
||||
variable "nginx_connect_silenced" {
|
||||
|
||||
@ -1,9 +1,20 @@
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_nginx:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "datadog_nginx_process" {
|
||||
name = "[${var.environment}] Can't connect to nginx vhost status"
|
||||
message = "${coalesce(var.nginx_connect_message, var.message)}"
|
||||
|
||||
type = "service check"
|
||||
query = "\"nginx.can_connect\".over(\"dd_monitoring:enabled\",\"dd_nginx:enabled\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
||||
type = "service check"
|
||||
|
||||
query = <<EOF
|
||||
"nginx.can_connect".over(${data.template_file.filter.rendered}).by("host","port").last(6).count_by_status()
|
||||
EOF
|
||||
|
||||
thresholds = {
|
||||
ok = 1
|
||||
|
||||
@ -35,5 +35,5 @@ Inputs
|
||||
| php_fpm_busy_silenced | Groups to mute for PHP FPM busy worker monitor | map | `<map>` | no |
|
||||
| php_fpm_busy_threshold_critical | php fpm busy critical threshold | string | `0.9` | no |
|
||||
| php_fpm_busy_threshold_warning | php fpm busy warning threshold | string | `0.8` | no |
|
||||
| php_fpm_process_message | Custom message for PHP FPM process monitor | string | `` | no |
|
||||
| php_fpm_process_silenced | Groups to mute for PHP FPM process monitor | map | `<map>` | 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 |
|
||||
@ -44,8 +44,11 @@ resource "datadog_monitor" "datadog_fpm_process" {
|
||||
name = "[${var.environment}] Can't connect to php-fpm"
|
||||
message = "${coalesce(var.php_fpm_connect_message, var.message)}"
|
||||
|
||||
type = "service check"
|
||||
query = "\"php_fpm.can_ping\".over(\"dd_monitoring:enabled\",\"dd_php_fpm:enabled\",\"env:${var.environment}\").by(\"host\",\"port\").last(6).count_by_status()"
|
||||
type = "service check"
|
||||
|
||||
query = <<EOF
|
||||
"php_fpm.can_ping".over(${data.template_file.filter.rendered}).by("host","port").last(6).count_by_status()
|
||||
EOF
|
||||
|
||||
thresholds = {
|
||||
ok = 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user