fix
This commit is contained in:
@@ -3,11 +3,6 @@ let
|
|||||||
cfg = config.syscfg.monitoring.telegraf;
|
cfg = config.syscfg.monitoring.telegraf;
|
||||||
hasCollector = name: builtins.elem name cfg.collectors;
|
hasCollector = name: builtins.elem name cfg.collectors;
|
||||||
influxCfg = cfg.outputs.influxdb_v3;
|
influxCfg = cfg.outputs.influxdb_v3;
|
||||||
telegrafEnvFiles =
|
|
||||||
lib.optional (influxCfg.secretName != null) "/run/secrets/${influxCfg.secretName}";
|
|
||||||
dockerGroups =
|
|
||||||
lib.optionals (cfg.enable && hasCollector "docker" && config.virtualisation.podman.enable) [ "podman" ]
|
|
||||||
++ lib.optionals (cfg.enable && hasCollector "docker" && config.virtualisation.docker.enable) [ "docker" ];
|
|
||||||
baseConfig = {
|
baseConfig = {
|
||||||
agent = {
|
agent = {
|
||||||
interval = "10s";
|
interval = "10s";
|
||||||
@@ -102,7 +97,7 @@ in {
|
|||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
services.telegraf = {
|
services.telegraf = {
|
||||||
enable = true;
|
enable = true;
|
||||||
environmentFiles = telegrafEnvFiles;
|
environmentFiles = [ config.sops.secrets.telegraf.path ];
|
||||||
extraConfig = lib.mkMerge [
|
extraConfig = lib.mkMerge [
|
||||||
baseConfig
|
baseConfig
|
||||||
inputsConfig
|
inputsConfig
|
||||||
@@ -111,11 +106,11 @@ in {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users.telegraf.extraGroups = dockerGroups;
|
users.users.telegraf.extraGroups = ["docker" "podman"];
|
||||||
|
|
||||||
systemd.services.telegraf = {
|
systemd.services.telegraf = {
|
||||||
path = lib.optionals (hasCollector "smart") [ pkgs.smartmontools ];
|
path = lib.optionals (hasCollector "smart") [ pkgs.smartmontools ];
|
||||||
serviceConfig.SupplementaryGroups = dockerGroups;
|
serviceConfig.SupplementaryGroups = = ["docker" "podman"];
|
||||||
};
|
};
|
||||||
|
|
||||||
security.sudo.extraRules = lib.optionals (hasCollector "smart") [{
|
security.sudo.extraRules = lib.optionals (hasCollector "smart") [{
|
||||||
|
|||||||
@@ -109,9 +109,6 @@
|
|||||||
database = "main";
|
database = "main";
|
||||||
secretName = "INFLUX";
|
secretName = "INFLUX";
|
||||||
};
|
};
|
||||||
tags = {
|
|
||||||
role = "sandbox";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user