This repository is used to store all our monitors templates ready to use for generic purpose.
First, you may refresh your knowledge and look at the terminology.
To contribute you will need to report an issue and create a branch with its Jira ID.
If you would like to resolve an issue or implement new monitors you must follow our best practices.
After any change you should run ./scripts/auto_update.sh ./
command to make sure all is up to date else the CI pipeline will fail on the branch.
- 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 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.
Before importing some modules, you must define the DataDog provider in your main.tf
provider "datadog" {
version = "2.0.2"
api_key = "${var.datadog_api_key}"
app_key = "${var.datadog_app_key}"
}
Both of the datadog_api_key
and datadog_app_key
are unique to the client.
A quick example of using a set of monitors for a given terraform module:
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}"
}
The //
is very important, it's a terraform specific syntax used to separate git url and folder path.
my/monitors/set
represents the path to a monitors set sub directory listed below.