Merged in MON-259_improve_scripts (pull request #110)
MON-259: Improve auto_update scripts Approved-by: Jérôme Respaut <shr3ps@gmail.com> Approved-by: Alexandre Gaillet <alexandre.gaillet@fr.clara.net> Approved-by: Quentin Manfroi <quentin.manfroi@yahoo.fr>
This commit is contained in:
commit
e450587fbb
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-alb" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/alb?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- ALB no healthy instances
|
||||
- ALB latency
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-apigateway" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/apigateway?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- API Gateway latency
|
||||
- API Gateway HTTP 5xx errors
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-elasticsearch" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/elasticsearch?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- ElasticSearch cluster status is not green
|
||||
- ElasticSearch cluster free storage space
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-elb" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/elb?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- ELB no healthy instances
|
||||
- ELB 4xx errors too high
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-kinesis-firehose" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/kinesis-firehose?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Kinesis Firehose No incoming records
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-rds" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/rds?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- RDS instance CPU high
|
||||
- RDS instance free space
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-aws-vpn" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/aws/vpn?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- VPN Down
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-apimanagement" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/apimanagement?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- API Management is down
|
||||
- API Management too many failed requests
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-app-services" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/app-services?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- App Services response time too high
|
||||
- App Services memory usage
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-eventhub" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/eventhub?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Event Hub is down
|
||||
- Event Hub too many failed requests
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-iothubs" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/iothubs?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- IOT Hub Too many jobs failed
|
||||
- IOT Hub Too many list_jobs failure
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-redis" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/redis?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Redis {{name}} is down
|
||||
- Redis too many evictedkeys
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-servicebus" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/servicebus?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Service Bus is down
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-sql-database" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/sql-database?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- SQL Database CPU too high
|
||||
- SQL Database low free space
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-storage" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/storage?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Azure Storage is down
|
||||
- Azure Storage too few successful requests
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-cloud-azure-stream-analytics" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/stream-analytics?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Stream Analytics is down
|
||||
- Stream Analytics streaming units utilization too high
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-databases-mongodb" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//databases/mongodb?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Member down in the replica set
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-middleware-apache" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//middleware/apache?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Can't connect to apache vhost status
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-middleware-nginx" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//middleware/nginx?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- Can't connect to nginx vhost status
|
||||
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-middleware-php-fpm" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//middleware/php-fpm?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- php_fpm busy worker
|
||||
- Can't connect to php-fpm
|
||||
|
||||
@ -4,12 +4,12 @@ set -xueo pipefail
|
||||
source "$(dirname $0)/utils.sh"
|
||||
goto_root
|
||||
|
||||
for path in $(find . -path ./incubator -prune -o -name 'monitors-*.tf' -print); do
|
||||
for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print); do
|
||||
cd $(dirname $path)
|
||||
> outputs.tf
|
||||
for monitor in $(grep 'resource "datadog_monitor"' $(basename $path) | awk '{print $3}' | tr -d '"' ); do
|
||||
echo $monitor
|
||||
cat <<EOF >> outputs.tf
|
||||
cat >> outputs.tf <<EOF
|
||||
output "${monitor}_id" {
|
||||
description = "id for monitor $monitor"
|
||||
value = "\${datadog_monitor.${monitor}.id}"
|
||||
@ -19,4 +19,4 @@ EOF
|
||||
done
|
||||
cd - >> /dev/null
|
||||
done
|
||||
terraform fmt
|
||||
terraform fmt "$(get_scope $1)"
|
||||
|
||||
@ -20,7 +20,7 @@ done
|
||||
|
||||
PATTERN_DOC="Related documentation"
|
||||
|
||||
for path in $(find . -path ./incubator -prune -o -name 'monitors-*.tf' -print); do
|
||||
for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print); do
|
||||
cd $(dirname $path)
|
||||
EXIST=0
|
||||
if [ -f README.md ]; then
|
||||
@ -41,14 +41,14 @@ module "datadog-monitors-${module_dash}" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//${module_slash}?ref={revision}"
|
||||
|
||||
environment = "\${var.environment}"
|
||||
message = "\${module.datadog-message-alerting.alerting-message}"
|
||||
message = "\${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
\`\`\`
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
EOF
|
||||
SAVEIFS=$IFS
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -xueo pipefail
|
||||
|
||||
source "$(dirname $0)/utils.sh"
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
for script in [0-9][0-9]_*.sh; do
|
||||
./${script}
|
||||
./${script} "$(get_scope $1)"
|
||||
done
|
||||
|
||||
@ -9,13 +9,21 @@ function goto_root {
|
||||
fi
|
||||
}
|
||||
|
||||
function get_scope {
|
||||
TO_PARSE="."
|
||||
if [ ! -z ${1+x} ]; then
|
||||
TO_PARSE="$1"
|
||||
fi
|
||||
echo $TO_PARSE
|
||||
}
|
||||
|
||||
function list_dirs {
|
||||
echo ${1} | awk -F '/' '{$1=""; print $0}' | cut -c 2-
|
||||
}
|
||||
|
||||
function get_name {
|
||||
regex='^[[:space:]]+name[[:space:]]+=[[:space:]]+"\[.*\][[:space:]]+(.*)"$'
|
||||
if [[ "${1}" =~ ${regex} ]]; then
|
||||
if [[ "${1}" =~ ${regex} ]]; then
|
||||
name="${BASH_REMATCH[1]}"
|
||||
else
|
||||
echo "Error: impossible to parse monitor name"
|
||||
|
||||
@ -7,14 +7,14 @@ module "datadog-monitors-system-generic" {
|
||||
source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//system/generic?ref={revision}"
|
||||
|
||||
environment = "${var.environment}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
message = "${module.datadog-message-alerting.alerting-message}"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Purpose
|
||||
|
||||
Creates DataDog monitors with the following checks :
|
||||
Creates DataDog monitors with the following checks:
|
||||
|
||||
- CPU usage
|
||||
- CPU load 5
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user