forked from claranet/terraform-aws-aurora
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alarms.tf
99 lines (90 loc) · 3.86 KB
/
alarms.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
91
92
93
94
95
96
97
98
99
resource "aws_cloudwatch_metric_alarm" "alarm_rds_DatabaseConnections_writer" {
count = "${var.cw_alarms ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-writer-DatabaseConnections"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "DatabaseConnections"
namespace = "AWS/RDS"
period = "60"
statistic = "Sum"
threshold = "${var.cw_max_conns}"
alarm_description = "RDS Maximum connection Alarm for ${aws_rds_cluster.default.id} writer"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
Role = "WRITER"
}
}
resource "aws_cloudwatch_metric_alarm" "alarm_rds_DatabaseConnections_reader" {
count = "${var.cw_alarms && var.replica_count > 0 ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-reader-DatabaseConnections"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "DatabaseConnections"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_conns}"
alarm_description = "RDS Maximum connection Alarm for ${aws_rds_cluster.default.id} reader(s)"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
Role = "READER"
}
}
resource "aws_cloudwatch_metric_alarm" "alarm_rds_CPU_writer" {
count = "${var.cw_alarms ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-writer-CPU"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_cpu}"
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default.id} writer"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
Role = "WRITER"
}
}
resource "aws_cloudwatch_metric_alarm" "alarm_rds_CPU_reader" {
count = "${var.cw_alarms && var.replica_count > 0 ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-reader-CPU"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_cpu}"
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default.id} reader(s)"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
Role = "READER"
}
}
resource "aws_cloudwatch_metric_alarm" "alarm_rds_replica_lag" {
count = "${var.cw_alarms && var.replica_count > 0 ? 1 : 0}"
alarm_name = "${aws_rds_cluster.default.id}-alarm-rds-reader-AuroraReplicaLag"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "5"
metric_name = "AuroraReplicaLag"
namespace = "AWS/RDS"
period = "60"
statistic = "Maximum"
threshold = "${var.cw_max_replica_lag}"
alarm_description = "RDS CPU Alarm for ${aws_rds_cluster.default.id}"
alarm_actions = ["${var.cw_sns_topic}"]
ok_actions = ["${var.cw_sns_topic}"]
dimensions {
DBClusterIdentifier = "${aws_rds_cluster.default.id}"
Role = "READER"
}
}