From f96324f5ae5fdb8814b7faac7b610afeb3d46d20 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Sun, 21 Apr 2024 18:46:58 +0200 Subject: [PATCH] ildkule: Move metrics->monitoring. Add uptime-kuma. Adjust prometheus exporters. --- hosts/ildkule/configuration.nix | 2 +- .../dashboards/go-processes.json | 0 .../dashboards/mysql.json | 0 .../dashboards/node-exporter-full.json | 0 .../dashboards/postgres.json | 0 .../dashboards/synapse.json | 0 .../{metrics => monitoring}/default.nix | 3 ++- .../{metrics => monitoring}/grafana.nix | 2 +- .../services/{metrics => monitoring}/loki.nix | 0 .../prometheus/default.nix | 0 .../prometheus/gogs.nix | 0 .../prometheus/matrix-synapse.nix | 0 .../prometheus/mysqld.nix | 0 .../prometheus/node.nix | 0 .../prometheus/postgres.nix | 0 .../prometheus/rules/synapse-v2.rules | 0 .../services/monitoring/uptime-kuma.nix | 20 +++++++++++++++++++ misc/metrics-exporters.nix | 2 ++ 18 files changed, 26 insertions(+), 3 deletions(-) rename hosts/ildkule/services/{metrics => monitoring}/dashboards/go-processes.json (100%) rename hosts/ildkule/services/{metrics => monitoring}/dashboards/mysql.json (100%) rename hosts/ildkule/services/{metrics => monitoring}/dashboards/node-exporter-full.json (100%) rename hosts/ildkule/services/{metrics => monitoring}/dashboards/postgres.json (100%) rename hosts/ildkule/services/{metrics => monitoring}/dashboards/synapse.json (100%) rename hosts/ildkule/services/{metrics => monitoring}/default.nix (81%) rename hosts/ildkule/services/{metrics => monitoring}/grafana.nix (98%) rename hosts/ildkule/services/{metrics => monitoring}/loki.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/default.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/gogs.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/matrix-synapse.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/mysqld.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/node.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/postgres.nix (100%) rename hosts/ildkule/services/{metrics => monitoring}/prometheus/rules/synapse-v2.rules (100%) create mode 100644 hosts/ildkule/services/monitoring/uptime-kuma.nix diff --git a/hosts/ildkule/configuration.nix b/hosts/ildkule/configuration.nix index 8181bfa..99e14bf 100644 --- a/hosts/ildkule/configuration.nix +++ b/hosts/ildkule/configuration.nix @@ -6,8 +6,8 @@ ../../base.nix ../../misc/metrics-exporters.nix + ./services/monitoring ./services/nginx - ./services/metrics ]; sops.defaultSopsFile = ../../secrets/ildkule/ildkule.yaml; diff --git a/hosts/ildkule/services/metrics/dashboards/go-processes.json b/hosts/ildkule/services/monitoring/dashboards/go-processes.json similarity index 100% rename from hosts/ildkule/services/metrics/dashboards/go-processes.json rename to hosts/ildkule/services/monitoring/dashboards/go-processes.json diff --git a/hosts/ildkule/services/metrics/dashboards/mysql.json b/hosts/ildkule/services/monitoring/dashboards/mysql.json similarity index 100% rename from hosts/ildkule/services/metrics/dashboards/mysql.json rename to hosts/ildkule/services/monitoring/dashboards/mysql.json diff --git a/hosts/ildkule/services/metrics/dashboards/node-exporter-full.json b/hosts/ildkule/services/monitoring/dashboards/node-exporter-full.json similarity index 100% rename from hosts/ildkule/services/metrics/dashboards/node-exporter-full.json rename to hosts/ildkule/services/monitoring/dashboards/node-exporter-full.json diff --git a/hosts/ildkule/services/metrics/dashboards/postgres.json b/hosts/ildkule/services/monitoring/dashboards/postgres.json similarity index 100% rename from hosts/ildkule/services/metrics/dashboards/postgres.json rename to hosts/ildkule/services/monitoring/dashboards/postgres.json diff --git a/hosts/ildkule/services/metrics/dashboards/synapse.json b/hosts/ildkule/services/monitoring/dashboards/synapse.json similarity index 100% rename from hosts/ildkule/services/metrics/dashboards/synapse.json rename to hosts/ildkule/services/monitoring/dashboards/synapse.json diff --git a/hosts/ildkule/services/metrics/default.nix b/hosts/ildkule/services/monitoring/default.nix similarity index 81% rename from hosts/ildkule/services/metrics/default.nix rename to hosts/ildkule/services/monitoring/default.nix index a0a6a40..e68ef7a 100644 --- a/hosts/ildkule/services/metrics/default.nix +++ b/hosts/ildkule/services/monitoring/default.nix @@ -2,8 +2,9 @@ { imports = [ - ./prometheus ./grafana.nix ./loki.nix + ./prometheus + ./uptime-kuma.nix ]; } diff --git a/hosts/ildkule/services/metrics/grafana.nix b/hosts/ildkule/services/monitoring/grafana.nix similarity index 98% rename from hosts/ildkule/services/metrics/grafana.nix rename to hosts/ildkule/services/monitoring/grafana.nix index 65d59e5..a4d022f 100644 --- a/hosts/ildkule/services/metrics/grafana.nix +++ b/hosts/ildkule/services/monitoring/grafana.nix @@ -17,7 +17,7 @@ in { secretFile = path: "$__file{${path}}"; in { server = { - domain = "ildkule.pvv.ntnu.no"; + domain = "grafana.pvv.ntnu.no"; http_port = 2342; http_addr = "127.0.0.1"; }; diff --git a/hosts/ildkule/services/metrics/loki.nix b/hosts/ildkule/services/monitoring/loki.nix similarity index 100% rename from hosts/ildkule/services/metrics/loki.nix rename to hosts/ildkule/services/monitoring/loki.nix diff --git a/hosts/ildkule/services/metrics/prometheus/default.nix b/hosts/ildkule/services/monitoring/prometheus/default.nix similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/default.nix rename to hosts/ildkule/services/monitoring/prometheus/default.nix diff --git a/hosts/ildkule/services/metrics/prometheus/gogs.nix b/hosts/ildkule/services/monitoring/prometheus/gogs.nix similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/gogs.nix rename to hosts/ildkule/services/monitoring/prometheus/gogs.nix diff --git a/hosts/ildkule/services/metrics/prometheus/matrix-synapse.nix b/hosts/ildkule/services/monitoring/prometheus/matrix-synapse.nix similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/matrix-synapse.nix rename to hosts/ildkule/services/monitoring/prometheus/matrix-synapse.nix diff --git a/hosts/ildkule/services/metrics/prometheus/mysqld.nix b/hosts/ildkule/services/monitoring/prometheus/mysqld.nix similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/mysqld.nix rename to hosts/ildkule/services/monitoring/prometheus/mysqld.nix diff --git a/hosts/ildkule/services/metrics/prometheus/node.nix b/hosts/ildkule/services/monitoring/prometheus/node.nix similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/node.nix rename to hosts/ildkule/services/monitoring/prometheus/node.nix diff --git a/hosts/ildkule/services/metrics/prometheus/postgres.nix b/hosts/ildkule/services/monitoring/prometheus/postgres.nix similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/postgres.nix rename to hosts/ildkule/services/monitoring/prometheus/postgres.nix diff --git a/hosts/ildkule/services/metrics/prometheus/rules/synapse-v2.rules b/hosts/ildkule/services/monitoring/prometheus/rules/synapse-v2.rules similarity index 100% rename from hosts/ildkule/services/metrics/prometheus/rules/synapse-v2.rules rename to hosts/ildkule/services/monitoring/prometheus/rules/synapse-v2.rules diff --git a/hosts/ildkule/services/monitoring/uptime-kuma.nix b/hosts/ildkule/services/monitoring/uptime-kuma.nix new file mode 100644 index 0000000..036c919 --- /dev/null +++ b/hosts/ildkule/services/monitoring/uptime-kuma.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.services.uptime-kuma; + domain = "uptime.pvv.ntnu.no"; +in { + services.uptime-kuma = { + enable = true; + settings = { + PORT = "5059"; + HOST = "127.0.1.2"; + }; + }; + + services.nginx.virtualHosts.${domain} = { + enableACME = true; + forceSSL = true; + kTLS = true; + locations."/".proxyPass = "http://${cfg.settings.HOST}:${cfg.settings.PORT}"; + }; +} diff --git a/misc/metrics-exporters.nix b/misc/metrics-exporters.nix index 3018936..9f32a28 100644 --- a/misc/metrics-exporters.nix +++ b/misc/metrics-exporters.nix @@ -14,6 +14,8 @@ "::1" values.hosts.ildkule.ipv4 values.hosts.ildkule.ipv6 + values.hosts.ildkule.ipv4_global + values.hosts.ildkule.ipv6_global ]; };