DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

35d3347db42fb06d1e445a7ff3ec7e5b43a813d5 — Jonni Liljamo 3 months ago 9cbbd7a
wip: continue prometheus role
1 files changed, 33 insertions(+), 3 deletions(-)

M roles/prometheus.nix
M roles/prometheus.nix => roles/prometheus.nix +33 -3
@@ 14,11 14,41 @@ in {
            default = false;
            description = "Wheter to open firewall ports for enabled exporters";
          };
          node.enable = lib.mkEnableOption "node exporter";
          systemd.enable = lib.mkEnableOption "systemd exporter";
          node = lib.mkOption {
            type = lib.types.submodule {
              options = {
                enable = lib.mkEnableOption "node exporter";
                port = lib.mkOption {
                  type = lib.types.port;
                };
                extraFlags = lib.mkOption {
                  type = lib.types.listOf lib.types.str;
                  default = [];
                };
              };
            };
          };
          systemd = lib.mkOption {
            type = lib.types.submodule {
              options = {
                enable = lib.mkEnableOption "systemd exporter";
              };
            };
          };
        };
      };
      default = {};
    };
  };

  config = {
    services.prometheus.exporters = {
      node = lib.mkIf cfg.exporters.node.enable {
        port = cfg.exporters.node.port;
        extraFlags = cfg.exporters.node.extraFlags;
      };
      systemd = lib.mkIf cfg.exporters.systemd.enable {
        port = cfg.exporters.systemd.port;
      };
    };
  };
}