nixos-config/components/monitor/metrics-export-zfs.nix

40 lines
880 B
Nix
Raw Normal View History

2024-08-29 03:26:04 +02:00
{
pkgs,
config,
lib,
...
}:
2024-05-16 10:57:57 +02:00
with lib;
with types;
{
options.components.monitor.exporters.zfs.enable = mkOption {
type = lib.types.bool;
2024-05-18 12:02:21 +02:00
default = config.components.monitor.metrics.enable;
2024-05-16 10:57:57 +02:00
};
config = mkMerge [
(mkIf config.components.monitor.exporters.zfs.enable {
2024-05-16 13:10:48 +02:00
services.telegraf.extraConfig.inputs.zfs = { };
2024-05-16 10:57:57 +02:00
services.prometheus.exporters.zfs.enable = true;
services.opentelemetry-collector.settings = {
receivers.prometheus.config.scrape_configs = [
{
job_name = "zfs";
scrape_interval = "10s";
2024-08-29 03:26:04 +02:00
static_configs = [
{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.zfs.port}" ];
}
];
2024-05-16 10:57:57 +02:00
}
];
service.pipelines.metrics.receivers = [ "prometheus" ];
};
})
];
}