diff --git a/modules/data-hoarder/default.nix b/modules/data-hoarder/default.nix index 1f266d9..9d785b9 100644 --- a/modules/data-hoarder/default.nix +++ b/modules/data-hoarder/default.nix @@ -7,7 +7,6 @@ ./lizard.nix ./bureaucrat.nix ./file_sharing.nix - ./grafana.nix ./map.nix ./nginx.nix ./postgres.nix diff --git a/modules/data-hoarder/grafana.nix b/modules/data-hoarder/grafana.nix deleted file mode 100644 index 6c0d8ea..0000000 --- a/modules/data-hoarder/grafana.nix +++ /dev/null @@ -1,164 +0,0 @@ -{ config, lib, self, ... }: { - - services = { - # metrics collector - prometheus = { - enable = true; - port = 9501; - retentionTime = "2d"; - exporters = { - # node exports hardware information like memory, cpu usage and the like - node = { - enable = true; - enabledCollectors = [ "systemd" ]; - port = 9502; - }; - - # used for pinging services and checking their health - blackbox = { - enable = true; - configFile = ../../services/blackbox.yaml; - }; - }; - - scrapeConfigs = [ - # hardware information - { - job_name = "data-hoarder-hardware"; - static_configs = [{ - targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; - }]; - } - - # funnel connection metrics - { - job_name = "funnel-connections"; - static_configs = [ - { - targets = [ "127.0.0.1:${toString config.TLMS.funnel.metrics.port}" ]; - } - ]; - } - - # metrics from data-accumulator - { - job_name = "data-accumulator"; - metrics_path = "/metrics"; - static_configs = [ - { - targets = [ "127.0.0.1:${toString config.TLMS.dataAccumulator.port}" ]; - } - ]; - } - - # metrics from lizard - { - job_name = "lizard"; - metrics_path = "/metrics"; - static_configs = [ - { - targets = [ "${config.TLMS.lizard.http.host}:${toString config.TLMS.lizard.http.port}" ]; - } - ]; - } - - # metrics from datacare - { - job_name = "datacare"; - metrics_path = "/metrics"; - static_configs = [ - { - targets = [ "${config.TLMS.datacare.host}:${toString config.TLMS.datacare.port}" ]; - } - ]; - } - - # checks if the data-accumulator server is running - { - job_name = "blackbox-data-accumulator"; - metrics_path = "/probe"; - params = { module = [ "http_2xx" ]; }; - static_configs = [{ - targets = [ - "127.0.0.1:8080" - ]; - }]; - relabel_configs = [ - { source_labels = [ "__address__" ]; target_label = "__param_target"; } - { source_labels = [ "__param_target" ]; target_label = "instance"; } - { target_label = "__address__"; replacement = "127.0.0.1:9115"; } - ]; - } - - # checks if the dvb-api server is running - { - job_name = "blackbox-dvb-api"; - metrics_path = "/probe"; - params = { module = [ "http_2xx" ]; }; - static_configs = [{ - targets = [ - "api.${config.deployment-TLMS.domain}" - ]; - }]; - relabel_configs = [ - { source_labels = [ "__address__" ]; target_label = "__param_target"; } - { source_labels = [ "__param_target" ]; target_label = "instance"; } - { target_label = "__address__"; replacement = "127.0.0.1:9115"; } - ]; - } - - ]; - }; - promtail = { - enable = true; - # doesn't have a configFile option so this has to do - configuration = builtins.fromJSON (lib.readFile "${self}/services/promtail.json"); - }; - - - # exports systemd logs and other - loki = { - enable = true; - configFile = self + /services/loki.yaml; - }; - - # visualizer - grafana = { - settings.server = { - domain = "monitoring.${config.deployment-TLMS.domain}"; - http_port = 2342; - http_addr = "127.0.0.1"; - }; - enable = true; - }; - - # reverse proxy for grafana - nginx = { - enable = true; - virtualHosts = { - "${(builtins.replaceStrings [ "tlm.solutions" ] [ "dvb.solutions" ] (toString config.services.grafana.settings.server.domain))}" = { - enableACME = true; - forceSSL = true; - extraConfig = '' - rewrite ^ https://${toString config.services.grafana.settings.server.domain}$request_uri permanent; - ''; - }; - "${toString config.services.grafana.settings.server.domain}" = { - forceSSL = true; - enableACME = true; - locations."/" = - let - cfg = config.services.grafana; - in - { - proxyPass = "http://${cfg.settings.server.http_addr}:${toString cfg.settings.server.http_port}"; - proxyWebsockets = true; - }; - }; - }; - }; - }; - - # noXlibs breaks pango/cairo - environment.noXlibs = false; -}