From c8f5e0e03e7a60c08a044e036f044b4eea468e4d Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Thu, 5 Jul 2018 17:17:59 +0200 Subject: [PATCH] MON-237 - Datalake store monitors added --- cloud/azure/README.md | 4 ++ cloud/azure/cosmosdb/README.md | 1 - cloud/azure/datalakestore/README.md | 43 +++++++++++++++++ cloud/azure/datalakestore/inputs.tf | 47 +++++++++++++++++++ .../datalakestore/monitors-datalakestore.tf | 34 ++++++++++++++ cloud/azure/inputs.tf | 24 ++++++++++ cloud/azure/monitors.tf | 23 +++++++-- 7 files changed, 171 insertions(+), 5 deletions(-) create mode 100644 cloud/azure/datalakestore/README.md create mode 100644 cloud/azure/datalakestore/inputs.tf create mode 100644 cloud/azure/datalakestore/monitors-datalakestore.tf diff --git a/cloud/azure/README.md b/cloud/azure/README.md index fd33024..bbdafc7 100644 --- a/cloud/azure/README.md +++ b/cloud/azure/README.md @@ -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_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 | `` | 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 | `` | 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 | | environment | Architecture environment | string | - | yes | | eventhub_errors_rate_message | Custom message for Event Hub errors monitor | string | `` | no | diff --git a/cloud/azure/cosmosdb/README.md b/cloud/azure/cosmosdb/README.md index 9c051e9..9912529 100644 --- a/cloud/azure/cosmosdb/README.md +++ b/cloud/azure/cosmosdb/README.md @@ -63,7 +63,6 @@ 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 a monitor is triggered | string | - | yes | -| subscription_id | ID of the subscription | string | - | yes | Related documentation --------------------- diff --git a/cloud/azure/datalakestore/README.md b/cloud/azure/datalakestore/README.md new file mode 100644 index 0000000..369976b --- /dev/null +++ b/cloud/azure/datalakestore/README.md @@ -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 | `` | 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) diff --git a/cloud/azure/datalakestore/inputs.tf b/cloud/azure/datalakestore/inputs.tf new file mode 100644 index 0000000..30afe45 --- /dev/null +++ b/cloud/azure/datalakestore/inputs.tf @@ -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" +} diff --git a/cloud/azure/datalakestore/monitors-datalakestore.tf b/cloud/azure/datalakestore/monitors-datalakestore.tf new file mode 100644 index 0000000..fa4b67d --- /dev/null +++ b/cloud/azure/datalakestore/monitors-datalakestore.tf @@ -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 = <