2019-03-20 00:55:53 +00:00
|
|
|
{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook
|
2019-02-26 11:45:54 +00:00
|
|
|
, coreutils, gnugrep, gnused, lm_sensors, net_snmp, openssh, openssl, perl
|
2019-03-20 12:31:46 +00:00
|
|
|
, dnsutils, libdbi, mysql, zlib, openldap, procps
|
2019-02-26 11:45:54 +00:00
|
|
|
, runtimeShell }:
|
2017-08-07 14:56:54 +00:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
majorVersion = "2.2";
|
|
|
|
minorVersion = ".0";
|
|
|
|
|
2019-03-20 12:13:36 +00:00
|
|
|
binPath = makeBinPath [ coreutils gnugrep gnused lm_sensors net_snmp procps ];
|
2017-08-07 14:56:54 +00:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "monitoring-plugins-${majorVersion}${minorVersion}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "monitoring-plugins";
|
|
|
|
repo = "monitoring-plugins";
|
|
|
|
rev = "v${majorVersion}";
|
|
|
|
sha256 = "1pw7i6d2cnb5nxi2lbkwps2qzz04j9zd86fzpv9ka896b4aqrwv1";
|
|
|
|
};
|
|
|
|
|
2019-03-20 00:55:53 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/monitoring-plugins/monitoring-plugins/issues/1508
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/monitoring-plugins/monitoring-plugins/commit/ac0437ff896ba9ce2549b2d2ec3de146a886f08a.patch";
|
|
|
|
sha256 = "0jf6fqkyzag66rid92m7asnr2dp8rr8kn4zjvhqg0mqvf8imppky";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2017-08-07 14:56:54 +00:00
|
|
|
# !!! Awful hack. Grrr... this of course only works on NixOS.
|
|
|
|
# Anyway the check that configure performs to figure out the ping
|
|
|
|
# syntax is totally impure, because it runs an actual ping to
|
|
|
|
# localhost (which won't work for ping6 if IPv6 support isn't
|
|
|
|
# configured on the build machine).
|
|
|
|
preConfigure= ''
|
|
|
|
substituteInPlace po/Makefile.in.in \
|
|
|
|
--replace /bin/sh ${stdenv.shell}
|
|
|
|
|
|
|
|
sed -i configure.ac \
|
|
|
|
-e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"\$out/bin:/run/wrappers/bin:${binPath}\"|'
|
|
|
|
|
|
|
|
configureFlagsArray=(
|
|
|
|
--with-ping-command='/run/wrappers/bin/ping -4 -n -U -w %d -c %d %s'
|
|
|
|
--with-ping6-command='/run/wrappers/bin/ping -6 -n -U -w %d -c %d %s'
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
|
|
|
# !!! make openssh a runtime dependency only
|
2019-03-20 12:31:46 +00:00
|
|
|
buildInputs = [ dnsutils libdbi mysql net_snmp openldap openssh openssl perl procps zlib ];
|
2017-08-07 14:56:54 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
# For unknown reasons the installer tries executing $out/share and fails if
|
|
|
|
# it doesn't succeed.
|
|
|
|
# So we create it and remove it again later.
|
|
|
|
preBuild = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cat <<_EOF > $out/share
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2017-08-07 14:56:54 +00:00
|
|
|
exit 0
|
|
|
|
_EOF
|
|
|
|
chmod 755 $out/share
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm $out/share
|
|
|
|
ln -s libexec $out/bin
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2018-04-01 06:06:23 +00:00
|
|
|
description = "Official monitoring plugins for Nagios/Icinga/Sensu and others.";
|
2017-08-07 14:56:54 +00:00
|
|
|
homepage = https://www.monitoring-plugins.org;
|
|
|
|
license = licenses.gpl2;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice relrod ];
|
|
|
|
};
|
|
|
|
}
|