Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- variable "datadog_api_key" {}
- variable "datadog_app_key" {}
- terraform {
- backend "s3" {
- bucket = "masterson-terraform"
- key = "terraform.tfstate"
- region = "ap-southeast-1"
- }
- }
- provider "datadog" {
- api_key = "${var.datadog_api_key}"
- app_key = "${var.datadog_app_key}"
- }
- # Create a new Datadog timeboard
- resource "datadog_timeboard" "aws-rds-dashboard" {
- title = "RDS Dashboard"
- description = "RDS Dashboard by Terraform"
- read_only = true
- graph {
- title = "CPUUtilization"
- viz = "timeseries"
- request {
- q = "avg:aws.rds.cpuutilization{*} by {dbinstanceidentifier}.rollup(avg, 3600)"
- type = "line"
- }
- }
- graph {
- title = "DatabaseConnections"
- viz = "timeseries"
- request {
- q = "avg:aws.rds.database_connections{*} by {dbinstanceidentifier}.rollup(avg, 3600)"
- type = "line"
- }
- }
- }
- resource "datadog_timeboard" "aws-ec2-dashboard" {
- title = "EC2 Dashboard"
- description = "EC2 Dashboard by Terraform"
- read_only = true
- graph {
- title = "CPUUtilization"
- viz = "timeseries"
- request {
- q = "avg:aws.ec2.cpuutilization{*} by {host}.rollup(avg, 3600)"
- type = "line"
- }
- }
- graph {
- title = "DiskIO"
- viz = "timeseries"
- request {
- q = "avg:aws.ebs.volume_read_ops{*} by {host,device}.rollup(avg, 3600)"
- type = "line"
- }
- request {
- q = "avg:aws.ebs.volume_write_ops{*} by {host,device}.rollup(avg, 3600)"
- type = "line"
- }
- }
- graph {
- title = "NetworkIO"
- viz = "timeseries"
- request {
- q = "avg:aws.ec2.network_in{*} by {host}.rollup(avg, 3600)"
- type = "line"
- }
- request {
- q = "avg:aws.ec2.network_out{*} by {host}.rollup(avg, 3600)"
- type = "line"
- }
- }
- }
- resource "datadog_monitor" "Cloudwatch_RDS_CPU_High" {
- name = "Common: RDS CPU High"
- type = "metric alert"
- query = "avg(last_15m):avg:aws.rds.cpuutilization{*} by {host} > 90"
- message = "@webhook-apigw"
- escalation_message = "@webhook-apigw"
- new_host_delay = "900"
- renotify_interval = "600"
- timeout_h = "24"
- notify_no_data = "false"
- require_full_window = "true"
- thresholds {
- warning = 70
- critical = 90
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement