Skip to content

Commit 7aa1357

Browse files
PRMT-466- updates
1 parent 7970f0f commit 7aa1357

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

infrastructure/sqs_alarms.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ locals {
1818
[6, "medium"],
1919
[10, "high"]
2020
]
21+
22+
# default_alarm_threshold_seconds = 6 #6 * 24 * 60 * 60 # 6 days
2123
# using a list instead of map
2224

2325
flat_list = flatten([
@@ -78,6 +80,7 @@ module "global_sqs_age_alarm_topic" {
7880

7981
resource "aws_cloudwatch_metric_alarm" "sqs_oldest_message" {
8082
count = local.is_test_sandbox ? 0 : length(local.monitored_queue_day_list) # TODO:change is_test_sandbox to is_sandbox
83+
# alarm_name = "${terraform.workspace}_${local.monitored_queue_day_list[count.index][0]}_oldest_message_alarm"
8184

8285
alarm_name = "${terraform.workspace}_${local.monitored_queue_day_list[count.index][0]}_oldest_message_alarm_${local.monitored_queue_day_list[count.index][2]}d"
8386
comparison_operator = "GreaterThanThreshold"
@@ -88,27 +91,33 @@ resource "aws_cloudwatch_metric_alarm" "sqs_oldest_message" {
8891
statistic = "Maximum"
8992
# threshold = each.value.days # TODO: change to each.value.days*24*60*60
9093
threshold = local.monitored_queue_day_list[count.index][2] # TODO: change to each.value.days*24*60*60
94+
# threshold = local.default_alarm_threshold_seconds
9195
treat_missing_data = "notBreaching"
9296

9397
dimensions = {
9498
# QueueName = each.value.queue_name
9599
QueueName = local.monitored_queue_day_list[count.index][1]
100+
# QueueName = each.value
96101
}
97102

98103
# alarm_description = "Alarm when a message in queue '${each.value.queue_name}' is older than '${each.value.days}' days."
99104
alarm_description = "Alarm when a message in queue '${local.monitored_queue_day_list[count.index][1]}' is older than '${local.monitored_queue_day_list[count.index][2]}' days."
105+
100106
# alarm_actions = [module.global_sqs_age_alarm_topic[0].arn]
101107
alarm_actions = [module.sqs_alarm_lambda_topic.arn]
102108

103109
tags = {
104110
# Name = "${terraform.workspace}_${each.value.queue_key}_oldest_message_alarm_${each.value.days}d"
105111
Name = "${terraform.workspace}_${local.monitored_queue_day_list[count.index][0]}_oldest_message_alarm_${local.monitored_queue_day_list[count.index][2]}d"
112+
# Name = "${terraform.workspace}_${local.monitored_queue_day_list[count.index][0]}_oldest_message_alarm"
106113
Owner = var.owner
107114
Environment = var.environment
108115
Workspace = terraform.workspace
109116
severity = local.monitored_queue_day_list[count.index][3]
110117
alarm_group = local.monitored_queue_day_list[count.index][1]
118+
# alarm_group =each.value
111119
alarm_metric = "Has messages older than ${local.monitored_queue_day_list[count.index][2]} days"
120+
# alarm_metric = "ApproximateAgeOfOldestMessage"
112121
is_kpi = "true"
113122
}
114123
}

0 commit comments

Comments
 (0)