From 8d72f63d282c8b42839d4454311c9e091e253be2 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 22 Aug 2018 17:05:36 +0200 Subject: [PATCH 1/4] MON-293 fix pipeline --- bitbucket-pipelines.yml | 2 +- scripts/01_update_output.sh | 2 +- scripts/02_update_readme.sh | 6 +++--- scripts/03_update_module.sh | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 28affab..fbab30c 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -18,7 +18,7 @@ pipelines: script: - apk update - apk upgrade - - apk add --no-cache bash git grep + - apk add --no-cache bash git grep coreutils - go get github.com/segmentio/terraform-docs - ./scripts/auto_update.sh - git status diff --git a/scripts/01_update_output.sh b/scripts/01_update_output.sh index 4a6ad0c..a5fe989 100755 --- a/scripts/01_update_output.sh +++ b/scripts/01_update_output.sh @@ -4,7 +4,7 @@ set -xueo pipefail source "$(dirname $0)/utils.sh" goto_root -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print); do +for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) > outputs.tf for monitor in $(grep 'resource "datadog_monitor"' $(basename $path) | awk '{print $3}' | tr -d '"' ); do diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index 56db16b..ea8e6a5 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -6,7 +6,7 @@ goto_root sed -i '/### Monitors summary ###/q' README.md echo >> README.md -for path in $(find -mindepth 1 \( -path './incubator' -o -path './scripts' -o -path './testing' -o -path '*/\.*' \) -prune -o -type d -print | sort); do +for path in $(find -mindepth 1 \( -path './incubator' -o -path './scripts' -o -path './testing' -o -path '*/\.*' \) -prune -o -type d -print | sort -fdbi); do directories=($(list_dirs $path)) for i in $(seq 1 $((${#directories[@]}-1))); do echo -en "\t" >> README.md @@ -20,7 +20,7 @@ done PATTERN_DOC="Related documentation" -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print); do +for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) EXIST=0 if [ -f README.md ]; then @@ -53,7 +53,7 @@ Creates DataDog monitors with the following checks: EOF SAVEIFS=$IFS IFS=$(echo -en "\n\b") - for match in $(grep -E ^[[:space:]]+name[[:space:]]+= $(basename ${path})); do + for match in $(grep -E ^[[:space:]]+name[[:space:]]+= $(basename ${path}) | sort -fdbi); do name=$(get_name "${match}") echo "- ${name/could reach/forecast}" >> README.md done diff --git a/scripts/03_update_module.sh b/scripts/03_update_module.sh index c5adb5f..e4415b3 100755 --- a/scripts/03_update_module.sh +++ b/scripts/03_update_module.sh @@ -4,7 +4,7 @@ set -xueo pipefail source "$(dirname $0)/utils.sh" goto_root -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print); do +for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) resource="$(basename $(dirname $path))" if ! [ -f modules.tf ] && grep -q filter_tags_use_defaults inputs.tf; then From 03319377a534172560d00b724974a2f2cb8b3f1f Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 22 Aug 2018 17:08:45 +0200 Subject: [PATCH 2/4] MON-293 auto update --- cloud/aws/alb/README.md | 8 ++++---- cloud/aws/apigateway/README.md | 4 ++-- cloud/aws/elasticsearch/README.md | 4 ++-- cloud/aws/elb/README.md | 2 +- cloud/azure/apimanagement/README.md | 2 +- cloud/azure/app-services/README.md | 6 +++--- cloud/azure/eventhub/README.md | 2 +- cloud/azure/iothubs/README.md | 16 ++++++++-------- cloud/azure/redis/README.md | 2 +- cloud/azure/sql-database/README.md | 4 ++-- cloud/azure/storage/README.md | 10 +++++----- cloud/azure/stream-analytics/README.md | 2 +- database/mongodb/README.md | 2 +- database/redis/README.md | 14 +++++++------- system/generic/README.md | 6 +++--- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/cloud/aws/alb/README.md b/cloud/aws/alb/README.md index 4fb7c41..8f202da 100644 --- a/cloud/aws/alb/README.md +++ b/cloud/aws/alb/README.md @@ -16,12 +16,12 @@ module "datadog-monitors-cloud-aws-alb" { Creates DataDog monitors with the following checks: -- ALB no healthy instances -- ALB latency -- ALB HTTP code 5xx - ALB HTTP code 4xx -- ALB target HTTP code 5xx +- ALB HTTP code 5xx +- ALB latency +- ALB no healthy instances - ALB target HTTP code 4xx +- ALB target HTTP code 5xx ## Inputs diff --git a/cloud/aws/apigateway/README.md b/cloud/aws/apigateway/README.md index 81095ab..50a1496 100644 --- a/cloud/aws/apigateway/README.md +++ b/cloud/aws/apigateway/README.md @@ -16,9 +16,9 @@ module "datadog-monitors-cloud-aws-apigateway" { Creates DataDog monitors with the following checks: -- API Gateway latency -- API Gateway HTTP 5xx errors - API Gateway HTTP 4xx errors +- API Gateway HTTP 5xx errors +- API Gateway latency ## Inputs diff --git a/cloud/aws/elasticsearch/README.md b/cloud/aws/elasticsearch/README.md index 3aa516e..62c7619 100644 --- a/cloud/aws/elasticsearch/README.md +++ b/cloud/aws/elasticsearch/README.md @@ -16,9 +16,9 @@ module "datadog-monitors-cloud-aws-elasticsearch" { Creates DataDog monitors with the following checks: -- ElasticSearch cluster status is not green -- ElasticSearch cluster free storage space - ElasticSearch cluster CPU high +- ElasticSearch cluster free storage space +- ElasticSearch cluster status is not green ## Inputs diff --git a/cloud/aws/elb/README.md b/cloud/aws/elb/README.md index 1e843f8..04273d7 100644 --- a/cloud/aws/elb/README.md +++ b/cloud/aws/elb/README.md @@ -16,12 +16,12 @@ module "datadog-monitors-cloud-aws-elb" { Creates DataDog monitors with the following checks: -- ELB no healthy instances - ELB 4xx errors too high - ELB 5xx errors too high - ELB backend 4xx errors too high - ELB backend 5xx errors too high - ELB latency too high +- ELB no healthy instances ## Inputs diff --git a/cloud/azure/apimanagement/README.md b/cloud/azure/apimanagement/README.md index 908ab4b..02a24d1 100644 --- a/cloud/azure/apimanagement/README.md +++ b/cloud/azure/apimanagement/README.md @@ -17,10 +17,10 @@ module "datadog-monitors-cloud-azure-apimanagement" { Creates DataDog monitors with the following checks: - API Management is down +- API Management successful requests rate too low - API Management too many failed requests - API Management too many other requests - API Management too many unauthorized requests -- API Management successful requests rate too low ## Inputs diff --git a/cloud/azure/app-services/README.md b/cloud/azure/app-services/README.md index e2a7d71..192bb4e 100644 --- a/cloud/azure/app-services/README.md +++ b/cloud/azure/app-services/README.md @@ -16,11 +16,11 @@ module "datadog-monitors-cloud-azure-app-services" { Creates DataDog monitors with the following checks: -- App Services response time too high -- App Services memory usage -- App Services HTTP 5xx errors too high - App Services HTTP 4xx errors too high +- App Services HTTP 5xx errors too high - App Services HTTP successful responses too low +- App Services memory usage +- App Services response time too high ## Inputs diff --git a/cloud/azure/eventhub/README.md b/cloud/azure/eventhub/README.md index 48666bc..24e3732 100644 --- a/cloud/azure/eventhub/README.md +++ b/cloud/azure/eventhub/README.md @@ -17,8 +17,8 @@ module "datadog-monitors-cloud-azure-eventhub" { Creates DataDog monitors with the following checks: - Event Hub is down -- Event Hub too many failed requests - Event Hub too many errors +- Event Hub too many failed requests ## Inputs diff --git a/cloud/azure/iothubs/README.md b/cloud/azure/iothubs/README.md index c569c75..1dcfa13 100644 --- a/cloud/azure/iothubs/README.md +++ b/cloud/azure/iothubs/README.md @@ -16,20 +16,20 @@ module "datadog-monitors-cloud-azure-iothubs" { Creates DataDog monitors with the following checks: -- IOT Hub Too many jobs failed -- IOT Hub Too many list_jobs failure -- IOT Hub Too many query_jobs failed - IOT Hub is down -- IOT Hub Total devices is wrong - IOT Hub Too many c2d methods failure - IOT Hub Too many c2d twin read failure - IOT Hub Too many c2d twin update failure +- IOT Hub Too many d2c telemetry egress dropped +- IOT Hub Too many d2c telemetry egress invalid +- IOT Hub Too many d2c telemetry egress orphaned +- IOT Hub Too many d2c telemetry ingress not sent - IOT Hub Too many d2c twin read failure - IOT Hub Too many d2c twin update failure -- IOT Hub Too many d2c telemetry egress dropped -- IOT Hub Too many d2c telemetry egress orphaned -- IOT Hub Too many d2c telemetry egress invalid -- IOT Hub Too many d2c telemetry ingress not sent +- IOT Hub Too many jobs failed +- IOT Hub Too many list_jobs failure +- IOT Hub Too many query_jobs failed +- IOT Hub Total devices is wrong ## Inputs diff --git a/cloud/azure/redis/README.md b/cloud/azure/redis/README.md index bfd3e2a..d8f1922 100644 --- a/cloud/azure/redis/README.md +++ b/cloud/azure/redis/README.md @@ -17,9 +17,9 @@ module "datadog-monitors-cloud-azure-redis" { Creates DataDog monitors with the following checks: - Redis {{name}} is down -- Redis too many evictedkeys - Redis processor time too high - Redis server load too high +- Redis too many evictedkeys ## Inputs diff --git a/cloud/azure/sql-database/README.md b/cloud/azure/sql-database/README.md index 1eff63d..1c09157 100644 --- a/cloud/azure/sql-database/README.md +++ b/cloud/azure/sql-database/README.md @@ -17,9 +17,9 @@ module "datadog-monitors-cloud-azure-sql-database" { Creates DataDog monitors with the following checks: - SQL Database CPU too high -- SQL Database low free space -- SQL Database DTU Consumption too high - SQL Database Deadlocks too high +- SQL Database DTU Consumption too high +- SQL Database low free space ## Inputs diff --git a/cloud/azure/storage/README.md b/cloud/azure/storage/README.md index a5fae11..5ae66e5 100644 --- a/cloud/azure/storage/README.md +++ b/cloud/azure/storage/README.md @@ -19,12 +19,12 @@ Creates DataDog monitors with the following checks: - Azure Storage is down - Azure Storage too few successful requests - Azure Storage too high end to end latency -- Azure Storage too many timeout errors -- Azure Storage too many network errors -- Azure Storage too many throttling errors -- Azure Storage too many server_other errors -- Azure Storage too many client_other errors - Azure Storage too many authorization errors +- Azure Storage too many client_other errors +- Azure Storage too many network errors +- Azure Storage too many server_other errors +- Azure Storage too many throttling errors +- Azure Storage too many timeout errors ## Inputs diff --git a/cloud/azure/stream-analytics/README.md b/cloud/azure/stream-analytics/README.md index c333bcc..bbec40a 100644 --- a/cloud/azure/stream-analytics/README.md +++ b/cloud/azure/stream-analytics/README.md @@ -18,8 +18,8 @@ Creates DataDog monitors with the following checks: - Stream Analytics is down - Stream Analytics streaming units utilization too high -- Stream Analytics too many failed requests - Stream Analytics too many conversion errors +- Stream Analytics too many failed requests - Stream Analytics too many runtime errors ## Inputs diff --git a/database/mongodb/README.md b/database/mongodb/README.md index 9c8b6b7..01653ac 100644 --- a/database/mongodb/README.md +++ b/database/mongodb/README.md @@ -17,9 +17,9 @@ module "datadog-monitors-database-mongodb" { Creates DataDog monitors with the following checks: - MongoDB primary state +- MongoDB replication lag - MongoDB secondary missing - MongoDB too much servers or wrong monitoring config -- MongoDB replication lag ## Inputs diff --git a/database/redis/README.md b/database/redis/README.md index e162a51..1aa52c8 100644 --- a/database/redis/README.md +++ b/database/redis/README.md @@ -16,16 +16,16 @@ module "datadog-monitors-database-redis" { Creates DataDog monitors with the following checks: +- Redis blocked clients +- Redis does not respond - Redis evicted keys - Redis expired keys -- Redis blocked clients -- Redis keyspace seems full (no changes since ${var.keyspace_timeframe}) -- Redis memory used -- Redis memory fragmented -- Redis rejected connections -- Redis latency - Redis hitrate -- Redis does not respond +- Redis keyspace seems full (no changes since ${var.keyspace_timeframe}) +- Redis latency +- Redis memory fragmented +- Redis memory used +- Redis rejected connections ## Inputs diff --git a/system/generic/README.md b/system/generic/README.md index e7bfd60..4c03a8e 100644 --- a/system/generic/README.md +++ b/system/generic/README.md @@ -16,13 +16,13 @@ module "datadog-monitors-system-generic" { Creates DataDog monitors with the following checks: -- Host unreachable -- CPU usage - CPU load 5 -- Free disk space +- CPU usage - Disk Space forecast - Free disk inodes +- Free disk space - Free memory +- Host unreachable ## Inputs From 89d7258402cb5ee1bd0323f50154bc28579d066e Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 22 Aug 2018 17:23:25 +0200 Subject: [PATCH 3/4] MON-293 optimize pipeline --- bitbucket-pipelines.yml | 11 ----------- main.tf.ci | 7 ------- scripts/01_update_output.sh | 1 - scripts/03_update_module.sh | 1 - scripts/99_terraform.sh | 7 +++++++ terraform.tfvars.ci | 6 ------ 6 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 main.tf.ci create mode 100755 scripts/99_terraform.sh delete mode 100644 terraform.tfvars.ci diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index fbab30c..40a6653 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -2,17 +2,6 @@ image: hashicorp/terraform:full pipelines: default: - - step: - name: Terraform format - script: - - terraform fmt -write=false -diff -check - - step: - name: Terraform validate - script: - - mv main.tf.ci main.tf - - mv terraform.tfvars.ci terraform.tfvars - - terraform init - - terraform validate - step: name: Check auto update script: diff --git a/main.tf.ci b/main.tf.ci deleted file mode 100644 index a2d1b10..0000000 --- a/main.tf.ci +++ /dev/null @@ -1,7 +0,0 @@ -variable "aws_region" {} - -provider "aws" { - version = "1.2.0" - - region = "${var.aws_region}" -} diff --git a/scripts/01_update_output.sh b/scripts/01_update_output.sh index a5fe989..70ee7e5 100755 --- a/scripts/01_update_output.sh +++ b/scripts/01_update_output.sh @@ -19,4 +19,3 @@ EOF done cd - >> /dev/null done -terraform fmt "$(get_scope $1)" diff --git a/scripts/03_update_module.sh b/scripts/03_update_module.sh index e4415b3..6d4f1be 100755 --- a/scripts/03_update_module.sh +++ b/scripts/03_update_module.sh @@ -21,4 +21,3 @@ EOF fi cd - >> /dev/null done -terraform fmt "$(get_scope $1)" diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh new file mode 100755 index 0000000..65abd0c --- /dev/null +++ b/scripts/99_terraform.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -xueo pipefail + +source "$(dirname $0)/utils.sh" +goto_root + +terraform fmt diff --git a/terraform.tfvars.ci b/terraform.tfvars.ci deleted file mode 100644 index 9aa2075..0000000 --- a/terraform.tfvars.ci +++ /dev/null @@ -1,6 +0,0 @@ -aws_region="eu-west-1" -region="eu-west-1" -env="test" -hno_escalation_group="abc" -ho_escalation_group="abc" - From a50ad2d29d1c3f931cd53bcba1f31fc885fa0763 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 22 Aug 2018 17:39:17 +0200 Subject: [PATCH 4/4] MON-293 remove useless filter tags module on aws vpn --- cloud/aws/vpn/modules.tf | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 cloud/aws/vpn/modules.tf diff --git a/cloud/aws/vpn/modules.tf b/cloud/aws/vpn/modules.tf deleted file mode 100644 index 21e0f1a..0000000 --- a/cloud/aws/vpn/modules.tf +++ /dev/null @@ -1,8 +0,0 @@ -module "filter-tags" { - source = "../../common/filter-tags" - - environment = "${var.environment}" - resource = "vpn" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" -}