waffentrager: monitoring

This commit is contained in:
Mateusz Słodkowicz 2024-09-03 10:12:23 +02:00
parent b9f78639c8
commit f892292aa0
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
2 changed files with 23 additions and 5 deletions

View File

@ -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;
}

View File

@ -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";