This repository has been archived by the owner on May 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
prometheus.hcl
108 lines (84 loc) · 2.12 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
100
101
102
103
104
105
106
107
108
job "prometheus" {
datacenters = ["lux"]
type = "service"
group "monitoring" {
count = 1
network {
port "prometheus_ui" {
static = 9090
host_network = "private"
}
}
restart {
attempts = 5
interval = "30m"
delay = "15s"
mode = "fail"
}
ephemeral_disk {
size = 800
}
task "prometheus" {
template {
change_mode = "noop"
destination = "local/prometheus.yml"
data = <<EOH
---
global:
scrape_interval: 5s
evaluation_interval: 5s
scrape_configs:
- job_name: 'nomad_metrics'
consul_sd_configs:
- server: '{{ env "CONSUL_HTTP_ADDR" }}'
services: ['nomad-client', 'nomad']
relabel_configs:
- source_labels: ['__meta_consul_tags']
regex: '(.*)http(.*)'
action: keep
scrape_interval: 5s
metrics_path: /v1/metrics
params:
format: ['prometheus']
- job_name: 'consul-services'
consul_sd_configs:
- server: '{{ env "CONSUL_HTTP_ADDR" }}'
relabel_configs:
- source_labels: ['__meta_consul_tags']
regex: '(.*)metrics(.*)'
action: keep
scrape_interval: 5s
metrics_path: /metrics
params:
format: ['prometheus']
EOH
}
driver = "docker"
config {
image = "prom/prometheus:latest"
volumes = [
"local/prometheus.yml:/etc/prometheus/prometheus.yml",
]
ports = ["prometheus_ui"]
}
service {
name = "prometheus"
tags = [
"traefik.enable=true",
"traefik.http.routers.prometheus-ui.rule=PathPrefix(`/prometheus`)",
"traefik.http.routers.prometheus-ui.entrypoints=http-internal",
"traefik.http.routers.prometheus-ui.middlewares=prometheus-stripprefix",
"traefik.http.middlewares.prometheus-stripprefix.stripprefix.prefixes=/prometheus"
]
port = "prometheus_ui"
check {
name = "prometheus_ui port alive"
type = "http"
path = "/-/healthy"
interval = "10s"
timeout = "2s"
}
}
}
}
}