Prometheus pushgateway config.

This commit is contained in:
2023-09-03 17:27:24 +01:00
parent 25a21cb6c3
commit 093d3a3e74

View File

@@ -14,11 +14,27 @@ job "prometheus" {
#host_network = "tailscale" #host_network = "tailscale"
static = "9090" static = "9090"
} }
port "push" {
static = "9091"
}
} }
task "prometheus" { task "prometheus" {
driver = "docker" driver = "docker"
config {
image = "prom/prometheus:v2.44.0"
network_mode = "host"
args = ["--storage.tsdb.path", "/opt/prometheus", "--web.listen-address", "0.0.0.0:9090", "--storage.tsdb.retention.time", "900d"]
force_pull = true
ports = ["http"]
volumes = [
"local/alerts.yml:/prometheus/alerts.yml",
"local/prometheus.yml:/prometheus/prometheus.yml",
"/data/compute/appdata/prometheus:/opt/prometheus",
]
}
service { service {
name = "prometheus" name = "prometheus"
port = "http" port = "http"
@@ -54,6 +70,14 @@ scrape_configs:
static_configs: static_configs:
- targets: ['localhost:9090'] - targets: ['localhost:9090']
- job_name: 'pushgateway'
scrape_interval: 5s
honor_labels: true
consul_sd_configs:
- server: '{{ env "NOMAD_IP_http" }}:8500'
services: ['pushgateway']
scheme: http
- job_name: 'metrics' - job_name: 'metrics'
scrape_interval: 5s scrape_interval: 5s
metrics_path: /metrics metrics_path: /metrics
@@ -144,24 +168,24 @@ groups:
EOH EOH
} }
config {
image = "prom/prometheus:v2.44.0"
network_mode = "host"
args = ["--storage.tsdb.path", "/opt/prometheus", "--web.listen-address", "0.0.0.0:9090", "--storage.tsdb.retention.time", "900d"]
force_pull = true
ports = ["http"]
volumes = [
"local/alerts.yml:/prometheus/alerts.yml",
"local/prometheus.yml:/prometheus/prometheus.yml",
"/data/compute/appdata/prometheus:/opt/prometheus",
]
}
resources { resources {
cpu = 1000 cpu = 1000
memory = 512 memory = 512
} }
} }
task "pushgateway" {
driver = "docker"
config {
image = "prom/pushgateway:latest"
ports = ["push"]
}
service {
name = "pushgateway"
port = "push"
}
}
} }
} }