diff --git a/services/prometheus.hcl b/services/prometheus.hcl index 18f4902..203a97d 100644 --- a/services/prometheus.hcl +++ b/services/prometheus.hcl @@ -14,11 +14,27 @@ job "prometheus" { #host_network = "tailscale" static = "9090" } + port "push" { + static = "9091" + } } task "prometheus" { 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 { name = "prometheus" port = "http" @@ -54,6 +70,14 @@ scrape_configs: static_configs: - 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' scrape_interval: 5s metrics_path: /metrics @@ -144,24 +168,24 @@ groups: 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 { cpu = 1000 memory = 512 } } + + task "pushgateway" { + driver = "docker" + + config { + image = "prom/pushgateway:latest" + ports = ["push"] + } + + service { + name = "pushgateway" + port = "push" + } + } } }