Skip to content

Add service health alerting #126

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

Merged
merged 5 commits into from
Feb 10, 2024
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
34 changes: 34 additions & 0 deletions code/infra/alerts.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
resource "azurerm_monitor_activity_log_alert" "monitor_activity_log_alert_service_health" {
name = "${local.prefix}-alert-servicehealth"
resource_group_name = azurerm_resource_group.logging_rg.name
tags = var.tags

enabled = true
description = "Alerts about service health and maintenance events."
scopes = [
data.azurerm_subscription.current.id
]
action {
action_group_id = azurerm_monitor_action_group.monitor_action_group.id
webhook_properties = {
"alert-type" = "service-health",
"location" = var.location
"environment" = var.environment
"subscription" = data.azurerm_client_config.current.subscription_id
"severity" = "Info"
}
}
criteria {
category = "ServiceHealth"
service_health {
events = [
"Incident",
"Maintenance"
]
locations = [
"Global",
data.azurerm_location.current.display_name
]
}
}
}
6 changes: 6 additions & 0 deletions code/infra/data.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
data "azurerm_client_config" "current" {}

data "azurerm_subscription" "current" {}

data "azurerm_location" "current" {
location = var.location
}

data "azurerm_virtual_network" "virtual_network" {
name = local.virtual_network.name
resource_group_name = local.virtual_network.resource_group_name
Expand Down