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

33 lines
840 B
Nix
Raw Normal View History

2024-05-16 10:57:57 +02:00
{ pkgs, config, lib, ... }:
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";
static_configs = [{
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.zfs.port}" ];
}];
}
];
service.pipelines.metrics.receivers = [ "prometheus" ];
};
})
];
}