about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/monitoring/nagios/plugins/smartmon.nix
blob: 42554cfafe9995bd49b4bb786a6b7d8f76d03537 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 ];
  };
}