Skip to content

Commit

Permalink
5xx error alerts (#1466)
Browse files Browse the repository at this point in the history
* added resource for 5xx alert

---------

Co-authored-by: halprin <[email protected]>
Co-authored-by: Sylvie <[email protected]>
Co-authored-by: saquino0827 <[email protected]>
  • Loading branch information
4 people authored Oct 23, 2024
1 parent eca4729 commit 3cf50c6
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions operations/template/alert.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,47 @@ resource "azurerm_monitor_metric_alert" "azure_4XX_alert" {
]
}
}

resource "azurerm_monitor_metric_alert" "azure_5XX_alert" {
count = local.non_pr_environment ? 1 : 0
name = "cdcti-${var.environment}-azure-http-5XX-alert"
resource_group_name = data.azurerm_resource_group.group.name
scopes = [azurerm_linux_web_app.api.id]
description = "Action will be triggered when Http Status Code 5XX is greater than or equal to 1"
frequency = "PT1M" // Checks every 1 min
window_size = "PT5M" // Every Check looks back 5 min for 5xx errors

criteria {
metric_namespace = "Microsoft.Web/sites"
metric_name = "Http5xx"
aggregation = "Count"
operator = "GreaterThanOrEqual"
threshold = 1
}

action {
action_group_id = azurerm_monitor_action_group.notify_slack_email[count.index].id
}

lifecycle {
# Ignore changes to tags because the CDC sets these automagically
ignore_changes = [
tags["business_steward"],
tags["center"],
tags["environment"],
tags["escid"],
tags["funding_source"],
tags["pii_data"],
tags["security_compliance"],
tags["security_steward"],
tags["support_group"],
tags["system"],
tags["technical_steward"],
tags["zone"]
]
}
}

resource "azurerm_monitor_metric_alert" "low_instance_count_alert" {
count = local.non_pr_environment ? 1 : 0
name = "cdcti-${var.environment}-azure-low-instance-count-alert"
Expand Down

0 comments on commit 3cf50c6

Please sign in to comment.