Git Product home page Git Product logo

terraform-datadog-monitors's Introduction

DataDog Monitors

Changelog Notice Apache V2 License

This repository aims to provide a base of generic and pre configured monitors for Datadog templated thanks to Terraform and the Datadog Provider.

Important notes

  • This repository provide multiple Terraform modules which could be imported, 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 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 and its specificities if there.
  • The alerting-message module could be used to easily generate a templating message to re-use and could be used multiple times to suit different use cases.
  • Some monitors are disabled by default because not generic or "plug and play" enough, if you use them you will need to tweak them or in some cases disabled another one which could "duplicate" the check.

Getting started

Versions

Here are the minimum versions required to use these modules of integrations.

terraform {
  required_providers {
    datadog = {
      source = "DataDog/datadog"
      version = ">= 3.1.2"
    }
  }
  required_version = ">= 0.12.31"
}

Note: if you want to use Datadog provider v2, you need to use version 3 of the modules in this repository.

DataDog provider

Here is the last tester terraform provider version for datadog but next versions should work too.

provider "datadog" {
  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 each datadog account. You can define them in terraform.tfvars file:

datadog_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
datadog_app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Variables

Some variables need to be declared.

variable "environment" {
  type    = string
  default = "dev"
}

variable "datadog_api_key" {
  type = string
}

variable "datadog_app_key" {
  type = string
}

Modules declaration example

A quick example of alerting message module declaration:

locals {
  oncall_24x7         = "@pagerduty-MyPagerService_NBH"
  oncall_office_hours = "@pagerduty-MyPagerService_BH"
}

module "datadog-message-alerting" {
  source = "claranet/monitors/datadog//common/alerting-message"
  version = "{revision}"

  message_alert   = local.oncall_24x7
  message_warning = local.oncall_office_hours
  message_nodata  = local.oncall_24x7
}

module "datadog-message-alerting-bh-only" {
  source = "claranet/monitors/datadog//common/alerting-message"
  version = "{revision}"

  message_alert   = local.oncall_office_hours
  message_warning = local.oncall_office_hours
  message_nodata  = local.oncall_office_hours
}

module "datadog-monitors-system-generic" {
  source = "claranet/monitors/datadog//system/generic"
  version = "{revision}"

  environment = var.environment
  message     = module.datadog-message-alerting.alerting-message

  memory_message = module.datadog-message-alerting-bh-only.alerting-message
  # Use variables to customize monitors configuration
}

# Other monitors modules to declare ...
#module "datadog-monitors-my-monitors-set" {
#  source = "claranet/monitors/datadog//my/monitors/set"
#  version = "{revision}"
#
#  environment = var.environment
#  message     = module.datadog-message-alerting.alerting-message
#}

  • Replace {revision} to the last git tag available on this repository.
  • 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.

Contributions

Contributions are always welcome.

The easiest way is to fork the repository, duplicate a module as "template" and work on it.

An internal CI will run the auto_update.sh script to compare with proposed changes and check if everything is up to date.

So, when PR is ready you will need to run this script and push its changes to pass the CI, see scripts repository for more information.

For example, this will regenerate every READMEs thanks to terraform-docs currently in v0.9.1.

Monitors summary

terraform-datadog-monitors's People

Contributors

abrefort avatar adrienne-cln avatar aohzan avatar bzspi avatar clickboxer avatar ddrugeon avatar gati0 avatar ignacio-rivas avatar jmapro avatar jmleblanc avatar jnancel avatar jphilaine avatar nsenaud avatar pdecat avatar polremy avatar pygillier avatar rafael-romero-carmona-claranet avatar rossifumax avatar shr3ps avatar xp-1000 avatar zfiel avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.