MON-237 - Datalake store monitors added

This commit is contained in:
Alexandre Gaillet 2018-07-05 17:17:59 +02:00 committed by Laurent Piroelle
parent 09dd8a8254
commit c8f5e0e03e
7 changed files with 171 additions and 5 deletions

View File

@ -98,6 +98,10 @@ Inputs
| cosmos_db_ru_utilization_rate_threshold_critical | Critical threshold for Cosmos DB collection RU utilization monitor | string | `90` | no | | cosmos_db_ru_utilization_rate_threshold_critical | Critical threshold for Cosmos DB collection RU utilization monitor | string | `90` | no |
| cosmos_db_ru_utilization_rate_threshold_warning | Warning threshold for Cosmos DB collection RU utilization monitor | string | `80` | no | | cosmos_db_ru_utilization_rate_threshold_warning | Warning threshold for Cosmos DB collection RU utilization monitor | string | `80` | no |
| cosmos_db_ru_utilization_silenced | Groups to mute for Cosmos DB collection RU utilization monitor | map | `<map>` | no | | cosmos_db_ru_utilization_silenced | Groups to mute for Cosmos DB collection RU utilization monitor | map | `<map>` | no |
| datalakestore_status_message | Custom message for Datalake Store status monitor | string | `` | no |
| datalakestore_status_silenced | Groups to mute for Datalake Store status monitor | map | `<map>` | no |
| datalakestore_status_time_aggregator | Monitor aggregator for Datalake Store status [available values: min, max or avg] | string | `max` | no |
| datalakestore_status_timeframe | Monitor timeframe for Datalake Store status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no |
| delay | Delay in seconds for the metric evaluation | string | `900` | no | | delay | Delay in seconds for the metric evaluation | string | `900` | no |
| environment | Architecture environment | string | - | yes | | environment | Architecture environment | string | - | yes |
| eventhub_errors_rate_message | Custom message for Event Hub errors monitor | string | `` | no | | eventhub_errors_rate_message | Custom message for Event Hub errors monitor | string | `` | no |

View File

@ -63,7 +63,6 @@ Inputs
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | 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 | | 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 |
| subscription_id | ID of the subscription | string | - | yes |
Related documentation Related documentation
--------------------- ---------------------

View File

@ -0,0 +1,43 @@
Service Bus Datadog monitor
===========================
How to use this module
----------------------
```
module "datadog-monitors-azure-datalakestore" {
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/datalakestore?ref={revision}"
message = "${module.datadog-message-alerting.alerting-message}"
environment = "${var.environment}"
}
```
Purpose
-------
Creates a Datadog monitor with the following checks :
* Service status check
Inputs
------
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| delay | Delay in seconds for the metric evaluation | string | `900` | no |
| environment | Architecture environment | string | - | yes |
| 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 |
| status_message | Custom message for Datalake Store status monitor | string | `` | no |
| status_silenced | Groups to mute for Datalake Store status monitor | map | `<map>` | no |
| status_time_aggregator | Monitor aggregator for Datalake Store status [available values: min, max or avg] | string | `max` | no |
| status_timeframe | Monitor timeframe for Datalake Store status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_15m` | no |
Related documentation
---------------------
DataDog documentation : [https://docs.datadoghq.com/integrations/azure/](https://docs.datadoghq.com/integrations/azure/)
You must search `datalake`, there is no integration for now.
Azure metrics documentation : [https://docs.microsoft.com/fr-fr/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftdatalakestoreaccounts](https://docs.microsoft.com/fr-fr/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftdatalakestoreaccounts)

View File

@ -0,0 +1,47 @@
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
}
# Azure Datalake Store specific variables
variable "status_silenced" {
description = "Groups to mute for Datalake Store status monitor"
type = "map"
default = {}
}
variable "status_message" {
description = "Custom message for Datalake Store status monitor"
type = "string"
default = ""
}
variable "status_time_aggregator" {
description = "Monitor aggregator for Datalake Store status [available values: min, max or avg]"
type = "string"
default = "max"
}
variable "status_timeframe" {
description = "Monitor timeframe for Datalake Store status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
default = "last_15m"
}

View File

@ -0,0 +1,34 @@
data "template_file" "filter" {
template = "$${filter}"
vars {
filter = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_azure_servicebus:enabled,env:%s", var.environment) : "${var.filter_tags_custom}"}"
}
}
resource "datadog_monitor" "datalakestore_status" {
name = "[${var.environment}] Datalake Store is down"
message = "${coalesce(var.status_message, var.message)}"
query = <<EOF
${var.status_time_aggregator}(${var.status_timeframe}): (
avg:azure.datalakestore_accounts.status{${data.template_file.filter.rendered}} by {resource_group,region,name}
) != 1
EOF
type = "metric alert"
silenced = "${var.status_silenced}"
notify_no_data = true
evaluation_delay = "${var.delay}"
renotify_interval = 0
notify_audit = false
timeout_h = 0
include_tags = true
locked = false
require_full_window = false
new_host_delay = "${var.delay}"
tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"]
}

View File

@ -1681,3 +1681,27 @@ variable "cosmos_db_ru_utilization_collection" {
description = "Group to associate Cosmos DB collection to RU max" description = "Group to associate Cosmos DB collection to RU max"
type = "map" type = "map"
} }
# Azure Datalake Store specific variables
variable "datalakestore_status_silenced" {
description = "Groups to mute for Datalake Store status monitor"
type = "map"
default = {}
}
variable "datalakestore_status_message" {
description = "Custom message for Datalake Store status monitor"
type = "string"
default = ""
}
variable "datalakestore_status_time_aggregator" {
description = "Monitor aggregator for Datalake Store status [available values: min, max or avg]"
type = "string"
default = "max"
}
variable "datalakestore_status_timeframe" {
description = "Monitor timeframe for Datalake Store status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
default = "last_15m"
}

View File

@ -390,10 +390,9 @@ module "streamanalytics" {
module "cosmosdb" { module "cosmosdb" {
source = "./cosmosdb" source = "./cosmosdb"
environment = "${var.environment}" environment = "${var.environment}"
subscription_id = "" message = "${var.message}"
message = "${var.message}" delay = "${var.delay}"
delay = "${var.delay}"
filter_tags_use_defaults = "${var.filter_tags_use_defaults}" filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
filter_tags_custom = "${var.filter_tags_custom}" filter_tags_custom = "${var.filter_tags_custom}"
@ -414,3 +413,19 @@ module "cosmosdb" {
cosmos_db_ru_utilization_silenced = "${var.cosmos_db_ru_utilization_silenced}" cosmos_db_ru_utilization_silenced = "${var.cosmos_db_ru_utilization_silenced}"
cosmos_db_ru_utilization_collection = "${var.cosmos_db_ru_utilization_collection}" cosmos_db_ru_utilization_collection = "${var.cosmos_db_ru_utilization_collection}"
} }
module "datalakestore" {
source = "./datalakestore"
environment = "${var.environment}"
message = "${var.message}"
delay = "${var.delay}"
filter_tags_use_defaults = "${var.filter_tags_use_defaults}"
filter_tags_custom = "${var.filter_tags_custom}"
status_silenced = "${var.datalakestore_status_silenced}"
status_message = "${var.datalakestore_status_message}"
status_timeframe = "${var.datalakestore_status_timeframe}"
status_time_aggregator = "${var.datalakestore_status_time_aggregator}"
}