MON-122 add replication lag for rds
This commit is contained in:
parent
050da5f762
commit
2e9a14a49b
@ -22,8 +22,8 @@ Creates DataDog monitors with the following checks:
|
|||||||
|
|
||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|:----:|:-----:|:-----:|
|
|------|-------------|:----:|:-----:|:-----:|
|
||||||
| aurora_replicalag_enabled | Flag to enable RDS CPU usage monitor | string | `true` | no |
|
| aurora_replicalag_enabled | Flag to enable RDS Aurora replica lag monitor | string | `true` | no |
|
||||||
| aurora_replicalag_extra_tags | Extra tags for RDS CPU usage monitor | list | `<list>` | no |
|
| aurora_replicalag_extra_tags | Extra tags for RDS Aurora replica lag monitor | list | `<list>` | no |
|
||||||
| aurora_replicalag_message | Custom message for RDS Aurora replica lag monitor | string | `` | no |
|
| aurora_replicalag_message | Custom message for RDS Aurora replica lag monitor | string | `` | no |
|
||||||
| aurora_replicalag_silenced | Groups to mute for RDS Aurora replica lag monitor | map | `<map>` | no |
|
| aurora_replicalag_silenced | Groups to mute for RDS Aurora replica lag monitor | map | `<map>` | no |
|
||||||
| aurora_replicalag_threshold_critical | Aurora replica lag in milliseconds (critical threshold) | string | `200` | no |
|
| aurora_replicalag_threshold_critical | Aurora replica lag in milliseconds (critical threshold) | string | `200` | no |
|
||||||
|
|||||||
@ -22,8 +22,8 @@ Creates DataDog monitors with the following checks:
|
|||||||
|
|
||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|:----:|:-----:|:-----:|
|
|------|-------------|:----:|:-----:|:-----:|
|
||||||
| aurora_replicalag_enabled | Flag to enable RDS CPU usage monitor | string | `true` | no |
|
| aurora_replicalag_enabled | Flag to enable RDS Aurora replica lag monitor | string | `true` | no |
|
||||||
| aurora_replicalag_extra_tags | Extra tags for RDS CPU usage monitor | list | `<list>` | no |
|
| aurora_replicalag_extra_tags | Extra tags for RDS Aurora replica lag monitor | list | `<list>` | no |
|
||||||
| aurora_replicalag_message | Custom message for RDS Aurora replica lag monitor | string | `` | no |
|
| aurora_replicalag_message | Custom message for RDS Aurora replica lag monitor | string | `` | no |
|
||||||
| aurora_replicalag_silenced | Groups to mute for RDS Aurora replica lag monitor | map | `<map>` | no |
|
| aurora_replicalag_silenced | Groups to mute for RDS Aurora replica lag monitor | map | `<map>` | no |
|
||||||
| aurora_replicalag_threshold_critical | Aurora replica lag in milliseconds (critical threshold) | string | `200` | no |
|
| aurora_replicalag_threshold_critical | Aurora replica lag in milliseconds (critical threshold) | string | `200` | no |
|
||||||
|
|||||||
@ -18,6 +18,7 @@ Creates DataDog monitors with the following checks:
|
|||||||
|
|
||||||
- RDS instance CPU high
|
- RDS instance CPU high
|
||||||
- RDS instance free space
|
- RDS instance free space
|
||||||
|
- RDS replica lag
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
@ -45,6 +46,13 @@ Creates DataDog monitors with the following checks:
|
|||||||
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
|
||||||
| message | Message sent when an alert is triggered | string | - | yes |
|
| message | Message sent when an alert is triggered | string | - | yes |
|
||||||
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
| new_host_delay | Delay in seconds before monitor new resource | string | `300` | no |
|
||||||
|
| replicalag_enabled | Flag to enable RDS replica lag monitor | string | `true` | no |
|
||||||
|
| replicalag_extra_tags | Extra tags for RDS replica lag monitor | list | `<list>` | no |
|
||||||
|
| replicalag_message | Custom message for RDS replica lag monitor | string | `` | no |
|
||||||
|
| replicalag_silenced | Groups to mute for RDS replica lag monitor | map | `<map>` | no |
|
||||||
|
| replicalag_threshold_critical | replica lag in seconds (critical threshold) | string | `300` | no |
|
||||||
|
| replicalag_threshold_warning | replica lag in seconds (warning threshold) | string | `200` | no |
|
||||||
|
| replicalag_timeframe | Monitor timeframe for RDS replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `last_5m` | no |
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
|
|
||||||
@ -52,6 +60,7 @@ Creates DataDog monitors with the following checks:
|
|||||||
|------|-------------|
|
|------|-------------|
|
||||||
| rds_cpu_90_15min_id | id for monitor rds_cpu_90_15min |
|
| rds_cpu_90_15min_id | id for monitor rds_cpu_90_15min |
|
||||||
| rds_free_space_low_id | id for monitor rds_free_space_low |
|
| rds_free_space_low_id | id for monitor rds_free_space_low |
|
||||||
|
| rds_replica_lag_id | id for monitor rds_replica_lag |
|
||||||
|
|
||||||
## Related documentation
|
## Related documentation
|
||||||
|
|
||||||
|
|||||||
@ -122,3 +122,43 @@ variable "diskspace_threshold_critical" {
|
|||||||
description = "Disk free space in percent (critical threshold)"
|
description = "Disk free space in percent (critical threshold)"
|
||||||
default = "10"
|
default = "10"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "replicalag_silenced" {
|
||||||
|
description = "Groups to mute for RDS replica lag monitor"
|
||||||
|
type = "map"
|
||||||
|
default = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "replicalag_enabled" {
|
||||||
|
description = "Flag to enable RDS replica lag monitor"
|
||||||
|
type = "string"
|
||||||
|
default = "true"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "replicalag_extra_tags" {
|
||||||
|
description = "Extra tags for RDS replica lag monitor"
|
||||||
|
type = "list"
|
||||||
|
default = []
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "replicalag_message" {
|
||||||
|
description = "Custom message for RDS replica lag monitor"
|
||||||
|
type = "string"
|
||||||
|
default = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "replicalag_timeframe" {
|
||||||
|
description = "Monitor timeframe for RDS replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]"
|
||||||
|
type = "string"
|
||||||
|
default = "last_5m"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "replicalag_threshold_warning" {
|
||||||
|
description = "replica lag in seconds (warning threshold)"
|
||||||
|
default = "200"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "replicalag_threshold_critical" {
|
||||||
|
description = "replica lag in seconds (critical threshold)"
|
||||||
|
default = "300"
|
||||||
|
}
|
||||||
|
|||||||
@ -64,3 +64,36 @@ EOF
|
|||||||
|
|
||||||
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.diskspace_extra_tags}"]
|
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.diskspace_extra_tags}"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### RDS Replica Lag monitor ###
|
||||||
|
resource "datadog_monitor" "rds_replica_lag" {
|
||||||
|
count = "${var.replicalag_enabled ? 1 : 0}"
|
||||||
|
name = "[${var.environment}] RDS replica lag {{#is_alert}}{{{comparator}}} {{threshold}} ms ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ms ({{value}}%){{/is_warning}}"
|
||||||
|
message = "${coalesce(var.replicalag_message, var.message)}"
|
||||||
|
|
||||||
|
type = "metric alert"
|
||||||
|
|
||||||
|
query = <<EOF
|
||||||
|
avg(${var.replicalag_timeframe}): (
|
||||||
|
avg:aws.rds.replica_lag${module.filter-tags.query_alert} by {region,name}
|
||||||
|
) > ${var.replicalag_threshold_critical}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
thresholds {
|
||||||
|
warning = "${var.replicalag_threshold_warning}"
|
||||||
|
critical = "${var.replicalag_threshold_critical}"
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_no_data = true
|
||||||
|
evaluation_delay = "${var.evaluation_delay}"
|
||||||
|
notify_audit = false
|
||||||
|
timeout_h = 0
|
||||||
|
include_tags = true
|
||||||
|
locked = false
|
||||||
|
require_full_window = false
|
||||||
|
new_host_delay = "${var.new_host_delay}"
|
||||||
|
|
||||||
|
silenced = "${var.replicalag_silenced}"
|
||||||
|
|
||||||
|
tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.replicalag_extra_tags}"]
|
||||||
|
}
|
||||||
|
|||||||
@ -7,3 +7,8 @@ output "rds_free_space_low_id" {
|
|||||||
description = "id for monitor rds_free_space_low"
|
description = "id for monitor rds_free_space_low"
|
||||||
value = "${datadog_monitor.rds_free_space_low.*.id}"
|
value = "${datadog_monitor.rds_free_space_low.*.id}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output "rds_replica_lag_id" {
|
||||||
|
description = "id for monitor rds_replica_lag"
|
||||||
|
value = "${datadog_monitor.rds_replica_lag.*.id}"
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user