-
Notifications
You must be signed in to change notification settings - Fork 0
/
prometheus.hcl
99 lines (83 loc) · 2.14 KB
/
prometheus.hcl
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
job "prometheus" {
datacenters = ["dc1"]
group "prometheus" {
task "prometheus" {
driver = "docker"
config {
image = "prom/prometheus:v2.8.1"
network_mode = "host"
volumes = [
"./local/prometheus.yml:/etc/prometheus/prometheus.yml",
]
args = [
"--config.file=/etc/prometheus/prometheus.yml",
"--storage.tsdb.path=/prometheus",
"--web.listen-address=0.0.0.0:${NOMAD_PORT_http}",
"--web.console.libraries=/usr/share/prometheus/console_libraries",
"--web.console.templates=/usr/share/prometheus/consoles",
]
}
template {
data = <<EOH
alerting:
alertmanagers:
- consul_sd_configs:
- services: ['alertmanager']
rule_files:
- '/etc/prometheus/alerts.yml'
scrape_configs:
- job_name: 'services'
scrape_interval: 1s
consul_sd_configs:
- server: '127.0.0.1:8500'
services: []
relabel_configs:
- source_labels: [__meta_consul_tags]
regex: .*,metrics,.*
action: keep
- source_labels: [__meta_consul_service]
target_label: job
- job_name: 'blackbox'
scrape_interval: 1s
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- http://localhost
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: target
- target_label: __address__
{{ range service "blackbox" }}
replacement: {{ .Address }}:{{ .Port }}{{ end }}
EOH
destination = "local/prometheus.yml"
}
resources {
cpu = 2500
memory = 1024
network {
port "http" {}
}
}
service {
name = "prometheus"
port = "http"
tags = [
"traefik.enable=true",
"traefik.frontends.A.rule=Host:prometheus.localhost",
]
check {
name = "prometheus"
type = "http"
path = "/targets"
interval = "10s"
timeout = "2s"
}
}
}
}
}