MON-105 variable for timeframe and time aggregator
This commit is contained in:
parent
8bb14e6792
commit
ee5a4cf236
@ -61,6 +61,19 @@ variable "postgresql_connection_message" {
|
|||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "postgresql_connection_time_aggregator" {
|
||||||
|
description = "Monitor time aggregator for PostgreSQL connection monitor [available values: min, max or avg]"
|
||||||
|
type = "string"
|
||||||
|
default = "avg"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "postgresql_connection_timeframe" {
|
||||||
|
description = "Monitor timeframe for PostgreSQL connection monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||||
|
type = "string"
|
||||||
|
default = "last_15m"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
### PostgreSQL locks ###
|
### PostgreSQL locks ###
|
||||||
############################
|
############################
|
||||||
@ -92,3 +105,17 @@ variable "postgresql_lock_message" {
|
|||||||
type = "string"
|
type = "string"
|
||||||
default = ""
|
default = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "postgresql_lock_time_aggregator" {
|
||||||
|
description = "Monitor time aggregator for PostgreSQL lock monitor [available values: min, max or avg]"
|
||||||
|
type = "string"
|
||||||
|
default = "min"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "postgresql_lock_timeframe" {
|
||||||
|
description = "Monitor timeframe for PostgreSQL lock monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||||
|
type = "string"
|
||||||
|
default = "last_5m"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,9 +5,9 @@ resource "datadog_monitor" "postgresql_connection_too_high" {
|
|||||||
type = "metric alert"
|
type = "metric alert"
|
||||||
|
|
||||||
query = <<EOF
|
query = <<EOF
|
||||||
avg(last_15m): (
|
${var.postgresql_connection_time_aggregator}(${var.postgresql_connection_timeframe}):
|
||||||
avg:postgresql.percent_usage_connections${module.filter-tags.query_alert} by {server}
|
avg:postgresql.percent_usage_connections${module.filter-tags.query_alert} by {server}
|
||||||
) * 100 > ${var.postgresql_connection_threshold_critical}
|
* 100 > ${var.postgresql_connection_threshold_critical}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
@ -36,9 +36,9 @@ resource "datadog_monitor" "postgresql_too_many_locks" {
|
|||||||
type = "metric alert"
|
type = "metric alert"
|
||||||
|
|
||||||
query = <<EOF
|
query = <<EOF
|
||||||
avg(last_5m): (
|
${var.postgresql_lock_time_aggregator}(${var.postgresql_lock_timeframe}):
|
||||||
avg:postgresql.locks${module.filter-tags.query_alert} by {server}
|
default(avg:postgresql.locks${module.filter-tags.query_alert} by {server}, 0)
|
||||||
) > ${var.postgresql_lock_threshold_critical}
|
> ${var.postgresql_lock_threshold_critical}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
evaluation_delay = "${var.evaluation_delay}"
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user