about summary refs log tree commit diff
path: root/pkgs/servers/monitoring/nagios
diff options
context:
space:
mode:
authorMaria <tuy_mearly@aleeas.com>2022-07-11 16:25:05 -0400
committerMaria <tuy_mearly@aleeas.com>2022-07-16 16:04:18 -0400
commit7a5b32624216b9b6e752386b45e6abce5258be8c (patch)
tree6af986a68fa4b1dd1fbac206fec099c9a6eb9541 /pkgs/servers/monitoring/nagios
parentfeeb878d42ed911c15da3e6031d8ef9b554cd259 (diff)
check_smartmon: init at 1.0.1
Diffstat (limited to 'pkgs/servers/monitoring/nagios')
-rw-r--r--pkgs/servers/monitoring/nagios/plugins/smartmon.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/servers/monitoring/nagios/plugins/smartmon.nix b/pkgs/servers/monitoring/nagios/plugins/smartmon.nix
new file mode 100644
index 0000000000000..42554cfafe999
--- /dev/null
+++ b/pkgs/servers/monitoring/nagios/plugins/smartmon.nix
@@ -0,0 +1,42 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python3
+, smartmontools
+}:
+
+stdenv.mkDerivation rec {
+  pname = "check_smartmon";
+  version = "1.0.1";
+
+  src = fetchFromGitHub {
+    owner  = "driehuis";
+    repo   = "Nagios_check_smartmon";
+    rev    = version;
+    sha256 = "tiIeFiHdDgqoeznk9XdCE7owIMnnsQ0fmtj8foFoUD8=";
+  };
+
+  buildInputs = [
+    (python3.withPackages (pp: [ pp.psutil ]))
+    smartmontools
+  ];
+
+  postPatch = ''
+    patchShebangs check_smartmon.py
+    substituteInPlace check_smartmon.py \
+      --replace '"/usr/sbin/smartctl"' '"${smartmontools}/bin/smartctl"'
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    install -Dm 755 check_smartmon.py $out/bin/check_smartmon
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "A Nagios-Plugin that uses smartmontools to check disk health status and temperature";
+    homepage = "https://github.com/driehuis/Nagios_check_smartmon";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ mariaa144 ];
+  };
+}