-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprometheus.tpl
60 lines (53 loc) · 1.38 KB
/
prometheus.tpl
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
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'swarmsight'
rule_files:
- "swarm_node.rules.yml"
- "swarm_task.rules.yml"
scrape_configs:
- job_name: 'statsd-exporter'
dns_sd_configs:
- names:
- 'tasks.statsd-exporter'
type: 'A'
port: 9102
- job_name: 'dockerd-exporter'
dns_sd_configs:
- names:
- 'tasks.dockerd-exporter'
type: 'A'
port: 9323
- job_name: 'cadvisor'
dns_sd_configs:
- names:
- 'tasks.cadvisor'
type: 'A'
port: 8080
- job_name: 'node-exporter'
dns_sd_configs:
- names:
- 'tasks.node-exporter'
type: 'A'
port: 9100
{{- range .Services }}
- job_name: '{{ .Name }}'
metrics_path: '{{ .MetricsPath }}'
dockerswarm_sd_configs:
- host: unix:///var/run/docker.sock
role: tasks
filters:
- name: label
values: ['com.docker.swarm.service.name={{ .Name }}']
relabel_configs:
- source_labels: [__meta_docker_task_container_label_com_docker_swarm_service_name]
action: keep
regex: {{ .Name }}
- source_labels: [__address__]
target_label: __address__
regex: (.*):.*
replacement: $1:{{ .Port }}
- source_labels: [__meta_docker_task_container_label_com_docker_swarm_service_name]
target_label: instance
{{- end }}