77 lines
1.5 KiB
Plaintext
77 lines
1.5 KiB
Plaintext
|
job "prometheus" {
|
||
|
datacenters = ["dc1", "dc2"]
|
||
|
type = "service"
|
||
|
|
||
|
group "monitoring" {
|
||
|
count = 1
|
||
|
restart {
|
||
|
attempts = 2
|
||
|
interval = "30m"
|
||
|
delay = "15s"
|
||
|
mode = "fail"
|
||
|
}
|
||
|
ephemeral_disk {
|
||
|
size = 300
|
||
|
}
|
||
|
|
||
|
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 "NOMAD_IP_prometheus_ui" }}:8500'
|
||
|
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']
|
||
|
EOH
|
||
|
}
|
||
|
driver = "docker"
|
||
|
config {
|
||
|
image = "prom/prometheus:latest"
|
||
|
volumes = [
|
||
|
"local/prometheus.yml:/etc/prometheus/prometheus.yml"
|
||
|
]
|
||
|
port_map {
|
||
|
prometheus_ui = 9090
|
||
|
}
|
||
|
}
|
||
|
resources {
|
||
|
network {
|
||
|
mbits = 10
|
||
|
port "prometheus_ui" {}
|
||
|
}
|
||
|
}
|
||
|
service {
|
||
|
name = "prometheus"
|
||
|
tags = ["urlprefix-/"]
|
||
|
port = "prometheus_ui"
|
||
|
check {
|
||
|
name = "prometheus_ui port alive"
|
||
|
type = "http"
|
||
|
path = "/-/healthy"
|
||
|
interval = "10s"
|
||
|
timeout = "2s"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|