-
Notifications
You must be signed in to change notification settings - Fork 0
/
cadvisor_node_exporter.tf
90 lines (83 loc) · 1.94 KB
/
cadvisor_node_exporter.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 "aws_ecs_task_definition" "cadvisor_node_exporter" {
family = "monitoring_cadvisor_node_exporter"
container_definitions = jsonencode([
{
name = "cadvisor"
image = var.cadvisor_docker_image
cpu = 0
memory = 300
essential = true
portMappings = [
{
hostPort = 8080,
protocol = "tcp",
containerPort = 8080
}
]
mountPoints = [
{
readOnly = true
containerPath = "/rootfs",
sourceVolume = "root"
},
{
readOnly = false
containerPath = "/var/run",
sourceVolume = "var_run"
},
{
readOnly = true
containerPath = "/sys",
sourceVolume = "sys"
},
{
readOnly = true
containerPath = "/var/lib/docker",
sourceVolume = "var_lib_docker"
}
],
dockerLabels = {
"PROMETHEUS_EXPORTER_PORT" : "8080"
}
},
{
name = var.node_exporter_docker_image
image = "prom/node-exporter"
cpu = 0
memory = 300
essential = true
portMappings = [
{
hostPort = 9100,
protocol = "tcp",
containerPort = 9100
}
],
dockerLabels = {
"PROMETHEUS_EXPORTER_PORT" : "9100"
}
}
])
volume {
name = "root"
host_path = "/"
}
volume {
name = "var_run"
host_path = "/var/run"
}
volume {
name = "sys"
host_path = "/sys"
}
volume {
name = "var_lib_docker"
host_path = "/var/lib/docker/"
}
}
resource "aws_ecs_service" "cadvisor_node_exporter" {
name = "cadvisor_node_exporter"
cluster = var.ecs_cluster_id
task_definition = aws_ecs_task_definition.cadvisor_node_exporter.arn
scheduling_strategy = "DAEMON"
}