MON-230 First version of monitors and Readme
This commit is contained in:
parent
f5ab90b55f
commit
f168c64e8c
98
cloud/gcp/big-query/README.md
Normal file
98
cloud/gcp/big-query/README.md
Normal file
@ -0,0 +1,98 @@
|
||||
GCP Big Query
|
||||
==============================
|
||||
|
||||
How to use this module
|
||||
----------------------
|
||||
|
||||
```
|
||||
module "datadog-monitors-gcp-big-query" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/gcp/big-query?ref={revision}"
|
||||
|
||||
project_id = "${var.gcp_project_id}"
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Purpose
|
||||
-------
|
||||
Creates DataDog monitors with the following checks :
|
||||
|
||||
* Query Concurrent Queries
|
||||
* Query Execution Times (muted by default)
|
||||
* Query Scanned Bytes (muted by default)
|
||||
* Query Scanned Bytes Billed (muted by default)
|
||||
|
||||
* Slots Available
|
||||
|
||||
* Storage Stored Bytes (muted by default)
|
||||
* Storage Table Count per Dataset (muted by default)
|
||||
* Storage Uploaded Bytes (muted by default)
|
||||
* Storage Uploaded Bytes Billed (muted by default)
|
||||
|
||||
|
||||
Useful links
|
||||
------------
|
||||
|
||||
* [GCP Big Query monitoring](https://cloud.google.com/bigquery/docs/monitoring)
|
||||
* [Datadog Integration for GCP Big Query](https://docs.datadoghq.com/integrations/google_cloud_big_query/)
|
||||
* [GCP Big Query Quotas and Limits](https://cloud.google.com/bigquery/quotas)
|
||||
|
||||
Inputs
|
||||
------
|
||||
|
||||
| Name | Description | Type | Default | Required |
|
||||
|------|-------------|:----:|:-----:|:-----:|
|
||||
| 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_threshold_critical | Concurrent Queries (critical threshold) (hard limit 50) | string | `45` | no |
|
||||
| concurrent_queries_threshold_warning | Concurrent Queries (warning threshold) (hard limit 50) | string | `40` | no |
|
||||
| concurrent_queries_timeframe | Timeframe for the Concurrent Queries monitor | string | `last_5m` | no |
|
||||
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
|
||||
| environment | Architecture environment | string | - | yes |
|
||||
| execution_time_message | Custom message for the Execution Time monitor | string | `` | no |
|
||||
| execution_time_silenced | Groups to mute for GCP Big Query Execution Time monitor. Muted by default. | map | `<map>` | no |
|
||||
| execution_time_threshold_critical | Average Execution Time in seconds (critical threshold) | string | `150` | no |
|
||||
| execution_time_threshold_warning | Average Execution Time in seconds (warning threshold) | string | `100` | no |
|
||||
| execution_time_timeframe | Timeframe for the Execution Time monitor | string | `last_5m` | no |
|
||||
| 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 a monitor is triggered | string | - | yes |
|
||||
| project_id | ID of the GCP Project | string | - | yes |
|
||||
| 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_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_timeframe | Timeframe for the Scanned Bytes Billed monitor | string | `last_4h` | 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_threshold_critical | Scanned Bytes Bytes (critical threshold) | string | `1` | 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 |
|
||||
| slots_available_message | Custom message for the Available Slots monitor | string | `` | 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_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_warning | Stored Bytes in fraction (warning threshold) | string | `0` | no |
|
||||
| stored_bytes_timeframe | Timeframe for the Stored Bytes monitor | string | `last_5m` | 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_threshold_critical | Table Count (critical threshold) | string | `1` | 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 |
|
||||
| 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_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_timeframe | Timeframe for the Uploaded Bytes Billed monitor | string | `last_4h` | 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_threshold_critical | Uploaded Bytes in Bytes (critical threshold) | string | `1` | no |
|
||||
| uploaded_bytes_threshold_warning | Uploaded Bytes in Bytes (warning threshold) | string | `0` | no |
|
||||
| uploaded_bytes_timeframe | Timeframe for the Uploaded Bytes monitor | string | `last_4h` | no |
|
||||
|
||||
34
cloud/gcp/big-query/inputs.tf
Normal file
34
cloud/gcp/big-query/inputs.tf
Normal file
@ -0,0 +1,34 @@
|
||||
#
|
||||
# Datadog global variables
|
||||
#
|
||||
variable "environment" {
|
||||
description = "Architecture environment"
|
||||
type = "string"
|
||||
}
|
||||
|
||||
variable "filter_tags_use_defaults" {
|
||||
description = "Use default filter tags convention"
|
||||
default = "true"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
variable "message" {
|
||||
description = "Message sent when a monitor is triggered"
|
||||
}
|
||||
|
||||
variable "delay" {
|
||||
description = "Delay in seconds for the metric evaluation"
|
||||
default = 900
|
||||
}
|
||||
|
||||
#
|
||||
# Filter variables
|
||||
#
|
||||
variable "project_id" {
|
||||
type = "string"
|
||||
description = "ID of the GCP Project"
|
||||
}
|
||||
12
cloud/gcp/big-query/monitors-big-query.tf
Normal file
12
cloud/gcp/big-query/monitors-big-query.tf
Normal file
@ -0,0 +1,12 @@
|
||||
#
|
||||
# FILTER
|
||||
#
|
||||
data "template_file" "filter" {
|
||||
template = "$${filter}"
|
||||
|
||||
vars {
|
||||
filter = "${var.filter_tags_use_defaults == "true" ?
|
||||
format("project_id:%s", var.project_id) :
|
||||
"${var.filter_tags_custom}"}"
|
||||
}
|
||||
}
|
||||
138
cloud/gcp/big-query/query.tf
Normal file
138
cloud/gcp/big-query/query.tf
Normal file
@ -0,0 +1,138 @@
|
||||
#
|
||||
# Concurrent queries
|
||||
#
|
||||
variable "concurrent_queries_message" {
|
||||
description = "Custom message for the Concurrent Queries monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "concurrent_queries_timeframe" {
|
||||
description = "Timeframe for the Concurrent Queries monitor"
|
||||
type = "string"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "concurrent_queries_threshold_warning" {
|
||||
description = "Concurrent Queries (warning threshold) (hard limit 50)"
|
||||
type = "string"
|
||||
default = 40
|
||||
}
|
||||
|
||||
variable "concurrent_queries_threshold_critical" {
|
||||
description = "Concurrent Queries (critical threshold) (hard limit 50)"
|
||||
type = "string"
|
||||
default = 45
|
||||
}
|
||||
|
||||
variable "concurrent_queries_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Concurrent Queries monitor"
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "concurrent_queries" {
|
||||
name = "[${var.environment}] GCP Big Query Concurrent Queries close to the limit {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
||||
message = "${coalesce(var.concurrent_queries_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.concurrent_queries_timeframe}): avg:gcp.bigquery.query.count{${data.template_file.filter.rendered}}
|
||||
> ${var.concurrent_queries_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.concurrent_queries_threshold_warning}"
|
||||
critical = "${var.concurrent_queries_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.concurrent_queries_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
|
||||
#
|
||||
# Execution Time
|
||||
#
|
||||
variable "execution_time_message" {
|
||||
description = "Custom message for the Execution Time monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "execution_time_timeframe" {
|
||||
description = "Timeframe for the Execution Time monitor"
|
||||
type = "string"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "execution_time_threshold_warning" {
|
||||
description = "Average Execution Time in seconds (warning threshold)"
|
||||
type = "string"
|
||||
default = 100
|
||||
}
|
||||
|
||||
variable "execution_time_threshold_critical" {
|
||||
description = "Average Execution Time in seconds (critical threshold)"
|
||||
type = "string"
|
||||
default = 150
|
||||
}
|
||||
|
||||
variable "execution_time_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Execution Time monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "execution_time" {
|
||||
name = "[${var.environment}] GCP Big Query Execution Time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}"
|
||||
message = "${coalesce(var.execution_time_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.execution_time_timeframe}): avg:gcp.bigquery.query.execution_times.avg{${data.template_file.filter.rendered}}
|
||||
> ${var.execution_time_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.execution_time_threshold_warning}"
|
||||
critical = "${var.execution_time_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.execution_time_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
70
cloud/gcp/big-query/scanned_bytes.tf
Normal file
70
cloud/gcp/big-query/scanned_bytes.tf
Normal file
@ -0,0 +1,70 @@
|
||||
#
|
||||
# Scanned Bytes
|
||||
#
|
||||
variable "scanned_bytes_message" {
|
||||
description = "Custom message for the Scanned Bytes monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "scanned_bytes_timeframe" {
|
||||
description = "Timeframe for the Scanned Bytes monitor"
|
||||
type = "string"
|
||||
default = "last_4h"
|
||||
}
|
||||
|
||||
variable "scanned_bytes_threshold_warning" {
|
||||
description = "Scanned Bytes Bytes (warning threshold)"
|
||||
type = "string"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "scanned_bytes_threshold_critical" {
|
||||
description = "Scanned Bytes Bytes (critical threshold)"
|
||||
type = "string"
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "scanned_bytes_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Scanned Bytes monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
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}}"
|
||||
message = "${coalesce(var.scanned_bytes_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.scanned_bytes_timeframe}): avg:gcp.bigquery.query.scanned_bytes{${data.template_file.filter.rendered}}
|
||||
> ${var.scanned_bytes_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.scanned_bytes_threshold_warning}"
|
||||
critical = "${var.scanned_bytes_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.scanned_bytes_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
70
cloud/gcp/big-query/scanned_bytes_billed.tf
Normal file
70
cloud/gcp/big-query/scanned_bytes_billed.tf
Normal file
@ -0,0 +1,70 @@
|
||||
#
|
||||
# Scanned Bytes Billed
|
||||
#
|
||||
variable "scanned_bytes_billed_message" {
|
||||
description = "Custom message for the Scanned Bytes Billed monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "scanned_bytes_billed_timeframe" {
|
||||
description = "Timeframe for the Scanned Bytes Billed monitor"
|
||||
type = "string"
|
||||
default = "last_4h"
|
||||
}
|
||||
|
||||
variable "scanned_bytes_billed_threshold_warning" {
|
||||
description = "Scanned Bytes Billed Bytes (warning threshold)"
|
||||
type = "string"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "scanned_bytes_billed_threshold_critical" {
|
||||
description = "Scanned Bytes Billed Bytes (critical threshold)"
|
||||
type = "string"
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "scanned_bytes_billed_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Scanned Bytes Billed monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
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}}"
|
||||
message = "${coalesce(var.scanned_bytes_billed_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.scanned_bytes_billed_timeframe}): avg:gcp.bigquery.query.scanned_bytes_billed{${data.template_file.filter.rendered}}
|
||||
> ${var.scanned_bytes_billed_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.scanned_bytes_billed_threshold_warning}"
|
||||
critical = "${var.scanned_bytes_billed_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.scanned_bytes_billed_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
67
cloud/gcp/big-query/slots.tf
Normal file
67
cloud/gcp/big-query/slots.tf
Normal file
@ -0,0 +1,67 @@
|
||||
#
|
||||
# Available Slots
|
||||
#
|
||||
variable "slots_available_message" {
|
||||
description = "Custom message for the Available Slots monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "slots_available_timeframe" {
|
||||
description = "Timeframe for the Available Slots monitor"
|
||||
type = "string"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "slots_available_threshold_warning" {
|
||||
description = "Available Slots (warning threshold)"
|
||||
type = "string"
|
||||
default = 300
|
||||
}
|
||||
|
||||
variable "slots_available_threshold_critical" {
|
||||
description = "Available Slots (critical threshold)"
|
||||
type = "string"
|
||||
default = 200
|
||||
}
|
||||
|
||||
variable "slots_available_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Available Slots monitor."
|
||||
type = "map"
|
||||
default = {}
|
||||
}
|
||||
|
||||
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}}"
|
||||
message = "${coalesce(var.slots_available_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.slots_available_timeframe}): avg:gcp.bigquery.slots.total_available{${data.template_file.filter.rendered}}
|
||||
< ${var.slots_available_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.slots_available_threshold_warning}"
|
||||
critical = "${var.slots_available_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.slots_available_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
71
cloud/gcp/big-query/storage.tf
Normal file
71
cloud/gcp/big-query/storage.tf
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# Stored Bytes
|
||||
#
|
||||
variable "stored_bytes_message" {
|
||||
description = "Custom message for the Stored Bytes monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "stored_bytes_timeframe" {
|
||||
description = "Timeframe for the Stored Bytes monitor"
|
||||
type = "string"
|
||||
default = "last_5m"
|
||||
}
|
||||
|
||||
variable "stored_bytes_threshold_warning" {
|
||||
description = "Stored Bytes in fraction (warning threshold)"
|
||||
type = "string"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "stored_bytes_threshold_critical" {
|
||||
description = "Stored Bytes in fraction (critical threshold)"
|
||||
type = "string"
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "stored_bytes_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Stored Bytes monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
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}}"
|
||||
message = "${coalesce(var.stored_bytes_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.stored_bytes_timeframe}): avg:gcp.bigquery.storage.stored_bytes{${data.template_file.filter.rendered}}
|
||||
by {dataset_id,table}
|
||||
> ${var.stored_bytes_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.stored_bytes_threshold_warning}"
|
||||
critical = "${var.stored_bytes_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.stored_bytes_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
71
cloud/gcp/big-query/table_count.tf
Normal file
71
cloud/gcp/big-query/table_count.tf
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# Table Count
|
||||
#
|
||||
variable "table_count_message" {
|
||||
description = "Custom message for the Table Count monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "table_count_timeframe" {
|
||||
description = "Timeframe for the Table Count monitor"
|
||||
type = "string"
|
||||
default = "last_4h"
|
||||
}
|
||||
|
||||
variable "table_count_threshold_warning" {
|
||||
description = "Table Count (warning threshold)"
|
||||
type = "string"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "table_count_threshold_critical" {
|
||||
description = "Table Count (critical threshold)"
|
||||
type = "string"
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "table_count_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Table Count monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
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}}"
|
||||
message = "${coalesce(var.table_count_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.table_count_timeframe}): avg:gcp.bigquery.storage.table_count{${data.template_file.filter.rendered}}
|
||||
by {dataset_id}
|
||||
> ${var.table_count_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.table_count_threshold_warning}"
|
||||
critical = "${var.table_count_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.table_count_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
71
cloud/gcp/big-query/uploaded_bytes.tf
Normal file
71
cloud/gcp/big-query/uploaded_bytes.tf
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# Uploaded Bytes
|
||||
#
|
||||
variable "uploaded_bytes_message" {
|
||||
description = "Custom message for the Uploaded Bytes monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_timeframe" {
|
||||
description = "Timeframe for the Uploaded Bytes monitor"
|
||||
type = "string"
|
||||
default = "last_4h"
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_threshold_warning" {
|
||||
description = "Uploaded Bytes in Bytes (warning threshold)"
|
||||
type = "string"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_threshold_critical" {
|
||||
description = "Uploaded Bytes in Bytes (critical threshold)"
|
||||
type = "string"
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Uploaded Bytes monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
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}}"
|
||||
message = "${coalesce(var.uploaded_bytes_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.uploaded_bytes_timeframe}): avg:gcp.bigquery.storage.uploaded_bytes{${data.template_file.filter.rendered}}
|
||||
by {dataset_id,table}
|
||||
> ${var.uploaded_bytes_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.uploaded_bytes_threshold_warning}"
|
||||
critical = "${var.uploaded_bytes_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.uploaded_bytes_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
71
cloud/gcp/big-query/uploaded_bytes_billed.tf
Normal file
71
cloud/gcp/big-query/uploaded_bytes_billed.tf
Normal file
@ -0,0 +1,71 @@
|
||||
#
|
||||
# Uploaded Bytes Billed
|
||||
#
|
||||
variable "uploaded_bytes_billed_message" {
|
||||
description = "Custom message for the Uploaded Bytes Billed monitor"
|
||||
type = "string"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_billed_timeframe" {
|
||||
description = "Timeframe for the Uploaded Bytes Billed monitor"
|
||||
type = "string"
|
||||
default = "last_4h"
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_billed_threshold_warning" {
|
||||
description = "Uploaded Bytes Billed in Bytes (warning threshold)"
|
||||
type = "string"
|
||||
default = 0
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_billed_threshold_critical" {
|
||||
description = "Uploaded Bytes Billed in Bytes (critical threshold)"
|
||||
type = "string"
|
||||
default = 1
|
||||
}
|
||||
|
||||
variable "uploaded_bytes_billed_silenced" {
|
||||
description = "Groups to mute for GCP Big Query Uploaded Bytes Billed monitor. Muted by default."
|
||||
type = "map"
|
||||
|
||||
default = {
|
||||
"*" = 0
|
||||
}
|
||||
}
|
||||
|
||||
resource "datadog_monitor" "upload_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}}"
|
||||
message = "${coalesce(var.uploaded_bytes_billed_message, var.message)}"
|
||||
|
||||
type = "metric alert"
|
||||
|
||||
query = <<EOF
|
||||
avg(${var.uploaded_bytes_billed_timeframe}): avg:gcp.bigquery.storage.uploaded_bytes{${data.template_file.filter.rendered}}
|
||||
by {dataset_id,table}
|
||||
> ${var.uploaded_bytes_billed_threshold_critical}
|
||||
EOF
|
||||
|
||||
thresholds {
|
||||
warning = "${var.uploaded_bytes_billed_threshold_warning}"
|
||||
critical = "${var.uploaded_bytes_billed_threshold_critical}"
|
||||
}
|
||||
|
||||
include_tags = true
|
||||
notify_no_data = false
|
||||
require_full_window = false
|
||||
renotify_interval = 0
|
||||
notify_audit = false
|
||||
timeout_h = 0
|
||||
locked = false
|
||||
evaluation_delay = "${var.delay}"
|
||||
new_host_delay = "${var.delay}"
|
||||
silenced = "${var.uploaded_bytes_billed_silenced}"
|
||||
|
||||
tags = [
|
||||
"team:gcp",
|
||||
"provider:gcp",
|
||||
"env:${var.environment}",
|
||||
"resource:big-query",
|
||||
]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user