-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetrics.tf
More file actions
91 lines (86 loc) · 2.56 KB
/
metrics.tf
File metadata and controls
91 lines (86 loc) · 2.56 KB
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
locals {
dims = tomap({
"LoadBalancer" = aws_lb.this.arn_suffix
"TargetGroup" = aws_lb_target_group.this.arn_suffix
})
metric_name_prefix = "load-balancer/${random_string.resource_suffix.result}"
metrics = [
{
name = "${local.metric_name_prefix}/hosts"
type = "generic"
unit = "count"
mappings = {
hosts_healthy = {
account_id = local.account_id
stat = "Average"
namespace = "AWS/ApplicationELB"
metric_name = "HealthyHostCount"
dimensions = local.dims
}
hosts_unhealthy = {
account_id = local.account_id
stat = "Average"
namespace = "AWS/ApplicationELB"
metric_name = "UnHealthyHostCount"
dimensions = local.dims
}
}
},
{
name = "${local.metric_name_prefix}/requests"
type = "generic"
unit = "count"
mappings = {
requests_total = {
account_id = local.account_id
stat = "Sum"
namespace = "AWS/ApplicationELB"
metric_name = "RequestCount"
dimensions = local.dims
}
requests_5xx = {
account_id = local.account_id
stat = "Sum"
namespace = "AWS/ApplicationELB"
metric_name = "HTTPCode_Target_5XX_Count"
dimensions = local.dims
}
requests_4xx = {
account_id = local.account_id
stat = "Sum"
namespace = "AWS/ApplicationELB"
metric_name = "HTTPCode_Target_4XX_Count"
dimensions = local.dims
}
}
},
{
name = "${local.metric_name_prefix}/response"
type = "duration"
unit = "seconds"
mappings = {
response_average = {
account_id = local.account_id
stat = "Average"
namespace = "AWS/ApplicationELB"
metric_name = "TargetResponseTime"
dimensions = local.dims
}
response_min = {
account_id = local.account_id
stat = "Minimum"
namespace = "AWS/ApplicationELB"
metric_name = "TargetResponseTime"
dimensions = local.dims
}
response_max = {
account_id = local.account_id
stat = "Maximum"
namespace = "AWS/ApplicationELB"
metric_name = "TargetResponseTime"
dimensions = local.dims
}
}
}
]
}