MON-230 Extra tags added for all monitors

This commit is contained in:
Rafael Romero Carmona 2018-07-05 15:49:09 +02:00 committed by Quentin Manfroi
parent f168c64e8c
commit aa57c19f03
8 changed files with 73 additions and 17 deletions

View File

@ -44,6 +44,12 @@ Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| available_slots_extra_tags | Extra tags for GCP Big Query Available Slots monitor | list | `<list>` | no |
| available_slots_message | Custom message for the Available Slots monitor | string | `` | no |
| available_slots_silenced | Groups to mute for GCP Big Query Available Slots monitor. | map | `<map>` | no |
| available_slots_threshold_critical | Available Slots (critical threshold) | string | `200` | no |
| available_slots_threshold_warning | Available Slots (warning threshold) | string | `300` | no |
| available_slots_timeframe | Timeframe for the Available Slots monitor | string | `last_5m` | no |
| concurrent_queries_message | Custom message for the Concurrent Queries monitor | string | `` | no | | concurrent_queries_message | Custom message for the Concurrent Queries monitor | string | `` | no |
| concurrent_queries_silenced | Groups to mute for GCP Big Query Concurrent Queries monitor | map | `<map>` | no | | concurrent_queries_silenced | Groups to mute for GCP Big Query Concurrent Queries monitor | map | `<map>` | no |
| concurrent_queries_threshold_critical | Concurrent Queries (critical threshold) (hard limit 50) | string | `45` | no | | concurrent_queries_threshold_critical | Concurrent Queries (critical threshold) (hard limit 50) | string | `45` | no |
@ -60,36 +66,37 @@ Inputs
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
| message | Message sent when a monitor is triggered | string | - | yes | | message | Message sent when a monitor is triggered | string | - | yes |
| project_id | ID of the GCP Project | string | - | yes | | project_id | ID of the GCP Project | string | - | yes |
| scanned_bytes_billed_extra_tags | Extra tags for GCP Big Query Scanned Bytes Billed monitor | list | `<list>` | no |
| scanned_bytes_billed_message | Custom message for the Scanned Bytes Billed monitor | string | `` | no | | scanned_bytes_billed_message | Custom message for the Scanned Bytes Billed monitor | string | `` | no |
| scanned_bytes_billed_silenced | Groups to mute for GCP Big Query Scanned Bytes Billed monitor. Muted by default. | map | `<map>` | no | | scanned_bytes_billed_silenced | Groups to mute for GCP Big Query Scanned Bytes Billed monitor. Muted by default. | map | `<map>` | no |
| scanned_bytes_billed_threshold_critical | Scanned Bytes Billed Bytes (critical threshold) | string | `1` | no | | scanned_bytes_billed_threshold_critical | Scanned Bytes Billed Bytes (critical threshold) | string | `1` | no |
| scanned_bytes_billed_threshold_warning | Scanned Bytes Billed Bytes (warning threshold) | string | `0` | no | | scanned_bytes_billed_threshold_warning | Scanned Bytes Billed Bytes (warning threshold) | string | `0` | no |
| scanned_bytes_billed_timeframe | Timeframe for the Scanned Bytes Billed monitor | string | `last_4h` | no | | scanned_bytes_billed_timeframe | Timeframe for the Scanned Bytes Billed monitor | string | `last_4h` | no |
| scanned_bytes_extra_tags | Extra tags for GCP Big Query Scanned Bytes monitor | list | `<list>` | no |
| scanned_bytes_message | Custom message for the Scanned Bytes monitor | string | `` | no | | scanned_bytes_message | Custom message for the Scanned Bytes monitor | string | `` | no |
| scanned_bytes_silenced | Groups to mute for GCP Big Query Scanned Bytes monitor. Muted by default. | map | `<map>` | no | | scanned_bytes_silenced | Groups to mute for GCP Big Query Scanned Bytes monitor. Muted by default. | map | `<map>` | no |
| scanned_bytes_threshold_critical | Scanned Bytes Bytes (critical threshold) | string | `1` | no | | scanned_bytes_threshold_critical | Scanned Bytes Bytes (critical threshold) | string | `1` | no |
| scanned_bytes_threshold_warning | Scanned Bytes Bytes (warning threshold) | string | `0` | no | | scanned_bytes_threshold_warning | Scanned Bytes Bytes (warning threshold) | string | `0` | no |
| scanned_bytes_timeframe | Timeframe for the Scanned Bytes monitor | string | `last_4h` | no | | scanned_bytes_timeframe | Timeframe for the Scanned Bytes monitor | string | `last_4h` | no |
| slots_available_message | Custom message for the Available Slots monitor | string | `` | no | | stored_bytes_extra_tags | Extra tags for GCP Big Query Stored Bytes monitor | list | `<list>` | no |
| slots_available_silenced | Groups to mute for GCP Big Query Available Slots monitor. | map | `<map>` | no |
| slots_available_threshold_critical | Available Slots (critical threshold) | string | `200` | no |
| slots_available_threshold_warning | Available Slots (warning threshold) | string | `300` | no |
| slots_available_timeframe | Timeframe for the Available Slots monitor | string | `last_5m` | no |
| stored_bytes_message | Custom message for the Stored Bytes monitor | string | `` | no | | stored_bytes_message | Custom message for the Stored Bytes monitor | string | `` | no |
| stored_bytes_silenced | Groups to mute for GCP Big Query Stored Bytes monitor. Muted by default. | map | `<map>` | no | | stored_bytes_silenced | Groups to mute for GCP Big Query Stored Bytes monitor. Muted by default. | map | `<map>` | no |
| stored_bytes_threshold_critical | Stored Bytes in fraction (critical threshold) | string | `1` | no | | stored_bytes_threshold_critical | Stored Bytes in fraction (critical threshold) | string | `1` | no |
| stored_bytes_threshold_warning | Stored Bytes in fraction (warning threshold) | string | `0` | no | | stored_bytes_threshold_warning | Stored Bytes in fraction (warning threshold) | string | `0` | no |
| stored_bytes_timeframe | Timeframe for the Stored Bytes monitor | string | `last_5m` | no | | stored_bytes_timeframe | Timeframe for the Stored Bytes monitor | string | `last_5m` | no |
| table_count_extra_tags | Extra tags for GCP Big Query Table Count monitor | list | `<list>` | no |
| table_count_message | Custom message for the Table Count monitor | string | `` | no | | table_count_message | Custom message for the Table Count monitor | string | `` | no |
| table_count_silenced | Groups to mute for GCP Big Query Table Count monitor. Muted by default. | map | `<map>` | no | | table_count_silenced | Groups to mute for GCP Big Query Table Count monitor. Muted by default. | map | `<map>` | no |
| table_count_threshold_critical | Table Count (critical threshold) | string | `1` | no | | table_count_threshold_critical | Table Count (critical threshold) | string | `1` | no |
| table_count_threshold_warning | Table Count (warning threshold) | string | `0` | no | | table_count_threshold_warning | Table Count (warning threshold) | string | `0` | no |
| table_count_timeframe | Timeframe for the Table Count monitor | string | `last_4h` | no | | table_count_timeframe | Timeframe for the Table Count monitor | string | `last_4h` | no |
| uploaded_bytes_billed_extra_tags | Extra tags for GCP Big Query Scanned Bytes monitor | list | `<list>` | no |
| uploaded_bytes_billed_message | Custom message for the Uploaded Bytes Billed monitor | string | `` | no | | uploaded_bytes_billed_message | Custom message for the Uploaded Bytes Billed monitor | string | `` | no |
| uploaded_bytes_billed_silenced | Groups to mute for GCP Big Query Uploaded Bytes Billed monitor. Muted by default. | map | `<map>` | no | | uploaded_bytes_billed_silenced | Groups to mute for GCP Big Query Uploaded Bytes Billed monitor. Muted by default. | map | `<map>` | no |
| uploaded_bytes_billed_threshold_critical | Uploaded Bytes Billed in Bytes (critical threshold) | string | `1` | no | | uploaded_bytes_billed_threshold_critical | Uploaded Bytes Billed in Bytes (critical threshold) | string | `1` | no |
| uploaded_bytes_billed_threshold_warning | Uploaded Bytes Billed in Bytes (warning threshold) | string | `0` | no | | uploaded_bytes_billed_threshold_warning | Uploaded Bytes Billed in Bytes (warning threshold) | string | `0` | no |
| uploaded_bytes_billed_timeframe | Timeframe for the Uploaded Bytes Billed monitor | string | `last_4h` | no | | uploaded_bytes_billed_timeframe | Timeframe for the Uploaded Bytes Billed monitor | string | `last_4h` | no |
| uploaded_bytes_extra_tags | Extra tags for GCP Big Query Uploaded Bytes monitor | list | `<list>` | no |
| uploaded_bytes_message | Custom message for the Uploaded Bytes monitor | string | `` | no | | uploaded_bytes_message | Custom message for the Uploaded Bytes monitor | string | `` | no |
| uploaded_bytes_silenced | Groups to mute for GCP Big Query Uploaded Bytes monitor. Muted by default. | map | `<map>` | no | | uploaded_bytes_silenced | Groups to mute for GCP Big Query Uploaded Bytes monitor. Muted by default. | map | `<map>` | no |
| uploaded_bytes_threshold_critical | Uploaded Bytes in Bytes (critical threshold) | string | `1` | no | | uploaded_bytes_threshold_critical | Uploaded Bytes in Bytes (critical threshold) | string | `1` | no |

