Add siebenmann/zfs_exporter package and related module (#514423)
This commit is contained in:
@@ -131,6 +131,7 @@ let
|
||||
"v2ray"
|
||||
"varnish"
|
||||
"wireguard"
|
||||
"zfs-siebenmann"
|
||||
"zfs"
|
||||
]
|
||||
(
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
options,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.services.prometheus.exporters.zfs-siebenmann;
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
concatStringsSep
|
||||
optionalString
|
||||
;
|
||||
in
|
||||
{
|
||||
port = 9700;
|
||||
|
||||
extraOpts = {
|
||||
pools = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Name of the pool(s) to collect, repeat for multiple pools (default: all pools).
|
||||
'';
|
||||
};
|
||||
|
||||
depth = mkOption {
|
||||
type = types.int;
|
||||
default = 1;
|
||||
description = ''
|
||||
Depth of the vdev tree to report on.
|
||||
0 is the pool, 1 is top level vdevs, 2 is devices too.
|
||||
'';
|
||||
};
|
||||
|
||||
fullPath = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Report the full path of disks.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
serviceOpts = {
|
||||
# needs zpool
|
||||
path = [ config.boot.zfs.package ];
|
||||
serviceConfig = {
|
||||
ExecStart = ''
|
||||
${pkgs.prometheus-siebenmann-zfs-exporter}/bin/zfs_exporter \
|
||||
--listen-addr ${cfg.listenAddress}:${toString cfg.port} \
|
||||
--depth ${toString cfg.depth} \
|
||||
${optionalString cfg.fullPath "--fullpath"} \
|
||||
${concatStringsSep " " (map (p: "--pool=${p}") cfg.pools)} \
|
||||
${concatStringsSep " \\\n " cfg.extraFlags}
|
||||
'';
|
||||
ProtectClock = false;
|
||||
PrivateDevices = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
buildGoModule,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
}:
|
||||
|
||||
buildGoModule {
|
||||
__structuredAttrs = true;
|
||||
pname = "prometheus-siebenmann-zfs-exporter";
|
||||
version = "unstable-2022-08-17";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "siebenmann";
|
||||
repo = "zfs_exporter";
|
||||
rev = "c5f18cb0d470c24dbd2c12553a87d0aca3ddc50b";
|
||||
hash = "sha256-FBFjzsoRiU48616CsxkP2lVSGO3qgLYBjOrtROzhgSY=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-YjEK/nKqoMch0UygoCkk8mAclRFhsjodFVHhN49zeW4=";
|
||||
|
||||
meta = {
|
||||
description = "ZFS Exporter for the Prometheus monitoring system (Siebenmann/cks-upstream variant)";
|
||||
mainProgram = "zfs_exporter";
|
||||
homepage = "https://github.com/siebenmann/zfs_exporter";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ podocarp ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user