diff --git a/services/monitoring/exporters/baseline.nix b/services/monitoring/exporters/baseline.nix deleted file mode 100644 index 835fdee..0000000 --- a/services/monitoring/exporters/baseline.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.bagel.monitoring.exporters.baseline; - inherit (lib) mkEnableOption mkIf; -in -{ - options.bagel.monitoring.exporters.baseline.enable = (mkEnableOption "Standard set of exporters") // { default = true; }; - - config = mkIf cfg.enable { - services.prometheus.exporters.node = { - enable = true; - enabledCollectors = [ - "processes" - "systemd" - ]; - port = 9101; - }; - - services.cadvisor = { - enable = true; - port = 9102; - listenAddress = "0.0.0.0"; - }; - - bagel.meta.monitoring.exporters = [ - { port = 9101; } - { port = 9102; } - ]; - }; -} \ No newline at end of file diff --git a/services/monitoring/exporters/cadvisor.nix b/services/monitoring/exporters/cadvisor.nix new file mode 100644 index 0000000..34106f1 --- /dev/null +++ b/services/monitoring/exporters/cadvisor.nix @@ -0,0 +1,22 @@ +{ + config, + lib, + ... +}: +let + cfg = config.bagel.monitoring.exporters.cadvisor; + inherit (lib) mkEnableOption mkIf; +in +{ + options.bagel.monitoring.exporters.cadvisor.enable = (mkEnableOption "Standard cAdvisor") // { default = !config.boot.isContainer; }; + + config = mkIf cfg.enable { + services.cadvisor = { + enable = true; + port = 9102; + listenAddress = "0.0.0.0"; + }; + + bagel.meta.monitoring.exporters = [ { port = 9102; } ]; + }; +} diff --git a/services/monitoring/exporters/default.nix b/services/monitoring/exporters/default.nix index b083874..45d0ca7 100644 --- a/services/monitoring/exporters/default.nix +++ b/services/monitoring/exporters/default.nix @@ -8,7 +8,8 @@ let in { imports = [ - ./baseline.nix + ./cadvisor.nix + ./node.nix ./nginx.nix ./postgres.nix ]; diff --git a/services/monitoring/exporters/node.nix b/services/monitoring/exporters/node.nix new file mode 100644 index 0000000..2ced93e --- /dev/null +++ b/services/monitoring/exporters/node.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + ... +}: +let + cfg = config.bagel.monitoring.exporters.node; + inherit (lib) mkEnableOption mkIf; +in +{ + options.bagel.monitoring.exporters.node.enable = (mkEnableOption "Standard node_exporter") // { default = true; }; + + config = mkIf cfg.enable { + services.prometheus.exporters.node = { + enable = true; + enabledCollectors = [ + "processes" + "systemd" + ]; + port = 9101; + }; + + bagel.meta.monitoring.exporters = [ { port = 9101; } ]; + }; +}