View File

@ -34,6 +34,12 @@ variable "scanned_bytes_silenced" {
} }
} }
variable "scanned_bytes_extra_tags" {
description = "Extra tags for GCP Big Query Scanned Bytes monitor"
type = "list"
default = []
}
resource "datadog_monitor" "scanned_bytes" { resource "datadog_monitor" "scanned_bytes" {
name = "[${var.environment}] GCP Big Query Scanned Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Scanned Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.scanned_bytes_message, var.message)}" message = "${coalesce(var.scanned_bytes_message, var.message)}"
@ -66,5 +72,6 @@ EOF
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.scanned_bytes_extra_tags}",
] ]
} }

View File

@ -34,6 +34,12 @@ variable "scanned_bytes_billed_silenced" {
} }
} }
variable "scanned_bytes_billed_extra_tags" {
description = "Extra tags for GCP Big Query Scanned Bytes Billed monitor"
type = "list"
default = []
}
resource "datadog_monitor" "scanned_bytes_billed" { resource "datadog_monitor" "scanned_bytes_billed" {
name = "[${var.environment}] GCP Big Query Scanned Bytes Billed too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Scanned Bytes Billed too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.scanned_bytes_billed_message, var.message)}" message = "${coalesce(var.scanned_bytes_billed_message, var.message)}"
@ -66,5 +72,6 @@ EOF
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.scanned_bytes_billed_extra_tags}",
] ]
} }

