Skip to content

Commit

Permalink
Merge pull request #1 from rhythmictech/fix
Browse files Browse the repository at this point in the history
bug fixes and tuning
  • Loading branch information
cdaniluk committed Mar 13, 2024
2 parents 3fe573c + 1d73043 commit 2f9e033
Show file tree
Hide file tree
Showing 32 changed files with 632 additions and 177 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/tfsec.yaml

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# terraform-datadog-monitors
# terraform-datadog-monitor

[![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)
[![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)
[![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)
[![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)
[![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)
A collection of semi-opinionated Datadog monitors for a variety of use cases.

[![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)
[![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)
[![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)
[![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)
[![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)
<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>

## Requirements
Expand All @@ -19,7 +21,7 @@ provider "datadog" {
}
module "monitor" {
source = "rhythmictech/monitors/datadog/module"
source = "rhythmictech/monitors/datadog/aws/ec2"
}
```
Expand Down
44 changes: 44 additions & 0 deletions aws/alb/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions aws/alb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ resource "datadog_monitor" "http_5xx_responses" {

query = <<END
min(${var.http_5xx_responses_evaluation_window}):
default(avg:aws.applicationelb.httpcode_elb_5xx${local.query_filter} by {region,loadbalancer}.as_rate(), 0) / (
default(avg:aws.applicationelb.request_count${local.query_filter} by {region,loadbalancer}.as_rate(), 1)
default(avg:aws.applicationelb.httpcode_elb_5xx${local.query_filter} by {loadbalancer,region,aws_account}.as_rate(), 0) / (
default(avg:aws.applicationelb.request_count${local.query_filter} by {loadbalancer,region,aws_account}.as_rate(), 1)
) * 100 > ${var.http_5xx_responses_threshold_critical}
END

Expand Down Expand Up @@ -57,8 +57,8 @@ resource "datadog_monitor" "http_5xx_tg_responses" {

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

Expand Down Expand Up @@ -88,7 +88,7 @@ resource "datadog_monitor" "latency" {

query = <<END
avg(${var.latency_evaluation_window}):
default(avg:aws.applicationelb.target_response_time.average${local.query_filter} by {region,loadbalancer}, 0
default(avg:aws.applicationelb.target_response_time.average${local.query_filter} by {loadbalancer,region,aws_account}, 0
) > ${var.latency_threshold_critical}
END

Expand Down Expand Up @@ -117,9 +117,9 @@ resource "datadog_monitor" "no_healthy_instances" {

query = <<END
min(${var.no_healthy_instances_evaluation_window}): (
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {region,loadbalancer} / (
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {region,loadbalancer} +
sum:aws.applicationelb.un_healthy_host_count.maximum${local.query_filter} by {region,loadbalancer} )
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {loadbalancer,region,aws_account} / (
sum:aws.applicationelb.healthy_host_count.minimum${local.query_filter} by {loadbalancer,region,aws_account} +
sum:aws.applicationelb.un_healthy_host_count.maximum${local.query_filter} by {loadbalancer,region,aws_account} )
) <= ${var.no_healthy_instances_threshold_critical}
END

Expand Down
44 changes: 44 additions & 0 deletions aws/apigateway/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions aws/apigateway/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ resource "datadog_monitor" "http_5xx_responses" {

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

Expand Down Expand Up @@ -57,7 +57,7 @@ resource "datadog_monitor" "latency" {

query = <<END
avg(${var.latency_evaluation_window}):
default(avg:aws.apigateway.latency{${local.query_filter}} by {region,apiname,stage}, 0)
default(avg:aws.apigateway.latency{${local.query_filter}} by {stage,apiname,region,aws_account}, 0)
) > ${var.latency_threshold_critical}
END

Expand Down
44 changes: 44 additions & 0 deletions aws/beanstalk/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions aws/beanstalk/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ resource "datadog_monitor" "health" {

query = <<END
min(${var.health_evaluation_window}):
min:aws.elasticbeanstalk.environment_health${local.query_filter} by {region,environmentname}
min:aws.elasticbeanstalk.environment_health${local.query_filter} by {environmentname,region,aws_account}
>= ${var.health_threshold_critical}
END

Expand Down Expand Up @@ -69,8 +69,8 @@ resource "datadog_monitor" "http_5xx_responses" {

query = <<END
min(${var.http_5xx_responses_evaluation_window}):(
default(sum:aws.elasticbeanstalk.application_requests_5xx${local.query_filter} by {region,environmentname}.as_rate(), 0) /
default(sum:aws.elasticbeanstalk.application_requests_total${local.query_filter} by {region,environmentname}.as_rate(), 1)
default(sum:aws.elasticbeanstalk.application_requests_5xx${local.query_filter} by {environmentname,region,aws_account}.as_rate(), 0) /
default(sum:aws.elasticbeanstalk.application_requests_total${local.query_filter} by {environmentname,region,aws_account}.as_rate(), 1)
) * 100 > ${var.http_5xx_responses_threshold_critical}
END

Expand Down Expand Up @@ -98,7 +98,7 @@ resource "datadog_monitor" "latency" {
timeout_h = var.timeout_h

query = <<END
min:${var.latency_evaluation_window}):min:aws.elasticbeanstalk.${local.latency_metric}${local.query_filter} by {region,environmentname}
min:${var.latency_evaluation_window}):min:aws.elasticbeanstalk.${local.latency_metric}${local.query_filter} by {environmentname,region,aws_account}
>= ${var.latency_threshold_critical}
END

Expand Down Expand Up @@ -127,7 +127,7 @@ resource "datadog_monitor" "root_disk_usage" {

query = <<END
max:${var.latency_evaluation_window}):
min:aws.elasticbeanstalk.root_filesystem_util${local.query_filter} by {region,environmentname,host}
min:aws.elasticbeanstalk.root_filesystem_util${local.query_filter} by {host,environmentname,region,aws_account}
>= ${var.root_disk_usage_threshold_critical}
END

Expand Down
44 changes: 44 additions & 0 deletions aws/ec2/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions aws/ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

All checks are enabled by default.

<!-- BEGIN_TF_DOCS -->
## Requirements

Expand Down
Loading

0 comments on commit 2f9e033

Please sign in to comment.