-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #345 from DFE-Digital/889-monitor-node-pool-cpu-me…
…mory-pressure2 Adding Azure monitor metrics to TSC repo for node availability
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
RG_TAGS={"Product" : "Teacher services cloud"} | ||
ARM_TEMPLATE_TAG=1.1.0 | ||
SERVICE_NAME=teacher-services-cloud | ||
SERVICE_SHORT=tsc | ||
|
||
ci: | ||
$(eval AUTO_APPROVE=-auto-approve) | ||
|
@@ -173,3 +175,8 @@ import-aks-resources: get-cluster-credentials | |
.PHONY: new_service | ||
new_service: | ||
bash templates/new_service.sh | ||
|
||
action-group: set-azure-account # make production action-group [email protected] . Must be run before setting enable_monitoring=true. Use any non-prod environment to create in the test subscription. | ||
$(if $(ACTION_GROUP_EMAIL), , $(error Please specify a notification email for the action group)) | ||
az group create -l uksouth -g ${RESOURCE_PREFIX}-${SERVICE_SHORT}-mn-rg --tags "Product=${SERVICE_NAME}" | ||
az monitor action-group create -n ${RESOURCE_PREFIX}-${SERVICE_SHORT} -g ${RESOURCE_PREFIX}-${SERVICE_SHORT}-mn-rg --action email ${RESOURCE_PREFIX}-${SERVICE_SHORT}-email ${ACTION_GROUP_EMAIL} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
data "azurerm_monitor_action_group" "main" { | ||
resource_group_name = local.monitoring_resource_group | ||
name = local.monitor_action_group_name | ||
} | ||
|
||
resource "azurerm_monitor_metric_alert" "node_availability" { | ||
name = "${var.resource_prefix}-tsc-${var.environment}-nodes-capacity" | ||
resource_group_name = local.monitoring_resource_group | ||
scopes = [azurerm_kubernetes_cluster.main.id] | ||
description = "Action will be triggered when number of available nodes is less than ${local.required_available_nodes}" | ||
window_size = "PT5M" | ||
frequency = "PT1M" | ||
|
||
criteria { | ||
metric_namespace = "microsoft.containerservice/managedclusters" | ||
metric_name = "kube_node_status_condition" | ||
aggregation = "Average" | ||
operator = "GreaterThan" | ||
threshold = local.node_threshold | ||
|
||
dimension { | ||
name = "status2" # References the second status dimension available in the monitor metric | ||
operator = "Include" | ||
values = ["Ready"] | ||
} | ||
} | ||
|
||
action { | ||
action_group_id = data.azurerm_monitor_action_group.main.id | ||
} | ||
|
||
lifecycle { ignore_changes = [tags] } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters