Merged in MON-293 (pull request #136)

MON-293 optimize pipeline

Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr>
Approved-by: SJ <sjeoffroi@morea.fr>
Approved-by: Laurent Piroelle <laurent.piroelle@fr.clara.net>
Approved-by: Benoît OYEZ <boyez@morea.fr>
Approved-by: bbenetf <bbenet@morea.fr>
Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net>
This commit is contained in:
Quentin Manfroi 2018-08-22 15:48:58 +00:00
commit 9e2efd825f
23 changed files with 55 additions and 82 deletions

View File

@ -2,23 +2,12 @@ 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:
- 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}"
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,7 +0,0 @@
variable "aws_region" {}
provider "aws" {
version = "1.2.0"
region = "${var.aws_region}"
}

View File

@ -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
@ -19,4 +19,3 @@ EOF
done
cd - >> /dev/null
done
terraform fmt "$(get_scope $1)"

View File

@ -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

View File

@ -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
@ -21,4 +21,3 @@ EOF
fi
cd - >> /dev/null
done
terraform fmt "$(get_scope $1)"

7
scripts/99_terraform.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -xueo pipefail
source "$(dirname $0)/utils.sh"
goto_root
terraform fmt

View File

@ -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

View File

@ -1,6 +0,0 @@
aws_region="eu-west-1"
region="eu-west-1"
env="test"
hno_escalation_group="abc"
ho_escalation_group="abc"