Split node_exporter and cadvisor config, disable cadvisor for nodes that are themselves containers #25
|
@ -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; }
|
||||
];
|
||||
};
|
||||
}
|
22
services/monitoring/exporters/cadvisor.nix
Normal file
22
services/monitoring/exporters/cadvisor.nix
Normal file
|
@ -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; } ];
|
||||
};
|
||||
}
|
|
@ -8,7 +8,8 @@ let
|
|||
in
|
||||
{
|
||||
imports = [
|
||||
./baseline.nix
|
||||
./cadvisor.nix
|
||||
./node.nix
|
||||
./nginx.nix
|
||||
./postgres.nix
|
||||
];
|
||||
|
|
25
services/monitoring/exporters/node.nix
Normal file
25
services/monitoring/exporters/node.nix
Normal file
|
@ -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; } ];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue