From 9d75b4a096f080545a167a09382ec1da4d318e08 Mon Sep 17 00:00:00 2001 From: Alexandre Gaillet Date: Fri, 23 Mar 2018 16:50:04 +0100 Subject: [PATCH] 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}" } -