Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve various AWS detectors #579

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
feat: integration_aws-rds-common: optionalize detectors
Florent DELAHAYE committed Jan 10, 2025
commit ef6090031ced0d7a96ac8e0af5bddd9ec48c76cf
2 changes: 1 addition & 1 deletion modules/integration_aws-rds-common/README.md
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ Note the following parameters:

These 3 parameters along with all variables defined in [common-variables.tf](common-variables.tf) are common to all
[modules](../) in this repository. Other variables, specific to this module, are available in
[variables-gen.tf](variables-gen.tf).
[variables.tf](variables.tf) and [variables-gen.tf](variables-gen.tf).
In general, the default configuration "works" but all of these Terraform
[variables](https://www.terraform.io/language/values/variables) make it possible to
customize the detectors behavior to better fit your needs.
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ name: heartbeat
transformation: false
aggregation: ".mean(by=['DBInstanceIdentifier'])"
filtering: "filter('namespace', 'AWS/RDS')"
condition: "var.heartbeat_detector_enabled"

signals:
signal:
1 change: 1 addition & 0 deletions modules/integration_aws-rds-common/conf/01-cpu.yaml
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ aggregation: ".min(over='15m')"

filtering: "filter('namespace', 'AWS/RDS')"
value_unit: "%"
condition: "var.cpu_usage_detector_enabled"

signals:
signal:
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ aggregation: ".min(over='15m')"

filtering: "filter('namespace', 'AWS/RDS')"
value_unit: "Gibibyte"
condition: "var.free_space_detector_enabled"

signals:
signal:
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ transformation: true
aggregation: ".min(over='5m')"

filtering: "filter('namespace', 'AWS/RDS')"
condition: "var.replica_lag_detector_enabled"

signals:
signal:
1 change: 1 addition & 0 deletions modules/integration_aws-rds-common/conf/04-dbload.yaml
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ name: "DB Load"
transformation: true
aggregation: true
filtering: "filter('namespace', 'AWS/RDS') and filter('stat', 'mean')"
condition: "var.dbload_detector_enabled"

signals:
signal:
10 changes: 10 additions & 0 deletions modules/integration_aws-rds-common/detectors-gen.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
resource "signalfx_detector" "heartbeat" {
count = (var.heartbeat_detector_enabled) ? 1 : 0

name = format("%s %s", local.detector_name_prefix, "AWS RDS Common heartbeat")

authorized_writer_teams = var.authorized_writer_teams
@@ -28,6 +30,8 @@ EOF
}

resource "signalfx_detector" "cpu_usage" {
count = (var.cpu_usage_detector_enabled) ? 1 : 0

name = format("%s %s", local.detector_name_prefix, "AWS RDS Common instance cpu")

authorized_writer_teams = var.authorized_writer_teams
@@ -74,6 +78,8 @@ EOF
}

resource "signalfx_detector" "free_space_low" {
count = (var.free_space_detector_enabled) ? 1 : 0

name = format("%s %s", local.detector_name_prefix, "AWS RDS Common instance free space")

authorized_writer_teams = var.authorized_writer_teams
@@ -120,6 +126,8 @@ EOF
}

resource "signalfx_detector" "replica_lag" {
count = (var.replica_lag_detector_enabled) ? 1 : 0

name = format("%s %s", local.detector_name_prefix, "AWS RDS Common replica lag")

authorized_writer_teams = var.authorized_writer_teams
@@ -161,6 +169,8 @@ EOF
}

resource "signalfx_detector" "dbload" {
count = (var.dbload_detector_enabled) ? 1 : 0

name = format("%s %s", local.detector_name_prefix, "AWS RDS Common db load")

authorized_writer_teams = var.authorized_writer_teams
29 changes: 29 additions & 0 deletions modules/integration_aws-rds-common/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "heartbeat_detector_enabled" {
description = "Enable heartbeat detector"
type = bool
default = true
}

variable "cpu_usage_detector_enabled" {
description = "Enable cpu usage detector"
type = bool
default = true
}

variable "free_space_detector_enabled" {
description = "Enable free space detector"
type = bool
default = true
}

variable "replica_lag_detector_enabled" {
description = "Enable replica lag detector"
type = bool
default = true
}

variable "dbload_detector_enabled" {
description = "Enable dbload detector"
type = bool
default = true
}