View File

@ -1,50 +1,56 @@
# #
# Available Slots # Available Slots
# #
variable "slots_available_message" { variable "available_slots_message" {
description = "Custom message for the Available Slots monitor" description = "Custom message for the Available Slots monitor"
type = "string" type = "string"
default = "" default = ""
} }
variable "slots_available_timeframe" { variable "available_slots_timeframe" {
description = "Timeframe for the Available Slots monitor" description = "Timeframe for the Available Slots monitor"
type = "string" type = "string"
default = "last_5m" default = "last_5m"
} }
variable "slots_available_threshold_warning" { variable "available_slots_threshold_warning" {
description = "Available Slots (warning threshold)" description = "Available Slots (warning threshold)"
type = "string" type = "string"
default = 300 default = 300
} }
variable "slots_available_threshold_critical" { variable "available_slots_threshold_critical" {
description = "Available Slots (critical threshold)" description = "Available Slots (critical threshold)"
type = "string" type = "string"
default = 200 default = 200
} }
variable "slots_available_silenced" { variable "available_slots_silenced" {
description = "Groups to mute for GCP Big Query Available Slots monitor." description = "Groups to mute for GCP Big Query Available Slots monitor."
type = "map" type = "map"
default = {} default = {}
} }
variable "available_slots_extra_tags" {
description = "Extra tags for GCP Big Query Available Slots monitor"
type = "list"
default = []
}
resource "datadog_monitor" "available_slots" { resource "datadog_monitor" "available_slots" {
name = "[${var.environment}] GCP Big Query Available Slots close to the limit {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Available Slots close to the limit {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.slots_available_message, var.message)}" message = "${coalesce(var.available_slots_message, var.message)}"
type = "metric alert" type = "metric alert"
query = <<EOF query = <<EOF
avg(${var.slots_available_timeframe}): avg:gcp.bigquery.slots.total_available{${data.template_file.filter.rendered}} avg(${var.available_slots_timeframe}): avg:gcp.bigquery.slots.total_available{${data.template_file.filter.rendered}}
< ${var.slots_available_threshold_critical} < ${var.available_slots_threshold_critical}
EOF EOF
thresholds { thresholds {
warning = "${var.slots_available_threshold_warning}" warning = "${var.available_slots_threshold_warning}"
critical = "${var.slots_available_threshold_critical}" critical = "${var.available_slots_threshold_critical}"
} }
include_tags = true include_tags = true
@ -56,12 +62,13 @@ EOF
locked = false locked = false
evaluation_delay = "${var.delay}" evaluation_delay = "${var.delay}"
new_host_delay = "${var.delay}" new_host_delay = "${var.delay}"
silenced = "${var.slots_available_silenced}" silenced = "${var.available_slots_silenced}"
tags = [ tags = [
"team:gcp", "team:gcp",
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.available_slots_extra_tags}",
] ]
} }

