1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 pkg-config,
7 runCommand,
8 coreutils,
9 gnugrep,
10 gnused,
11 lm_sensors,
12 net-snmp,
13 openssh,
14 openssl,
15 perl,
16 dnsutils,
17 libdbi,
18 libmysqlclient,
19 uriparser,
20 zlib,
21 openldap,
22 procps,
23 runtimeShell,
24 unixtools,
25}:
26
27let
28 binPath = lib.makeBinPath [
29 (placeholder "out")
30 "/run/wrappers"
31 coreutils
32 gnugrep
33 gnused
34 lm_sensors
35 net-snmp
36 procps
37 ];
38in
39stdenv.mkDerivation rec {
40 pname = "monitoring-plugins";
41 version = "2.4.0";
42
43 src = fetchFromGitHub {
44 owner = "monitoring-plugins";
45 repo = "monitoring-plugins";
46 rev = "v${version}";
47 hash = "sha256-T37t0shhC+8k7CN/hIOxsskuuCi0LwQui8xyRTC+pjQ=";
48 };
49
50 # TODO: Awful hack. Grrr...
51 # Anyway the check that configure performs to figure out the ping
52 # syntax is totally impure, because it runs an actual ping to
53 # localhost (which won't work for ping6 if IPv6 support isn't
54 # configured on the build machine).
55 #
56 # --with-ping-command needs to be done here instead of in
57 # configureFlags due to the spaces in the argument
58 postPatch = ''
59 sed -i configure.ac \
60 -e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"${binPath}\"|'
61
62 configureFlagsArray+=(
63 --with-ping-command='${lib.getBin unixtools.ping}/bin/ping -4 -n -U -w %d -c %d %s'
64 --with-ping6-command='${lib.getBin unixtools.ping}/bin/ping -6 -n -U -w %d -c %d %s'
65 )
66 '';
67
68 configureFlags = [
69 "--libexecdir=${placeholder "out"}/bin"
70 "--with-mailq-command=/run/wrappers/bin/mailq"
71 "--with-sudo-command=/run/wrappers/bin/sudo"
72 ];
73
74 buildInputs = [
75 dnsutils
76 libdbi
77 libmysqlclient
78 net-snmp
79 openldap
80 # TODO: make openssh a runtime dependency only
81 openssh
82 openssl
83 perl
84 procps
85 uriparser
86 zlib
87 ];
88
89 nativeBuildInputs = [
90 autoreconfHook
91 pkg-config
92 ];
93
94 enableParallelBuilding = true;
95
96 meta = with lib; {
97 description = "Official monitoring plugins for Nagios/Icinga/Sensu and others";
98 homepage = "https://www.monitoring-plugins.org";
99 license = licenses.gpl3Plus;
100 maintainers = with maintainers; [
101 thoughtpolice
102 relrod
103 ];
104 platforms = platforms.linux;
105 };
106}