-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalerts.tf
90 lines (76 loc) · 3.74 KB
/
alerts.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
resource "azurerm_monitor_metric_alert" "blob-alert" {
count = local.is_migration_environment ? 1 : 0
name = "blob-alert"
resource_group_name = azurerm_resource_group.darts_migration_resource_group[0].name
scopes = ["/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-migration-prod-rg/providers/Microsoft.Storage/storageAccounts/saproddartsmig02"]
description = "Alert triggered when blob ingress drops below a threshold for 30 minutes"
enabled = true
criteria {
metric_namespace = "Microsoft.Storage/storageAccounts"
metric_name = "Ingress"
aggregation = "Total"
operator = "LessThan"
threshold = 3221225472
}
action {
action_group_id = azurerm_monitor_action_group.blob-action-group[0].id
}
tags = var.common_tags
}
resource "azurerm_monitor_action_group" "blob-action-group" {
count = local.is_migration_environment ? 1 : 0
name = "blob-ingress-action-group"
resource_group_name = azurerm_resource_group.darts_migration_resource_group[0].name
short_name = "alert-group"
location = "global"
email_receiver {
name = "Sean Bulley"
email_address = "sean.bulley@hmcts.net"
use_common_alert_schema = true
}
email_receiver {
name = "Scott Robertson"
email_address = "scott.robertson@hmcts.net"
use_common_alert_schema = true
}
tags = var.common_tags
}
# resource "azurerm_monitor_metric_alert" "partition_capacity_alert" {
# count = local.is_production_environment ? 1 : 0
# name = "partition-capacity-alert"
# resource_group_name = azurerm_resource_group.darts_migration_resource_group[0].name
# scopes = ["/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-migration-prod-rg/providers/Microsoft.Compute/virtualMachines/prddartsmig01","/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/DARTS-MIGRATION-PROD-RG/providers/Microsoft.Compute/virtualMachines/prddartsmig02", "/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-migration-prod-rg/providers/Microsoft.Compute/virtualMachines/prddartsmig03", "/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-migration-prod-rg/providers/Microsoft.Compute/virtualMachines/prddartsmig04", "/subscriptions/5ca62022-6aa2-4cee-aaa7-e7536c8d566c/resourceGroups/darts-migration-prod-rg/providers/Microsoft.Compute/virtualMachines/prddartsmig05"]
# description = "Alert triggered when a partition on the Windows VM reaches 80% capacity"
# enabled = true
# criteria {
# metric_namespace = "Microsoft.Compute/virtualMachines"
# metric_name = "Available Memory Bytes"
# aggregation = "Average"
# operator = "LessThanOrEqual"
# threshold = 107374182400
# dimension {
# name = "ResourceId"
# operator = "Include"
# values = ["<vm-id>"]
# }
# }
# action {
# action_group_id = azurerm_monitor_action_group.partition-capacity.id
# }
# tags = var.common_tags
# }
# resource "azurerm_monitor_action_group" "partition-capacity" {
# name = "partition-space-group"
# resource_group_name = azurerm_resource_group.darts_migration_resource_group[0].name
# short_name = "capacity"
# email_receiver {
# name = "email1"
# email_address = "scott.robertson@hmcts.net"
# use_common_alert_schema = true
# }
# email_receiver {
# name = "Sean Bulley"
# email_address = "sean.bulley@hmcts.net"
# use_common_alert_schema = true
# }
# }