Skip to content

Commit

Permalink
Upgrade zfs node-exporter script
Browse files Browse the repository at this point in the history
Use golang version of software
  • Loading branch information
simonswine committed Dec 7, 2023
1 parent f647f67 commit e89dd2b
Showing 1 changed file with 21 additions and 43 deletions.
64 changes: 21 additions & 43 deletions pkgs/prometheus-node-exporter-zfs/default.nix
Original file line number Diff line number Diff line change
@@ -1,58 +1,36 @@
{ pkgs, makeWrapper, stdenv, fetchFromGitHub, python3Packages, lib }:
{ lib
, buildGoModule
, fetchFromGitHub
, zfs
, makeWrapper
}:

with python3Packages;

let
_prometheus_client = buildPythonApplication rec {
pname = "prometheus_client";
version = "0.11.0";

src = python3Packages.fetchPypi {
inherit pname version;
sha256 = "Oouq3my4C8/kMpfjPnYj8xGNZg1BOHWTdY4vseoXOoY=";
};

doCheck = false;
};

in

buildPythonApplication rec {
pname = "prometheus-node-exporter-zfs";
version = "fb831ed78c7c4321b1d897ddc906e274f79e4e30";
buildGoModule rec {
pname = "zfs-event-exporter";
version = "15c214a249db90ab43c932606e5cdf1240622e07";

src = fetchFromGitHub {
owner = "simonswine";
repo = "node-exporter-textfile-collector-scripts";
repo = "zfs-event-exporter";
rev = "${version}";
sha256 = "42Z+S/ww/VndbzlQwgWgIEfCRrhE1zcvzf8YRdHMjIU=";
hash = "sha256-qpyJKlB5/kNghdnlXl+/NIO3RjSDIBXVkDCouXBgI9A=";
};

format = "other";

pythonPath = [ _prometheus_client ];
vendorHash = "sha256-foQ9Era09LF3cla2XfV6+kI0PO4qzBc8Es9yU/1Gx2I=";

nativeBuildInputs = [ makeWrapper ];

buildInputs = pythonPath;

dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
doCheck = false;

installPhase = ''
mkdir -p $out/bin/
cp zfs.py $out/bin/node-exporter-zfs
chmod +x $out/bin/node-exporter-zfs
fixupPhase = ''
mv $out/bin/zfs-event-exporter $out/bin/node-exporter-zfs
wrapProgram $out/bin/node-exporter-zfs \
--set PATH ${lib.makeBinPath [ pkgs.zfs ]}
--set PATH ${lib.makeBinPath [ zfs ]}
'';

meta = {
homepage = https://github.com/simonswine/node-exporter-textfile-collector-scripts/blob/fb831ed78c7c4321b1d897ddc906e274f79e4e30/zfs.py;
description = "A textfile exporter script for zfs metrics.";
license = lib.licenses.asl20;
maintainers = [ lib.maintainers.simonswine ];
meta = with lib; {
description = "A node exporter exporter script for zfs metrics.";
homepage = "https://github.com/xperimental/flowercare-exporter";
license = licenses.asl20;
maintainers = with maintainers; [ simonswine ];
platforms = platforms.linux;
};
}

0 comments on commit e89dd2b

Please sign in to comment.