From e5ea7207530b1eb15de8ce7fb2d57c291d4185dd Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 10 May 2022 19:41:18 +0200 Subject: [PATCH] add prometheus and grafana --- grafana.nomad | 38 +++++++++++++++++++++ prometheus.nomad | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 grafana.nomad create mode 100644 prometheus.nomad diff --git a/grafana.nomad b/grafana.nomad new file mode 100644 index 0000000..83d9f00 --- /dev/null +++ b/grafana.nomad @@ -0,0 +1,38 @@ +job "grafana" { + datacenters = ["homelab"] + type = "service" + meta { + forcedeploiement = 1 + } + group "grafana" { + network { + port "http" { + to = 3000 + } + } + + service { + name = "grafana" + port = "http" + tags= [ + "traefik.enable=true", + "traefik.http.routers.grafana.entryPoints=websecure", + "traefik.http.routers.grafana.rule=Host(`grafana.ducamps.win`)", + "traefik.http.routers.grafana.tls.domains[0].sans=grafana.ducamps.win", + "traefik.http.routers.grafana.tls.certresolver=myresolver", + ] + } + + task "dashboard" { + driver = "docker" + config { + image = "grafana/grafana" + ports = ["http"] + volumes = [ + "/mnt/diskstation/nomad/grafana/config:/etc/grafana", + "/mnt/diskstation/nomad/grafana/lib:/var/lib/grafana" + ] + } + } + } +} diff --git a/prometheus.nomad b/prometheus.nomad new file mode 100644 index 0000000..adfdf8c --- /dev/null +++ b/prometheus.nomad @@ -0,0 +1,88 @@ +job "prometheus" { + datacenters = ["homelab"] + type = "service" + + group "prometheus" { + count = 1 + + network { + port "prometheus_ui" { + static = 9090 + } + } + + restart { + attempts = 2 + interval = "30m" + delay = "15s" + mode = "fail" + } + + ephemeral_disk { + size = 300 + } + + task "prometheus" { + template { + change_mode = "noop" + destination = "local/prometheus.yml" + + data = <