DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

dcebc6afbdde136d66864069152e05344f177559 — Jonni Liljamo 2 months ago 11d839f
feat: cadvisor
A roles/cadvisor.nix => roles/cadvisor.nix +32 -0
@@ 0,0 1,32 @@
{
  lib,
  config,
  ...
}: let
  cfg = config.roles.cadvisor;
in {
  options.roles.cadvisor = {
    enable = lib.mkEnableOption "cadvisor";
    port = lib.mkOption {
      type = lib.types.port;
      default = 9080;
    };
    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Wheter to open firewall port for cadvisor";
    };
  };

  config = lib.mkIf cfg.enable {
    networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [
      cfg.port
    ];

    services.cadvisor = {
      enable = true;
      listenAddress = "0.0.0.0";
      port = cfg.port;
    };
  };
}

M roles/default.nix => roles/default.nix +1 -0
@@ 7,6 7,7 @@
    ./audio.nix
    ./base.nix
    ./bluetooth.nix
    ./cadvisor.nix
    ./docker.nix
    ./git.nix
    ./hyprland.nix

M systems/hosts/metrics/default.nix => systems/hosts/metrics/default.nix +9 -0
@@ 35,6 35,15 @@ in {
      }

      {
        job_name = "cadvisor";
        static_configs = [
          {
            targets = map (x: x + ":9080") (builtins.attrNames (artautil.getDNSEntries "lxc"));
          }
        ];
      }

      {
        job_name = "node";
        static_configs = [
          {

M systems/profiles/lxc/roles.nix => systems/profiles/lxc/roles.nix +5 -0
@@ 13,4 13,9 @@
    };
    systemd.enable = true;
  };

  roles.cadvisor = {
    enable = true;
    openFirewall = true;
  };
}