diff --git a/configurations/host/waffentrager/services/default.nix b/configurations/host/waffentrager/services/default.nix index f783a1f..fc78014 100644 --- a/configurations/host/waffentrager/services/default.nix +++ b/configurations/host/waffentrager/services/default.nix @@ -11,7 +11,7 @@ ./samba.nix ./syncthing.nix ./jellyfin.nix - ./grafana.nix + ./monitoring.nix ./auth ]; waffentragerService.elements.enable = true; @@ -23,5 +23,5 @@ waffentragerService.samba.enable = true; waffentragerService.jellyfin.enable = true; waffentragerService.syncthing.enable = true; - waffentragerService.grafana.enable = false; + waffentragerService.monitoring.enable = true; } \ No newline at end of file diff --git a/configurations/host/waffentrager/services/grafana.nix b/configurations/host/waffentrager/services/monitoring.nix similarity index 60% rename from configurations/host/waffentrager/services/grafana.nix rename to configurations/host/waffentrager/services/monitoring.nix index c9b47bb..5ce7fc9 100644 --- a/configurations/host/waffentrager/services/grafana.nix +++ b/configurations/host/waffentrager/services/monitoring.nix @@ -1,9 +1,9 @@ { materusArg, config, lib, ... }: { - options.waffentragerService.grafana.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable grafana"; + options.waffentragerService.monitoring.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable monitoring"; config = let - cfg = config.waffentragerService.grafana; + cfg = config.waffentragerService.monitoring; in lib.mkIf cfg.enable { services.grafana = { @@ -21,7 +21,25 @@ }; }; }; - + services.prometheus = { + enable = true; + port = 3233; + globalConfig.scrape_interval = "30s"; + scrapeConfigs = [ + { + job_name = "node"; + static_configs = [{ + targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; + }]; + } + ]; + }; + services.prometheus.exporters.node = { + enable = true; + port = 3234; + enabledCollectors = [ "systemd" ]; + extraFlags = [ "--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi" ]; + }; services.nginx.virtualHosts."watchman.materus.pl" = { addSSL = true; sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";