Skip to content

Commit 2f9e033

Browse files
authored
Merge pull request #1 from rhythmictech/fix
bug fixes and tuning
2 parents 3fe573c + 1d73043 commit 2f9e033

32 files changed

+632
-177
lines changed

.github/workflows/tfsec.yaml

Lines changed: 0 additions & 26 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# terraform-datadog-monitors
1+
# terraform-datadog-monitor
22

3-
[![tflint](https://github.com/rhythmictech/terraform-datadog-monitors/workflows/tflint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitors/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster)
4-
[![tfsec](https://github.com/rhythmictech/terraform-datadog-monitors/workflows/tfsec/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitors/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster)
5-
[![yamllint](https://github.com/rhythmictech/terraform-datadog-monitors/workflows/yamllint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitors/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster)
6-
[![misspell](https://github.com/rhythmictech/terraform-datadog-monitors/workflows/misspell/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitors/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster)
7-
[![pre-commit-check](https://github.com/rhythmictech/terraform-datadog-monitors/workflows/pre-commit-check/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitors/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster)
3+
A collection of semi-opinionated Datadog monitors for a variety of use cases.
4+
5+
[![tflint](https://github.com/rhythmictech/terraform-datadog-monitor/workflows/tflint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitor/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster)
6+
[![tfsec](https://github.com/rhythmictech/terraform-datadog-monitor/workflows/tfsec/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitor/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster)
7+
[![yamllint](https://github.com/rhythmictech/terraform-datadog-monitor/workflows/yamllint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitor/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster)
8+
[![misspell](https://github.com/rhythmictech/terraform-datadog-monitor/workflows/misspell/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitor/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster)
9+
[![pre-commit-check](https://github.com/rhythmictech/terraform-datadog-monitor/workflows/pre-commit-check/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-datadog-monitor/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster)
810
<a href="https://twitter.com/intent/follow?screen_name=RhythmicTech"><img src="https://img.shields.io/twitter/follow/RhythmicTech?style=social&logo=twitter" alt="follow on Twitter"></a>
911

1012
## Requirements
@@ -19,7 +21,7 @@ provider "datadog" {
1921
}
2022
2123
module "monitor" {
22-
source = "rhythmictech/monitors/datadog/module"
24+
source = "rhythmictech/monitors/datadog/aws/ec2"
2325
2426
}
2527
```

aws/alb/.terraform.lock.hcl

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/alb/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ resource "datadog_monitor" "http_5xx_responses" {
2727

2828
query = <<END
2929
min(${var.http_5xx_responses_evaluation_window}):
30-
default(avg:aws.applicationelb.httpcode_elb_5xx${local.query_filter} by {region,loadbalancer}.as_rate(), 0) / (
31-
default(avg:aws.applicationelb.request_count${local.query_filter} by {region,loadbalancer}.as_rate(), 1)
30+
default(avg:aws.applicationelb.httpcode_elb_5xx${local.query_filter} by {loadbalancer,region,aws_account}.as_rate(), 0) / (
31+
default(avg:aws.applicationelb.request_count${local.query_filter} by {loadbalancer,region,aws_account}.as_rate(), 1)
3232
) * 100 > ${var.http_5xx_responses_threshold_critical}
3333
END
3434

@@ -57,8 +57,8 @@ resource "datadog_monitor" "http_5xx_tg_responses" {
5757

5858
query = <<END
5959
min(${var.http_5xx_tg_responses_evaluation_window}):
60-
default(avg:aws.applicationelb.httpcode_elb_5xx${local.query_filter} by {region,loadbalancer,targetgroup}.as_rate(), 0) / (
61-
default(avg:aws.applicationelb.request_count${local.query_filter} by {region,loadbalancer,targetgroup}.as_rate(), 1)
60+
default(avg:aws.applicationelb.httpcode_elb_5xx${local.query_filter} by {loadbalancer,region,aws_account,targetgroup}.as_rate(), 0) / (
61+
default(avg:aws.applicationelb.request_count${local.query_filter} by {loadbalancer,region,aws_account,targetgroup}.as_rate(), 1)
6262
) * 100 > ${var.http_5xx_tg_responses_threshold_critical}
6363
END
6464

@@ -88,7 +88,7 @@ resource "datadog_monitor" "latency" {
8888

8989
query = <<END
9090
avg(${var.latency_evaluation_window}):
91-
default(avg:aws.applicationelb.target_response_time.average${local.query_filter} by {region,loadbalancer}, 0
91+
default(avg:aws.applicationelb.target_response_time.average${local.query_filter} by {loadbalancer,region,aws_account}, 0
9292
) > ${var.latency_threshold_critical}
9393
END
9494

@@ -117,9 +117,9 @@ resource "datadog_monitor" "no_healthy_instances" {
117117

118118
query = <<END
119119
min(${var.no_healthy_instances_evaluation_window}): (
120-
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {region,loadbalancer} / (
121-
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {region,loadbalancer} +
122-
sum:aws.applicationelb.un_healthy_host_count.maximum${local.query_filter} by {region,loadbalancer} )
120+
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {loadbalancer,region,aws_account} / (
121+
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {loadbalancer,region,aws_account} +
122+
sum:aws.applicationelb.un_healthy_host_count.maximum${local.query_filter} by {loadbalancer,region,aws_account} )
123123
) <= ${var.no_healthy_instances_threshold_critical}
124124
END
125125

aws/apigateway/.terraform.lock.hcl

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/apigateway/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ resource "datadog_monitor" "http_5xx_responses" {
2727

2828
query = <<END
2929
min(${var.http_5xx_responses_evaluation_window}):
30-
default(avg:aws.apigateway.5xxerror{${local.query_filter}} by {region,apiname,stage}.as_rate(), 0) / (
31-
default(avg:aws.apigateway.count{${local.query_filter}} by {region,apiname,stage}.as_rate(), 1)
30+
default(avg:aws.apigateway.5xxerror{${local.query_filter}} by {stage,apiname,region,aws_account}.as_rate(), 0) / (
31+
default(avg:aws.apigateway.count{${local.query_filter}} by {stage,apiname,region,aws_account}.as_rate(), 1)
3232
) * 100 > ${var.http_5xx_responses_threshold_critical}
3333
END
3434

@@ -57,7 +57,7 @@ resource "datadog_monitor" "latency" {
5757

5858
query = <<END
5959
avg(${var.latency_evaluation_window}):
60-
default(avg:aws.apigateway.latency{${local.query_filter}} by {region,apiname,stage}, 0)
60+
default(avg:aws.apigateway.latency{${local.query_filter}} by {stage,apiname,region,aws_account}, 0)
6161
) > ${var.latency_threshold_critical}
6262
END
6363

aws/beanstalk/.terraform.lock.hcl

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/beanstalk/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ resource "datadog_monitor" "health" {
4040

4141
query = <<END
4242
min(${var.health_evaluation_window}):
43-
min:aws.elasticbeanstalk.environment_health${local.query_filter} by {region,environmentname}
43+
min:aws.elasticbeanstalk.environment_health${local.query_filter} by {environmentname,region,aws_account}
4444
>= ${var.health_threshold_critical}
4545
END
4646

@@ -69,8 +69,8 @@ resource "datadog_monitor" "http_5xx_responses" {
6969

7070
query = <<END
7171
min(${var.http_5xx_responses_evaluation_window}):(
72-
default(sum:aws.elasticbeanstalk.application_requests_5xx${local.query_filter} by {region,environmentname}.as_rate(), 0) /
73-
default(sum:aws.elasticbeanstalk.application_requests_total${local.query_filter} by {region,environmentname}.as_rate(), 1)
72+
default(sum:aws.elasticbeanstalk.application_requests_5xx${local.query_filter} by {environmentname,region,aws_account}.as_rate(), 0) /
73+
default(sum:aws.elasticbeanstalk.application_requests_total${local.query_filter} by {environmentname,region,aws_account}.as_rate(), 1)
7474
) * 100 > ${var.http_5xx_responses_threshold_critical}
7575
END
7676

@@ -98,7 +98,7 @@ resource "datadog_monitor" "latency" {
9898
timeout_h = var.timeout_h
9999

100100
query = <<END
101-
min:${var.latency_evaluation_window}):min:aws.elasticbeanstalk.${local.latency_metric}${local.query_filter} by {region,environmentname}
101+
min:${var.latency_evaluation_window}):min:aws.elasticbeanstalk.${local.latency_metric}${local.query_filter} by {environmentname,region,aws_account}
102102
>= ${var.latency_threshold_critical}
103103
END
104104

@@ -127,7 +127,7 @@ resource "datadog_monitor" "root_disk_usage" {
127127

128128
query = <<END
129129
max:${var.latency_evaluation_window}):
130-
min:aws.elasticbeanstalk.root_filesystem_util${local.query_filter} by {region,environmentname,host}
130+
min:aws.elasticbeanstalk.root_filesystem_util${local.query_filter} by {host,environmentname,region,aws_account}
131131
>= ${var.root_disk_usage_threshold_critical}
132132
END
133133

aws/ec2/.terraform.lock.hcl

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aws/ec2/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Configures monitors for EC2 instance health, including host issues, instance status check, ec2 status checks, and attached volume status check.
44

5+
All checks are enabled by default.
6+
57
<!-- BEGIN_TF_DOCS -->
68
## Requirements
79

0 commit comments

Comments
 (0)