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

Add window_size to postgres module #77

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aks/postgres/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ resource "azurerm_monitor_metric_alert" "memory" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_postgresql_flexible_server.main[0].id]
description = "Action will be triggered when memory use is greater than 75%"
window_size = var.alert_window_size

criteria {
metric_namespace = "Microsoft.DBforPostgreSQL/flexibleServers"
Expand Down Expand Up @@ -178,6 +179,7 @@ resource "azurerm_monitor_metric_alert" "cpu" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_postgresql_flexible_server.main[0].id]
description = "Action will be triggered when cpu use is greater than 60%"
window_size = var.alert_window_size

criteria {
metric_namespace = "Microsoft.DBforPostgreSQL/flexibleServers"
Expand Down Expand Up @@ -205,6 +207,7 @@ resource "azurerm_monitor_metric_alert" "storage" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_postgresql_flexible_server.main[0].id]
description = "Action will be triggered when storage use is greater than 75%"
window_size = var.alert_window_size

criteria {
metric_namespace = "Microsoft.DBforPostgreSQL/flexibleServers"
Expand Down
1 change: 1 addition & 0 deletions aks/postgres/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ No modules.
|------|-------------|------|---------|:--------:|
| <a name="input_admin_password"></a> [admin\_password](#input\_admin\_password) | Password of the admin user | `string` | `null` | no |
| <a name="input_admin_username"></a> [admin\_username](#input\_admin\_username) | Username of the admin user | `string` | `null` | no |
| <a name="input_alert_window_size"></a> [alert\_window\_size](#input\_alert\_window\_size) | The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H | `string` | `"PT5M"` | no |
| <a name="input_azure_cpu_threshold"></a> [azure\_cpu\_threshold](#input\_azure\_cpu\_threshold) | n/a | `number` | `60` | no |
| <a name="input_azure_enable_backup_storage"></a> [azure\_enable\_backup\_storage](#input\_azure\_enable\_backup\_storage) | n/a | `bool` | `true` | no |
| <a name="input_azure_enable_high_availability"></a> [azure\_enable\_high\_availability](#input\_azure\_enable\_high\_availability) | n/a | `bool` | `false` | no |
Expand Down
6 changes: 6 additions & 0 deletions aks/postgres/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ variable "azure_enable_monitoring" {
default = true
}

variable "alert_window_size" {
type = string
default = "PT5M"
description = "The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H"
}
johnake marked this conversation as resolved.
Show resolved Hide resolved

variable "azure_maintenance_window" {
type = object({
day_of_week = optional(number)
Expand Down
1 change: 1 addition & 0 deletions aks/redis/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ resource "azurerm_monitor_metric_alert" "memory" {
resource_group_name = data.azurerm_resource_group.main[0].name
scopes = [azurerm_redis_cache.main[0].id]
description = "Action will be triggered when memory use is greater than 60%"
window_size = var.alert_window_size

criteria {
metric_namespace = "Microsoft.Cache/redis"
Expand Down
1 change: 1 addition & 0 deletions aks/redis/tfdocs.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_alert_window_size"></a> [alert\_window\_size](#input\_alert\_window\_size) | The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H | `string` | `"PT5M"` | no |
| <a name="input_azure_capacity"></a> [azure\_capacity](#input\_azure\_capacity) | n/a | `number` | `1` | no |
| <a name="input_azure_enable_monitoring"></a> [azure\_enable\_monitoring](#input\_azure\_enable\_monitoring) | n/a | `bool` | `true` | no |
| <a name="input_azure_family"></a> [azure\_family](#input\_azure\_family) | n/a | `string` | `"C"` | no |
Expand Down
7 changes: 7 additions & 0 deletions aks/redis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,10 @@ variable "azure_patch_schedule" {
}))
default = []
}

variable "alert_window_size" {
type = string
default = "PT5M"
description = "The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H"
}

Loading