some improvements

This commit is contained in:
Ingolf Wagner 2024-05-16 10:57:57 +02:00
parent 9f6d63cabe
commit a5234a2a84
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 35 additions and 0 deletions

View file

@ -11,6 +11,7 @@ with types;
};
imports = [
./export-zfs.nix
./netdata.nix
./opentelemetry.nix
./prometheus.nix
@ -19,4 +20,5 @@ with types;
];
config = mkIf config.components.monitor.enable { };
}

View file

@ -0,0 +1,32 @@
{ pkgs, config, lib, ... }:
with lib;
with types;
{
options.components.monitor.exporters.zfs.enable = mkOption {
type = lib.types.bool;
default = config.components.monitor.enable;
};
config = mkMerge [
(mkIf config.components.monitor.exporters.zfs.enable {
services.telegraf.extraConfig.inputs.zfs = {};
services.prometheus.exporters.zfs.enable = true;
services.opentelemetry-collector.settings = {
receivers.prometheus.config.scrape_configs = [
{
job_name = "zfs";
scrape_interval = "10s";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.zfs.port}" ];
}];
}
];
service.pipelines.metrics.receivers = [ "prometheus" ];
};
})
];
}

View file

@ -39,6 +39,7 @@
components.monitor.enable = true;
components.monitor.opentelemetry.exporter.endpoint = "10.100.0.1:4317"; # orbi
components.monitor.exporters.zfs.enable = false;
home-manager.users.mainUser.home.sessionPath = [ "$HOME/.timewarrior/scripts" ];