View File

@ -34,6 +34,12 @@ variable "stored_bytes_silenced" {
} }
} }
variable "stored_bytes_extra_tags" {
description = "Extra tags for GCP Big Query Stored Bytes monitor"
type = "list"
default = []
}
resource "datadog_monitor" "stored_bytes" { resource "datadog_monitor" "stored_bytes" {
name = "[${var.environment}] GCP Big Query Stored Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Stored Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.stored_bytes_message, var.message)}" message = "${coalesce(var.stored_bytes_message, var.message)}"
@ -67,5 +73,6 @@ EOF
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.stored_bytes_extra_tags}",
] ]
} }

View File

@ -34,6 +34,12 @@ variable "table_count_silenced" {
} }
} }
variable "table_count_extra_tags" {
description = "Extra tags for GCP Big Query Table Count monitor"
type = "list"
default = []
}
resource "datadog_monitor" "table_count" { resource "datadog_monitor" "table_count" {
name = "[${var.environment}] GCP Big Query Table Count too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Table Count too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.table_count_message, var.message)}" message = "${coalesce(var.table_count_message, var.message)}"
@ -67,5 +73,6 @@ EOF
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.table_count_extra_tags}",
] ]
} }

View File

@ -34,6 +34,12 @@ variable "uploaded_bytes_silenced" {
} }
} }
variable "uploaded_bytes_extra_tags" {
description = "Extra tags for GCP Big Query Uploaded Bytes monitor"
type = "list"
default = []
}
resource "datadog_monitor" "uploaded_bytes" { resource "datadog_monitor" "uploaded_bytes" {
name = "[${var.environment}] GCP Big Query Uploaded Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Uploaded Bytes too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.uploaded_bytes_message, var.message)}" message = "${coalesce(var.uploaded_bytes_message, var.message)}"
@ -67,5 +73,6 @@ EOF
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.uploaded_bytes_extra_tags}",
] ]
} }

View File

@ -34,7 +34,13 @@ variable "uploaded_bytes_billed_silenced" {
} }
} }
resource "datadog_monitor" "upload_bytes_billed" { variable "uploaded_bytes_billed_extra_tags" {
description = "Extra tags for GCP Big Query Scanned Bytes monitor"
type = "list"
default = []
}
resource "datadog_monitor" "uploaded_bytes_billed" {
name = "[${var.environment}] GCP Big Query Uploaded Bytes Billed too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" name = "[${var.environment}] GCP Big Query Uploaded Bytes Billed too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
message = "${coalesce(var.uploaded_bytes_billed_message, var.message)}" message = "${coalesce(var.uploaded_bytes_billed_message, var.message)}"
@ -67,5 +73,6 @@ EOF
"provider:gcp", "provider:gcp",
"env:${var.environment}", "env:${var.environment}",
"resource:big-query", "resource:big-query",
"${var.uploaded_bytes_billed_extra_tags}",
] ]
} }