MON-191 - Mongodb monitors updated with customizable aggregator

This commit is contained in:
Alexandre Gaillet 2018-04-30 15:30:19 +02:00 committed by Quentin Manfroi
parent 2ba79aefea
commit e2797f7d71
3 changed files with 9 additions and 2 deletions

View File

@ -79,6 +79,7 @@ Inputs
| 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 |
| mongodb_replicaset_aggregator | Monitor aggregator for Mongodb replicaset [available values: min, max, sum or avg] | string | `avg` | no |
| mongodb_replicaset_message | Custom message for Mongodb replicaset monitor | string | `` | no |
| mongodb_replicaset_silenced | Groups to mute for Mongodb replicaset monitor | map | `<map>` | no |
| mongodb_replicaset_timeframe | Monitor timeframe for Mongodb replicaset [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no |

View File

@ -36,6 +36,12 @@ variable "mongodb_replicaset_message" {
default = ""
}
variable "mongodb_replicaset_aggregator" {
description = "Monitor aggregator for Mongodb replicaset [available values: min, max, sum or avg]"
type = "string"
default = "avg"
}
variable "mongodb_replicaset_timeframe" {
description = "Monitor timeframe for Mongodb replicaset [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
type = "string"

View File

@ -11,8 +11,8 @@ resource "datadog_monitor" "mongodb_replicaset_state" {
message = "${coalesce(var.mongodb_replicaset_message, var.message)}"
query = <<EOF
avg(${var.mongodb_replicaset_timeframe}): (
avg:mongodb.replset.health{${data.template_file.filter.rendered}} by {region,replset_name}
${var.mongodb_replicaset_aggregator}(${var.mongodb_replicaset_timeframe}): (
${var.mongodb_replicaset_aggregator}:mongodb.replset.health{${data.template_file.filter.rendered}} by {region,replset_name}
) < 1
EOF