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

CME-251: Database monitoring and alerting on RD repositories #1714

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SammiChong
Copy link

Jira link

https://tools.hmcts.net/jira/browse/CME-251

Change description

Testing done

Checklist

  • [ x] commit messages are meaningful and follow good commit message guidelines
  • [ x] README and other documentation has been updated / added (if needed)
  • [ x] tests have been updated / new tests has been added (if needed)
  • [ x] Does this PR introduce a breaking change

@hmcts-jenkins-j-to-z
Copy link
Contributor

Plan Result (aat)

Plan: 5 to add, 0 to change, 0 to destroy.
  • Create
    • azurerm_resource_group.rg
    • module.db-professional-ref-data-v16.azurerm_monitor_action_group.db-alerts-action-group[0]
    • module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_cpu[0]
    • module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_memory[0]
    • module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_storage_utilization[0]
Change Result (Click me)
  # azurerm_resource_group.rg will be created
  + resource "azurerm_resource_group" "rg" {
      + id       = (known after apply)
      + location = "uksouth"
      + name     = "rd-professional-api-aat"
      + tags     = (known after apply)
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_action_group.db-alerts-action-group[0] will be created
  + resource "azurerm_monitor_action_group" "db-alerts-action-group" {
      + enabled             = true
      + id                  = (known after apply)
      + location            = "global"
      + name                = "action_group-rd-professional-api-postgres-db-v16-aat"
      + resource_group_name = "rd-professional-api-postgres-db-v16-data-aat"
      + short_name          = "action_group"
      + tags                = {
          + "application"         = "reference-data"
          + "autoShutdown"        = "true"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "staging"
          + "managedBy"           = "Reference Data"
        }

      + email_receiver {
          + email_address           = (sensitive value)
          + name                    = "Email Receiver"
          + use_common_alert_schema = true
        }
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_cpu[0] will be created
  + resource "azurerm_monitor_metric_alert" "db_alert_cpu" {
      + auto_mitigate            = true
      + description              = "Whenever the cpu utilization is greater than 80%"
      + enabled                  = true
      + frequency                = "PT5M"
      + id                       = (known after apply)
      + name                     = "db_cpu_percent_rd-professional-api-postgres-db-v16-aat"
      + resource_group_name      = "rd-professional-api-postgres-db-v16-data-aat"
      + scopes                   = [
          + "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/rd-professional-api-postgres-db-v16-data-aat/providers/Microsoft.DBforPostgreSQL/flexibleServers/rd-professional-api-postgres-db-v16-aat",
        ]
      + severity                 = 1
      + tags                     = {
          + "application"         = "reference-data"
          + "autoShutdown"        = "true"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "staging"
          + "managedBy"           = "Reference Data"
        }
      + target_resource_location = (known after apply)
      + target_resource_type     = (known after apply)
      + window_size              = "PT15M"

      + action {
          + action_group_id = (known after apply)
        }

      + criteria {
          + aggregation            = "Average"
          + metric_name            = "cpu_percent"
          + metric_namespace       = "Microsoft.DBforPostgreSQL/flexibleServers"
          + operator               = "GreaterThanOrEqual"
          + skip_metric_validation = false
          + threshold              = 80
        }
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_memory[0] will be created
  + resource "azurerm_monitor_metric_alert" "db_alert_memory" {
      + auto_mitigate            = true
      + description              = "Whenever the memory utilization is greater than 80%"
      + enabled                  = true
      + frequency                = "PT5M"
      + id                       = (known after apply)
      + name                     = "db_memory_percent_rd-professional-api-postgres-db-v16-aat"
      + resource_group_name      = "rd-professional-api-postgres-db-v16-data-aat"
      + scopes                   = [
          + "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/rd-professional-api-postgres-db-v16-data-aat/providers/Microsoft.DBforPostgreSQL/flexibleServers/rd-professional-api-postgres-db-v16-aat",
        ]
      + severity                 = 1
      + tags                     = {
          + "application"         = "reference-data"
          + "autoShutdown"        = "true"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "staging"
          + "managedBy"           = "Reference Data"
        }
      + target_resource_location = (known after apply)
      + target_resource_type     = (known after apply)
      + window_size              = "PT15M"

      + action {
          + action_group_id = (known after apply)
        }

      + criteria {
          + aggregation            = "Average"
          + metric_name            = "memory_percent"
          + metric_namespace       = "Microsoft.DBforPostgreSQL/flexibleServers"
          + operator               = "GreaterThanOrEqual"
          + skip_metric_validation = false
          + threshold              = 80
        }
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_storage_utilization[0] will be created
  + resource "azurerm_monitor_metric_alert" "db_alert_storage_utilization" {
      + auto_mitigate            = true
      + description              = "Whenever the storage utilization is greater than 80%"
      + enabled                  = true
      + frequency                = "PT5M"
      + id                       = (known after apply)
      + name                     = "db_storage_utilization_rd-professional-api-postgres-db-v16-aat"
      + resource_group_name      = "rd-professional-api-postgres-db-v16-data-aat"
      + scopes                   = [
          + "/subscriptions/1c4f0704-a29e-403d-b719-b90c34ef14c9/resourceGroups/rd-professional-api-postgres-db-v16-data-aat/providers/Microsoft.DBforPostgreSQL/flexibleServers/rd-professional-api-postgres-db-v16-aat",
        ]
      + severity                 = 1
      + tags                     = {
          + "application"         = "reference-data"
          + "autoShutdown"        = "true"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "staging"
          + "managedBy"           = "Reference Data"
        }
      + target_resource_location = (known after apply)
      + target_resource_type     = (known after apply)
      + window_size              = "PT15M"

      + action {
          + action_group_id = (known after apply)
        }

      + criteria {
          + aggregation            = "Average"
          + metric_name            = "storage_percent"
          + metric_namespace       = "Microsoft.DBforPostgreSQL/flexibleServers"
          + operator               = "GreaterThanOrEqual"
          + skip_metric_validation = false
          + threshold              = 80
        }
    }

Plan: 5 to add, 0 to change, 0 to destroy.

@hmcts-jenkins-j-to-z
Copy link
Contributor

Plan Result (prod)

Plan: 4 to add, 1 to change, 0 to destroy.
  • Create
    • module.db-professional-ref-data-v16.azurerm_monitor_action_group.db-alerts-action-group[0]
    • module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_cpu[0]
    • module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_memory[0]
    • module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_storage_utilization[0]
  • Update
    • azurerm_resource_group.rg
Change Result (Click me)
  # azurerm_resource_group.rg will be updated in-place
  ~ resource "azurerm_resource_group" "rg" {
        id         = "/subscriptions/8999dec3-0104-4a27-94ee-6588559729d1/resourceGroups/rd-professional-api-prod"
        name       = "rd-professional-api-prod"
      ~ tags       = {
          - "Deployment Environment" = "prod"
          - "Team Name"              = "RD"
          - "lastUpdated"            = "2024-11-29T16:29:42Z"
        } -> (known after apply)
        # (2 unchanged attributes hidden)
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_action_group.db-alerts-action-group[0] will be created
  + resource "azurerm_monitor_action_group" "db-alerts-action-group" {
      + enabled             = true
      + id                  = (known after apply)
      + location            = "global"
      + name                = "action_group-rd-professional-api-postgres-db-v16-prod"
      + resource_group_name = "rd-professional-api-postgres-db-v16-data-prod"
      + short_name          = "action_group"
      + tags                = {
          + "application"         = "reference-data"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "production"
          + "managedBy"           = "Reference Data"
        }

      + email_receiver {
          + email_address           = (sensitive value)
          + name                    = "Email Receiver"
          + use_common_alert_schema = true
        }
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_cpu[0] will be created
  + resource "azurerm_monitor_metric_alert" "db_alert_cpu" {
      + auto_mitigate            = true
      + description              = "Whenever the cpu utilization is greater than 80%"
      + enabled                  = true
      + frequency                = "PT5M"
      + id                       = (known after apply)
      + name                     = "db_cpu_percent_rd-professional-api-postgres-db-v16-prod"
      + resource_group_name      = "rd-professional-api-postgres-db-v16-data-prod"
      + scopes                   = [
          + "/subscriptions/8999dec3-0104-4a27-94ee-6588559729d1/resourceGroups/rd-professional-api-postgres-db-v16-data-prod/providers/Microsoft.DBforPostgreSQL/flexibleServers/rd-professional-api-postgres-db-v16-prod",
        ]
      + severity                 = 1
      + tags                     = {
          + "application"         = "reference-data"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "production"
          + "managedBy"           = "Reference Data"
        }
      + target_resource_location = (known after apply)
      + target_resource_type     = (known after apply)
      + window_size              = "PT15M"

      + action {
          + action_group_id = (known after apply)
        }

      + criteria {
          + aggregation            = "Average"
          + metric_name            = "cpu_percent"
          + metric_namespace       = "Microsoft.DBforPostgreSQL/flexibleServers"
          + operator               = "GreaterThanOrEqual"
          + skip_metric_validation = false
          + threshold              = 80
        }
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_memory[0] will be created
  + resource "azurerm_monitor_metric_alert" "db_alert_memory" {
      + auto_mitigate            = true
      + description              = "Whenever the memory utilization is greater than 80%"
      + enabled                  = true
      + frequency                = "PT5M"
      + id                       = (known after apply)
      + name                     = "db_memory_percent_rd-professional-api-postgres-db-v16-prod"
      + resource_group_name      = "rd-professional-api-postgres-db-v16-data-prod"
      + scopes                   = [
          + "/subscriptions/8999dec3-0104-4a27-94ee-6588559729d1/resourceGroups/rd-professional-api-postgres-db-v16-data-prod/providers/Microsoft.DBforPostgreSQL/flexibleServers/rd-professional-api-postgres-db-v16-prod",
        ]
      + severity                 = 1
      + tags                     = {
          + "application"         = "reference-data"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "production"
          + "managedBy"           = "Reference Data"
        }
      + target_resource_location = (known after apply)
      + target_resource_type     = (known after apply)
      + window_size              = "PT15M"

      + action {
          + action_group_id = (known after apply)
        }

      + criteria {
          + aggregation            = "Average"
          + metric_name            = "memory_percent"
          + metric_namespace       = "Microsoft.DBforPostgreSQL/flexibleServers"
          + operator               = "GreaterThanOrEqual"
          + skip_metric_validation = false
          + threshold              = 80
        }
    }

  # module.db-professional-ref-data-v16.azurerm_monitor_metric_alert.db_alert_storage_utilization[0] will be created
  + resource "azurerm_monitor_metric_alert" "db_alert_storage_utilization" {
      + auto_mitigate            = true
      + description              = "Whenever the storage utilization is greater than 80%"
      + enabled                  = true
      + frequency                = "PT5M"
      + id                       = (known after apply)
      + name                     = "db_storage_utilization_rd-professional-api-postgres-db-v16-prod"
      + resource_group_name      = "rd-professional-api-postgres-db-v16-data-prod"
      + scopes                   = [
          + "/subscriptions/8999dec3-0104-4a27-94ee-6588559729d1/resourceGroups/rd-professional-api-postgres-db-v16-data-prod/providers/Microsoft.DBforPostgreSQL/flexibleServers/rd-professional-api-postgres-db-v16-prod",
        ]
      + severity                 = 1
      + tags                     = {
          + "application"         = "reference-data"
          + "builtFrom"           = "https://github.com/HMCTS/rd-professional-api.git"
          + "businessArea"        = "CFT"
          + "contactSlackChannel" = "#ref-data-support"
          + "environment"         = "production"
          + "managedBy"           = "Reference Data"
        }
      + target_resource_location = (known after apply)
      + target_resource_type     = (known after apply)
      + window_size              = "PT15M"

      + action {
          + action_group_id = (known after apply)
        }

      + criteria {
          + aggregation            = "Average"
          + metric_name            = "storage_percent"
          + metric_namespace       = "Microsoft.DBforPostgreSQL/flexibleServers"
          + operator               = "GreaterThanOrEqual"
          + skip_metric_validation = false
          + threshold              = 80
        }
    }

Plan: 4 to add, 1 to change, 0 to destroy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants