MON-105 add enabled feature

This commit is contained in:
Quentin Manfroi 2018-09-18 14:13:52 +02:00
parent c26741ebc9
commit abab6aa763
3 changed files with 18 additions and 4 deletions

View File

@ -31,11 +31,11 @@ Inputs
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
| postgresql_connection_threshold_critical | Maximum critical acceptable percent of connections | string | `80` | no |
| postgresql_connection_threshold_warning | Maximum warning acceptable percent of connections | string | `70` | no |
| postgresql_connection_silenced | Groups to mute PostgreSQL connection monitor | map | `<map>` | no |
| postgresql_connection_silenced | Groups to mute for PostgreSQL connection monitor | map | `<map>` | no |
| postgresql_connection_message | Custom message for PostgreSQL connection monitor | string | `` | no |
| postgresql_thread_threshold_critical | Maximum critical acceptable number of threads | string | `500` | no |
| postgresql_thread_threshold_warning | Maximum warning acceptable number of threads | string | `400` | no |
| postgresql_thread_silenced | Groups to mute PostgreSQL threads monitor | map | `<map>` | no |
| postgresql_thread_silenced | Groups to mute for PostgreSQL threads monitor | map | `<map>` | no |
| postgresql_thread_message | Custom message for PostgreSQL thread monitor | string | `` | no |
| message | Message sent when a monitor is triggered | string | - | yes |

View File

@ -39,11 +39,17 @@ variable "postgresql_connection_threshold_warning" {
}
variable "postgresql_connection_silenced" {
description = "Groups to mute PostgreSQL connection monitor"
description = "Groups to mute for PostgreSQL connection monitor"
type = "map"
default = {}
}
variable "postgresql_connection_enabled" {
description = "Flag to enable PostgreSQL connection monitor"
type = "string"
default = "true"
}
variable "postgresql_connection_message" {
description = "Custom message for PostgreSQL connection monitor"
type = "string"
@ -65,11 +71,17 @@ variable "postgresql_lock_threshold_warning" {
}
variable "posgresql_lock_silenced" {
description = "Groups to mute PostgreSQL lock monitor"
description = "Groups to mute for PostgreSQL lock monitor"
type = "map"
default = {}
}
variable "postgresql_lock_enabled" {
description = "Flag to enable PostgreSQL lock monitor"
type = "string"
default = "true"
}
variable "postgresql_lock_message" {
description = "Custom message for PostgreSQL lock monitor"
type = "string"

View File

@ -7,6 +7,7 @@ data "template_file" "filter" {
}
resource "datadog_monitor" "postgresql_connection_too_high" {
count = "${var.postgresql_connection_enabled ? 1 : 0}"
name = "[${var.environment}] PostgreSQL Connections {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.postgresql_connection_message, var.message)}"
type = "metric alert"
@ -37,6 +38,7 @@ resource "datadog_monitor" "postgresql_connection_too_high" {
}
resource "datadog_monitor" "postgresql_too_many_locks" {
count = "${var.postgresql_lock_enabled ? 1 : 0}"
name = "[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}"
message = "${coalesce(var.postgresql_lock_message, var.message)}"
type = "metric alert"