Skip to content

Commit d79d002

Browse files
unique cloudwatch alarms naming (#48)
1 parent 5c11222 commit d79d002

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Opensearch
2-
31
## Requirements
42

53
| Name | Version |
@@ -17,7 +15,7 @@
1715

1816
| Name | Source | Version |
1917
|------|--------|---------|
20-
| <a name="module_cloudwatch_alarms"></a> [cloudwatch\_alarms](#module\_cloudwatch\_alarms) | terraform-aws-modules/cloudwatch/aws//wrappers/metric-alarm | ~> 4.5.0 |
18+
| <a name="module_cloudwatch_alarms"></a> [cloudwatch\_alarms](#module\_cloudwatch\_alarms) | terraform-aws-modules/cloudwatch/aws//wrappers/metric-alarm | ~> 5.4.0 |
2119

2220
## Resources
2321

alarms.tf

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ locals {
44
default_alarms = {
55
# cluster status
66
cluster_status_red = {
7-
alarm_name = "cluster_status_red"
7+
alarm_name = "${aws_opensearch_domain.this.domain_name}_cluster_status_red"
88
alarm_description = "${aws_opensearch_domain.this.domain_name} has entered redstatus. One or more primary shard and its replicaes are not allocated to a node"
99

1010
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -24,7 +24,7 @@ locals {
2424
}
2525

2626
cluster_status_yellow = {
27-
alarm_name = "cluster_status_yellow"
27+
alarm_name = "${aws_opensearch_domain.this.domain_name}_cluster_status_yellow"
2828
alarm_description = "${aws_opensearch_domain.this.domain_name} has entered yellow status. One or more indexes do not have a replica shard. "
2929

3030
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -44,7 +44,7 @@ locals {
4444
}
4545

4646
cluster_writes_blocked = {
47-
alarm_name = "cluster_writes_blocked"
47+
alarm_name = "${aws_opensearch_domain.this.domain_name}_cluster_writes_blocked"
4848
alarm_description = "${aws_opensearch_domain.this.domain_name} is blocking write requests"
4949

5050
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -85,7 +85,7 @@ locals {
8585

8686
# cpu utilization
8787
data_high_cpu_utilization = {
88-
alarm_name = "data_high_cpu_util"
88+
alarm_name = "${aws_opensearch_domain.this.domain_name}_data_high_cpu_util"
8989
alarm_description = "high cpu utilization on aos data nodes"
9090

9191
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -106,7 +106,7 @@ locals {
106106
}
107107

108108
master_high_cpu_utilization = {
109-
alarm_name = "master_high_cpu_util"
109+
alarm_name = "${aws_opensearch_domain.this.domain_name}_master_high_cpu_util"
110110
alarm_description = "high cpu utilization on aos master nodes"
111111

112112
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -128,7 +128,7 @@ locals {
128128

129129
warm_high_cpu_utilization = {
130130
create = var.warm_instance_count != null
131-
alarm_name = "warm_high_cpu_util"
131+
alarm_name = "${aws_opensearch_domain.this.domain_name}_warm_high_cpu_util"
132132
alarm_description = "high cpu utilization on aos warm nodes"
133133

134134
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -151,7 +151,7 @@ locals {
151151

152152
# jvm pressure
153153
data_high_jvm_pressure = {
154-
alarm_name = "data_high_jvm_pressure"
154+
alarm_name = "${aws_opensearch_domain.this.domain_name}_data_high_jvm_pressure"
155155
alarm_description = "high jvm_pressure on aos data nodes"
156156

157157
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -172,7 +172,7 @@ locals {
172172
}
173173

174174
data_high_oldjvm_pressure = {
175-
alarm_name = "data_high_oldgenjvm_pressure"
175+
alarm_name = "${aws_opensearch_domain.this.domain_name}_data_high_oldgenjvm_pressure"
176176
alarm_description = "high old gen jvm pressure on aos warm nodes"
177177

178178
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -193,7 +193,7 @@ locals {
193193
}
194194

195195
master_high_jvm_pressure = {
196-
alarm_name = "master_high_jvm_pressure"
196+
alarm_name = "${aws_opensearch_domain.this.domain_name}_master_high_jvm_pressure"
197197
alarm_description = "high jvm_pressure on aos master nodes"
198198

199199
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -214,7 +214,7 @@ locals {
214214
}
215215

216216
master_high_oldjvm_pressure = {
217-
alarm_name = "master_high_oldgenjvm_pressure"
217+
alarm_name = "${aws_opensearch_domain.this.domain_name}_master_high_oldgenjvm_pressure"
218218
alarm_description = "high old gen jvm pressure on aos master nodes"
219219

220220
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -237,7 +237,8 @@ locals {
237237

238238
# kms
239239
aos_key_error = {
240-
alarm_name = "aos_key_error"
240+
create = var.encrypt_kms_key_id != null
241+
alarm_name = "${aws_opensearch_domain.this.domain_name}_aos_key_error"
241242
alarm_description = "the AWS KMS encryption key that is used to encrypt data at rest in your domain is disabled"
242243

243244
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -258,7 +259,8 @@ locals {
258259
}
259260

260261
aos_key_inaccessible = {
261-
alarm_name = "aos_key_inaccessible"
262+
create = var.encrypt_kms_key_id != null
263+
alarm_name = "${aws_opensearch_domain.this.domain_name}_aos_key_inaccessible"
262264
alarm_description = "the AWS KMS encryption key that is used to encrypt data at rest in your domain has been deleted or has revoked its grants to OpenSearch Service"
263265

264266
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -280,7 +282,7 @@ locals {
280282

281283
# 5xx errors
282284
server_errors = {
283-
alarm_name = "server_errors"
285+
alarm_name = "${aws_opensearch_domain.this.domain_name}_server_errors"
284286
alarm_description = "One or more data nodes might be overloaded, or requests are failing to complete within the idle timeout period"
285287

286288
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -301,7 +303,7 @@ locals {
301303

302304
# threadpool
303305
threadpool_high_write_avg = {
304-
alarm_name = "high_threadpool_write_queue_avg"
306+
alarm_name = "${aws_opensearch_domain.this.domain_name}_high_threadpool_write_queue_avg"
305307
alarm_description = "the cluster is experiencing high indexing concurrency"
306308

307309
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -321,7 +323,7 @@ locals {
321323
}
322324

323325
threadpool_high_search_avg = {
324-
alarm_name = "high_threadpool_search_avg"
326+
alarm_name = "${aws_opensearch_domain.this.domain_name}_high_threadpool_search_avg"
325327
alarm_description = " The cluster is experiencing high search concurrency. Consider scaling your cluster. You can also increase the search queue size, but increasing it excessively can cause out of memory errors."
326328

327329
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -341,7 +343,7 @@ locals {
341343
}
342344

343345
threadpool_high_search_max = {
344-
alarm_name = "high_threadpool_search_max"
346+
alarm_name = "${aws_opensearch_domain.this.domain_name}_high_threadpool_search_max"
345347
alarm_description = " The cluster is experiencing high search concurrency. Consider scaling your cluster. You can also increase the search queue size, but increasing it excessively can cause out of memory errors."
346348

347349
comparison_operator = "GreaterThanOrEqualToThreshold"
@@ -366,7 +368,7 @@ locals {
366368

367369
module "cloudwatch_alarms" {
368370
source = "terraform-aws-modules/cloudwatch/aws//wrappers/metric-alarm"
369-
version = "~> 4.5.0"
371+
version = "~> 5.4.0"
370372

371373
items = local.alarms
372374
}

0 commit comments

Comments
 (0)