diff --git a/hosts/flora/default.nix b/hosts/flora/default.nix index 6a2eedf..2a9a77c 100644 --- a/hosts/flora/default.nix +++ b/hosts/flora/default.nix @@ -78,6 +78,7 @@ environment.systemPackages = [ pkgs.kitty pkgs.foot + pkgs.zpool-iostat-viz ]; time.timeZone = "Europe/Amsterdam"; diff --git a/modules/core/virtualization.nix b/modules/core/virtualization.nix index 8a54dbe..a70610d 100644 --- a/modules/core/virtualization.nix +++ b/modules/core/virtualization.nix @@ -46,6 +46,9 @@ users.groups.libvirtd.members = if (config.virtualisation.libvirtd.enable == true) then [ username ] else [ ]; + users.groups.qemu-libvirtd.members = + if (config.virtualisation.libvirtd.enable == true) then [ username ] else [ ]; + # Enable qemu etc environment.systemPackages = with pkgs; [ qemu diff --git a/modules/services/monitoring.nix b/modules/services/monitoring.nix index b24e67b..0c8b7d6 100644 --- a/modules/services/monitoring.nix +++ b/modules/services/monitoring.nix @@ -5,9 +5,30 @@ enable = true; port = 9001; exporters = { + smartctl.enable = true; + zfs.enable = true; node = { enable = true; - enabledCollectors = [ "systemd" ]; + enabledCollectors = [ + "systemd" + "cpu" + "cpufreq" + "diskstats" + "filesystem" + "loadavg" + "meminfo" + "netdev" + "stat" + "time" + "uname" + "hwmon" + "bcache" + "conntrack" + "dmi" + "nvme" + "thermal_zone" + "zfs" + ]; port = 9002; }; smokeping = { @@ -37,12 +58,69 @@ } ]; } + { + job_name = "${host} - smartctl"; + static_configs = [ + { + targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}" ]; + } + ]; + } + { + job_name = "${host} - zfs"; + static_configs = [ + { + targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.zfs.port}" ]; + } + ]; + } ]; }; + loki = { + enable = true; + configuration = { + auth_enabled = false; + server.http_listen_port = 9003; + + common = { + path_prefix = "/var/lib/loki"; + replication_factor = 1; + ring.kvstore.store = "inmemory"; + }; + + schema_config.configs = [ + { + from = "2024-01-01"; + store = "tsdb"; + object_store = "filesystem"; + schema = "v13"; + index = { + prefix = "index_"; + period = "24h"; + }; + } + ]; + + storage_config.filesystem.directory = "/var/lib/loki/chunks"; + + limits_config = { + retention_period = "90d"; + reject_old_samples = true; + reject_old_samples_max_age = "8h"; + }; + + compactor = { + working_directory = "/var/lib/loki/compactor"; + delete_request_store = "filesystem"; + retention_enabled = true; + }; + }; + }; + }; + networking.firewall = { + allowedTCPPorts = [ + 9001 + 9003 + ]; }; - # networking.firewall = { - # allowedTCPPorts = [ - # 9001 - # ]; - # }; }