Add pushgateway to prometheus
This commit is contained in:
parent
69c8322d50
commit
5169aecc6d
@ -11,12 +11,17 @@ job "prometheus" {
|
|||||||
host_network = "wesher"
|
host_network = "wesher"
|
||||||
to = 9090
|
to = 9090
|
||||||
}
|
}
|
||||||
|
|
||||||
|
port "pushgateway" {
|
||||||
|
host_network = "wesher"
|
||||||
|
static = 9091
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ephemeral_disk {
|
ephemeral_disk {
|
||||||
# migrate = true
|
migrate = true
|
||||||
# sticky = true
|
sticky = true
|
||||||
# }
|
}
|
||||||
|
|
||||||
service {
|
service {
|
||||||
name = "prometheus"
|
name = "prometheus"
|
||||||
@ -30,6 +35,12 @@ job "prometheus" {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
name = "pushgateway"
|
||||||
|
provider = "nomad"
|
||||||
|
port = "pushgateway"
|
||||||
|
}
|
||||||
|
|
||||||
task "prometheus" {
|
task "prometheus" {
|
||||||
driver = "docker"
|
driver = "docker"
|
||||||
|
|
||||||
@ -37,18 +48,12 @@ job "prometheus" {
|
|||||||
image = "prom/prometheus:v2.43.0"
|
image = "prom/prometheus:v2.43.0"
|
||||||
ports = ["web"]
|
ports = ["web"]
|
||||||
args = [
|
args = [
|
||||||
"--config.file=/etc/prometheus/config/prometheus.yml",
|
"--config.file=${NOMAD_TASK_DIR}/prometheus.yml",
|
||||||
"--storage.tsdb.path=${NOMAD_ALLOC_DIR}/data/tsdb",
|
"--storage.tsdb.path=${NOMAD_ALLOC_DIR}/data/tsdb",
|
||||||
"--web.listen-address=0.0.0.0:9090",
|
"--web.listen-address=0.0.0.0:9090",
|
||||||
"--web.console.libraries=/usr/share/prometheus/console_libraries",
|
"--web.console.libraries=/usr/share/prometheus/console_libraries",
|
||||||
"--web.console.templates=/usr/share/prometheus/consoles",
|
"--web.console.templates=/usr/share/prometheus/consoles",
|
||||||
]
|
]
|
||||||
|
|
||||||
mount {
|
|
||||||
type = "bind"
|
|
||||||
target = "/etc/prometheus/config"
|
|
||||||
source = "local/config"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template {
|
template {
|
||||||
@ -62,7 +67,13 @@ scrape_configs:
|
|||||||
- job_name: prometheus
|
- job_name: prometheus
|
||||||
static_configs:
|
static_configs:
|
||||||
- targets:
|
- targets:
|
||||||
- 0.0.0.0:9090
|
- 127.0.0.1:9090
|
||||||
|
|
||||||
|
- job_name: "pushgateway"
|
||||||
|
honor_labels: true
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- 127.0.0.1:9091
|
||||||
|
|
||||||
- job_name: "nomad_client"
|
- job_name: "nomad_client"
|
||||||
metrics_path: "/v1/metrics"
|
metrics_path: "/v1/metrics"
|
||||||
@ -101,7 +112,7 @@ scrape_configs:
|
|||||||
EOF
|
EOF
|
||||||
change_mode = "signal"
|
change_mode = "signal"
|
||||||
change_signal = "SIGHUP"
|
change_signal = "SIGHUP"
|
||||||
destination = "local/config/prometheus.yml"
|
destination = "${NOMAD_TASK_DIR}/prometheus.yml"
|
||||||
}
|
}
|
||||||
|
|
||||||
resources {
|
resources {
|
||||||
@ -109,5 +120,22 @@ scrape_configs:
|
|||||||
memory = 300
|
memory = 300
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task "pushgateway" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "prom/pushgateway"
|
||||||
|
ports = ["pushgateway"]
|
||||||
|
args = [
|
||||||
|
"--persistence.file=${NOMAD_ALLOC_DIR}/pushgateway-persistence",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 50
|
||||||
|
memory = 50
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user