open-nomad/e2e/prometheus/prometheus.nomad

87 lines
1.5 KiB
Plaintext
Raw Normal View History

2019-03-08 17:56:02 +00:00
job "prometheus" {
datacenters = ["dc1", "dc2"]
2019-10-11 12:00:05 +00:00
type = "service"
2019-03-08 17:56:02 +00:00
group "monitoring" {
count = 1
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
restart {
attempts = 2
interval = "30m"
2019-10-11 12:00:05 +00:00
delay = "15s"
mode = "fail"
2019-03-08 17:56:02 +00:00
}
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
ephemeral_disk {
size = 300
}
task "prometheus" {
template {
change_mode = "noop"
destination = "local/prometheus.yml"
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
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
}
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
driver = "docker"
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
config {
image = "prom/prometheus:latest"
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
volumes = [
2019-10-11 12:00:05 +00:00
"local/prometheus.yml:/etc/prometheus/prometheus.yml",
2019-03-08 17:56:02 +00:00
]
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
port_map {
prometheus_ui = 9090
}
}
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
resources {
network {
mbits = 10
2019-10-11 12:00:05 +00:00
port "prometheus_ui"{}
2019-03-08 17:56:02 +00:00
}
}
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
service {
name = "prometheus"
tags = ["urlprefix-/"]
port = "prometheus_ui"
2019-10-11 12:00:05 +00:00
2019-03-08 17:56:02 +00:00
check {
name = "prometheus_ui port alive"
type = "http"
path = "/-/healthy"
interval = "10s"
timeout = "2s"
}
}
}
}
}