MON-142: updated monitors to latest best practices

This commit is contained in:
Boris Rousseau 2018-04-03 15:14:27 +02:00 committed by Quentin Manfroi
parent d1c9b38608
commit 8cf93046fb
2 changed files with 17 additions and 9 deletions

View File

@ -26,14 +26,18 @@ Inputs
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
| evaluation_delay | Delay in seconds for the metric evaluation | string | `900` | no |
| environment | Environment | string | - | yes |
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
| mysql_connection_threshold_critical | Maximum critical acceptable percent of connections | string | `80` | no |
| mysql_connection_threshold_warning | Maximum warning acceptable percent of connections | string | `70` | no |
| mysql_connection_silenced | Groups to mute mysql connection monitor | map | `<map>` | no |
| mysql_connection_message | Custom message for MySQL connection monitor | string | `` | no |
| mysql_thread_threshold_critical | Maximum critical acceptable number of threads | string | `500` | no |
| mysql_thread_threshold_warning | Maximum warning acceptable number of threads | string | `400` | no |
| mysql_thread_silenced | Groups to mute mysql threads monitor | map | `<map>` | no |
| mysql_thread_message | Custom message for MySQL thread monitor | string | `` | no |
| message | Message sent when a monitor is triggered | string | - | yes |
Related documentation

View File

@ -6,10 +6,10 @@ data "template_file" "filter" {
}
}
resource "datadog_monitor" "mysql_connections_15min" {
name = "[${var.environment}] Mysql Connections > {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
message = "${var.message}"
type = "query alert"
resource "datadog_monitor" "mysql_connection_too_high" {
name = "[${var.environment}] Mysql Connections {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
message = "${coalesce(var.mysql_connection_message, var.message)}"
type = "metric alert"
query = <<EOF
avg(last_15m): (
@ -32,13 +32,15 @@ resource "datadog_monitor" "mysql_connections_15min" {
timeout_h = 0
include_tags = true
silenced = "${var.mysql_connection_silenced}"
tags = ["env:${var.environment}", "resource:mysql"]
}
resource "datadog_monitor" "mysql_thread_5min" {
name = "[${var.environment}] Mysql threads > {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
message = "${var.message}"
type = "query alert"
resource "datadog_monitor" "mysql_thread_too_high" {
name = "[${var.environment}] Mysql threads {{comparator}} {{#is_alert}}{{threshold}}%{{/is_alert}}{{#is_warning}}{{warn_threshold}}%{{/is_warning}} ({{value}}%)"
message = "${coalesce(var.mysql_thread_message, var.message)}"
type = "metric alert"
query = <<EOF
avg(last_5m): (
@ -60,5 +62,7 @@ resource "datadog_monitor" "mysql_thread_5min" {
timeout_h = 0
include_tags = true
silenced = "${var.mysql_thread_silenced}"
tags = ["env:${var.environment}", "resource:mysql"]
}