From 9d75b4a096f080545a167a09382ec1da4d318e08 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Fri, 23 Mar 2018 16:50:04 +0100 Subject: [PATCH 1/7] MON-97 - Update general README.md --- README.md | 108 +++++++++++---------- datadog-samples/modules-declaration.sample | 17 +--- 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index fa572b9..722c827 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,62 @@ -# README - DataDog Monitors # +# DataDog Monitors # -This repository is used to store all our monitors templates. +This repository is used to store all our monitors templates. + +Here is the repository organization : + +- cloud + - aws + - [alb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/alb/) + - [apigateway](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/apigateway/) + - [elasticsearch](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/elasticsearch/) + - [elb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/elb/) + - [kinesis-firehose](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/kinesis-firehose/) + - [rds](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/rds/) + - [vpn](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/aws/vpn/) + - azure + - [apimanagement](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/apimanagement) + - [app-services](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/app-services/r) + - [eventhub](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/eventhub/) + - [iothubs](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/iothubs/) + - [redis](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/redis/) + - [sql-database](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/sql-database/) + - [storage](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/storage/) + - [stream-analytics](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/stream-analytics/) +- common + - alerting-message +- databases + - [mongodb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/databases/mongodb/) +- datadog-samples +- incubator +- middleware + - [apache](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/apache/) + - [nginx](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/nginx/) + - [php-fpm](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/php-fpm/) +- system + - [generic](https://bitbucket.org/morea/terraform.feature.datadog/src/master/system/generic/) -These templates have to be used with dedicated agent configurations and resource tagging to works as expected. ### How to contribute ? ### -The easiest way to contribute on this repository is to add monitors file inside the monitors repository. +First, you may refresh your knowledge and look at the [terminalogy](https://confluence.fr.clara.net/display/DAT/Getting+started) + +If you want to report an issue please be sure to follow this page : [How to report an issue](https://confluence.fr.clara.net/display/DAT/Project+and+Workflow) + +It explains the different stages of a request, from the `Backlog` to the `Merged`. + +If you want to contribute to any request, you must follow our [best practices](https://confluence.fr.clara.net/display/DAT/Templates+monitors). ### Important notes ### -* This repository will be included as a Terraform module source. -* Each monitors have to be disabled by default, so you have to manage this condition when you create your monitors. -* If you override a basic monitor with a custom one, you have to use tag filters on you query. (Example dd_cpu_high, if you want to override default cpu monitors) +* Each folder can be import as a feature on terraform, you must choose the one that you need. +* Each of these features contains the most commons monitors, but they probably not fulfill all your customer needs +* You still can create some DataDog monitors after importing a feature, it's even advisable to complete your needs +* You will find a complete `README.md` on each feature, explaining the feature's workaround +* The `alerting-message` module defines the alert channel and must be included in each configuration, you have to define it (Pager, Slack...) -### Main.tf : add the DataDog provider ### +### The DataDog provider ### + +Before importing some features, you must define the DataDog provider in your `main.tf` ``` provider "datadog" { @@ -23,51 +65,19 @@ provider "datadog" { } ``` +Both of the `datadog_api_key` and `datadog_app_key` are unique to the client. + ### Module Declaration example ### +A quick example to how import the monitors that you need : + ``` -module "datadog-monitors" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//{module-path}?ref={version}" +module "datadog-monitors-feature" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git/{monitors_feature_path}?ref={revision}" - critical_escalation_group = "${var.critical_escalation_group}" - warning_escalation_group = "${var.warning_escalation_group}" - - #default monitors templates integrations examples - dd_system = "${var.dd_system}" - #nginx = "false" - #aws_rds_mysql = "false" - - dd_custom_cpu = "${var.dd_custom_cpu}" + environment = "${var.environment}" + message = "${module.datadog-message-alerting.alerting-message}" } ``` -### Input Declaration example ### - -``` -variable "critical_escalation_group" { - default = "@pagerduty_HODummy" -} -variable "warning_escalation_group" { - default = "@pagerduty_HNODummy" -} - -variable "datadog_app_key" {} -variable "datadog_api_key" {} - -variable "dd_system" { - default = "enabled" -} - -variable "dd_custom_cpu" { - type = "map" - default = { - status = "enabled" - name = "CPU High > 95% during 1 hour" - - period = "last_1h" - - critical_threshold = 95 - warning_threshold = 90 - } -} -``` +`{monitors_feature_path}` could be defined as `/cloud/aws/elb` for example. diff --git a/datadog-samples/modules-declaration.sample b/datadog-samples/modules-declaration.sample index 182f130..8965975 100644 --- a/datadog-samples/modules-declaration.sample +++ b/datadog-samples/modules-declaration.sample @@ -1,15 +1,6 @@ -module "datadog-monitors" { - source = "git::ssh://git@bitbucket.org/morea/terraform.datadog.monitors.git" - - env = "${var.environment}" - region = "${var.region}" - - critical_escalation_group = "${var.critical_escalation_group}" - warning_escalation_group = "${var.warning_escalation_group}" - - - dd_aws_rds = "${var.dd_aws_rds}" - dd_system = "${var.dd_system}" +module "datadog-monitors-feature" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git/{monitors_feature_path}?ref={revision}" + environment = "${var.environment}" + message = "${module.datadog-message-alerting.alerting-message}" } - From 44f6368c03127e1f247cfe8d25f4d94262bcc73b Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Fri, 23 Mar 2018 18:34:51 +0100 Subject: [PATCH 2/7] MON-97 - Updated notes and how to contribute --- README.md | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 722c827..f69359c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Here is the repository organization : - [storage](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/storage/) - [stream-analytics](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/stream-analytics/) - common - - alerting-message + - [alerting-message](https://bitbucket.org/morea/terraform.feature.datadog/src/master/common/alerting-message/) - databases - [mongodb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/databases/mongodb/) - datadog-samples @@ -40,23 +40,21 @@ Here is the repository organization : First, you may refresh your knowledge and look at the [terminalogy](https://confluence.fr.clara.net/display/DAT/Getting+started) -If you want to report an issue please be sure to follow this page : [How to report an issue](https://confluence.fr.clara.net/display/DAT/Project+and+Workflow) +To contribute you will need to [report an issue](https://confluence.fr.clara.net/display/DAT/Project+and+Workflow). -It explains the different stages of a request, from the `Backlog` to the `Merged`. - -If you want to contribute to any request, you must follow our [best practices](https://confluence.fr.clara.net/display/DAT/Templates+monitors). +If you would like to resolve an issue or implement new monitors you must follow our [best practices](https://confluence.fr.clara.net/display/DAT/Templates+monitors). ### Important notes ### -* Each folder can be import as a feature on terraform, you must choose the one that you need. -* Each of these features contains the most commons monitors, but they probably not fulfill all your customer needs -* You still can create some DataDog monitors after importing a feature, it's even advisable to complete your needs -* You will find a complete `README.md` on each feature, explaining the feature's workaround -* The `alerting-message` module defines the alert channel and must be included in each configuration, you have to define it (Pager, Slack...) +* This repository represents a terraform feature and each first level directory could be imported as a terraform module, you must choose the one(s) you need. +* Each of these modules contains the most commons monitors, but they probably not fulfill all your customer needs +* You still can create some specific DataDog monitors after importing a module, it's even advisable to complete your needs +* You will find a complete `README.md` on each module, explaining how to use it. +* The `alerting-message` module could be used to easily generate a templating message to use by default but it could be used also multiple times to generate messages for specific monitors. ### The DataDog provider ### -Before importing some features, you must define the DataDog provider in your `main.tf` +Before importing some modules, you must define the DataDog provider in your `main.tf` ``` provider "datadog" { From d2d6dbfc983ea473b1f07f1bf5121832bb2bfc32 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Fri, 23 Mar 2018 23:42:07 +0100 Subject: [PATCH 3/7] MON-97 remove datadog samples which are not useful with readme --- datadog-samples/inputs-declaration.sample | 47 ---------------------- datadog-samples/modules-declaration.sample | 6 --- datadog-samples/users-datadog.sample | 7 ---- 3 files changed, 60 deletions(-) delete mode 100644 datadog-samples/inputs-declaration.sample delete mode 100644 datadog-samples/modules-declaration.sample delete mode 100644 datadog-samples/users-datadog.sample diff --git a/datadog-samples/inputs-declaration.sample b/datadog-samples/inputs-declaration.sample deleted file mode 100644 index 01e8c8d..0000000 --- a/datadog-samples/inputs-declaration.sample +++ /dev/null @@ -1,47 +0,0 @@ -# Global Terraform -variable "environment" { - description = "Architecture Environment" - type = "string" -} - -# Global DataDog -variable "evaluation_delay" { - description = "Delay in seconds for the metric evaluation" - default = 600 -} - -variable "message" { - description = "Message sent when an alert is triggered" -} - -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 = "*" -} - -# instance specific - -variable "cpu_threshold_warning" { - description = "CPU usage in percent (warning threshold)" - default = "80" -} - -variable "cpu_threshold_critical" { - description = "CPU usage in percent (critical threshold)" - default = "90" -} - -variable "diskspace_threshold_warning" { - description = "Disk free space in percent (warning threshold)" - default = "20" -} - -variable "diskspace_threshold_critical" { - description = "Disk free space in percent (critical threshold)" - default = "10" -} diff --git a/datadog-samples/modules-declaration.sample b/datadog-samples/modules-declaration.sample deleted file mode 100644 index 8965975..0000000 --- a/datadog-samples/modules-declaration.sample +++ /dev/null @@ -1,6 +0,0 @@ -module "datadog-monitors-feature" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git/{monitors_feature_path}?ref={revision}" - - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" -} diff --git a/datadog-samples/users-datadog.sample b/datadog-samples/users-datadog.sample deleted file mode 100644 index 3fde771..0000000 --- a/datadog-samples/users-datadog.sample +++ /dev/null @@ -1,7 +0,0 @@ -#Datadog users -resource "datadog_user" "adrien_brefort" { - email = "adrien.brefort@fr.clara.net" - handle = "adrien.brefort@fr.clara.net" - name = "Adrien Bréfort" -} - From cd0c20324eb1f512d41fea9f9c015b7a398af3a6 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Sat, 24 Mar 2018 23:20:55 +0100 Subject: [PATCH 4/7] MON-97 harmonize with repo terraform.feature.datadog.integrations --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f69359c..ebe73ff 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ Here is the repository organization : - [alerting-message](https://bitbucket.org/morea/terraform.feature.datadog/src/master/common/alerting-message/) - databases - [mongodb](https://bitbucket.org/morea/terraform.feature.datadog/src/master/databases/mongodb/) -- datadog-samples - incubator - middleware - [apache](https://bitbucket.org/morea/terraform.feature.datadog/src/master/middleware/apache/) @@ -38,7 +37,7 @@ Here is the repository organization : ### How to contribute ? ### -First, you may refresh your knowledge and look at the [terminalogy](https://confluence.fr.clara.net/display/DAT/Getting+started) +First, you may refresh your knowledge and look at the [terminalogy](https://confluence.fr.clara.net/display/DAT/Getting+started). To contribute you will need to [report an issue](https://confluence.fr.clara.net/display/DAT/Project+and+Workflow). @@ -67,15 +66,15 @@ Both of the `datadog_api_key` and `datadog_app_key` are unique to the client. ### Module Declaration example ### -A quick example to how import the monitors that you need : +A quick example to how import a monitors set that you need : ``` -module "datadog-monitors-feature" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git/{monitors_feature_path}?ref={revision}" +module "datadog-monitors-my-monitors-set" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//my/monitors/set?ref={revision}" environment = "${var.environment}" message = "${module.datadog-message-alerting.alerting-message}" } ``` -`{monitors_feature_path}` could be defined as `/cloud/aws/elb` for example. +`my/monitors/set` represents the path to an monitors set directory listed above. From aae31665f98418b7c7e1190ee669c8a81e9912dd Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Mon, 26 Mar 2018 11:43:23 +0200 Subject: [PATCH 5/7] MON-97 - Updated README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebe73ff..898c156 100644 --- a/README.md +++ b/README.md @@ -77,4 +77,5 @@ module "datadog-monitors-my-monitors-set" { } ``` -`my/monitors/set` represents the path to an monitors set directory listed above. +`my/monitors/set` represents the path to an monitors set directory listed above. +The `//` is very important, it's a terraform specific syntax used to separate git url and folder path. From 97561df4740d84fda67dbf9c8ab26290496b0da8 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Tue, 27 Mar 2018 14:09:49 +0200 Subject: [PATCH 6/7] MON-97 - Fixed some typo --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 898c156..7ab8bcd 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This repository is used to store all our monitors templates. -Here is the repository organization : +Here is the repository organization: - cloud - aws @@ -37,7 +37,7 @@ Here is the repository organization : ### How to contribute ? ### -First, you may refresh your knowledge and look at the [terminalogy](https://confluence.fr.clara.net/display/DAT/Getting+started). +First, you may refresh your knowledge and look at the [terminology](https://confluence.fr.clara.net/display/DAT/Getting+started). To contribute you will need to [report an issue](https://confluence.fr.clara.net/display/DAT/Project+and+Workflow). @@ -66,7 +66,7 @@ Both of the `datadog_api_key` and `datadog_app_key` are unique to the client. ### Module Declaration example ### -A quick example to how import a monitors set that you need : + A quick example of using a set of monitors: ``` module "datadog-monitors-my-monitors-set" { From b2b80994afa91dfaed3529044b9cb6a04b5a0093 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 29 Mar 2018 17:29:03 +0200 Subject: [PATCH 7/7] MON-97 Add message module in usage example --- README.md | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 7ab8bcd..086e8b6 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ If you would like to resolve an issue or implement new monitors you must follow ### Important notes ### * This repository represents a terraform feature and each first level directory could be imported as a terraform module, you must choose the one(s) you need. -* Each of these modules contains the most commons monitors, but they probably not fulfill all your customer needs +* Each of these modules contains the most commons monitors, but they probably do not fulfill all your customer needs * You still can create some specific DataDog monitors after importing a module, it's even advisable to complete your needs * You will find a complete `README.md` on each module, explaining how to use it. * The `alerting-message` module could be used to easily generate a templating message to use by default but it could be used also multiple times to generate messages for specific monitors. @@ -66,16 +66,37 @@ Both of the `datadog_api_key` and `datadog_app_key` are unique to the client. ### Module Declaration example ### - A quick example of using a set of monitors: + A quick example of using a set of monitors for a given terraform module: ``` -module "datadog-monitors-my-monitors-set" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//my/monitors/set?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" +variable "oncall_24x7" { + default = "@pagerduty-Public_Cloud_FR_-_Yoda_-_Unibail_HNO" +} + +variable "oncall_office_hours" { + default = "@pagerduty-Public_Cloud_FR_-_Yoda_-_Unibail_HO" +} + +variable "oncall_nodata" { + default = "@pagerduty-Public_Cloud_FR_-_Yoda_-_Unibail_HNO" +} + +module "datadog-message-alerting" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//common/alerting-message" + + message_alert = "${var.oncall_24x7}" + message_warning = "${var.oncall_office_hours}" + message_nodata = "${var.oncall_nodata}" +} + +module "datadog-monitors-my-monitors-set" { + source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//my/monitors/set?ref={revision}" + + environment = "${var.environment}" + message = "${module.datadog-message-alerting.alerting-message}" } ``` -`my/monitors/set` represents the path to an monitors set directory listed above. +`my/monitors/set` represents the path to a monitors set sub directory listed above. The `//` is very important, it's a terraform specific syntax used to separate git url and folder path.