nixpkgs-suyu/pkgs/servers/monitoring/plugins/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

121 lines
2.6 KiB
Nix
Raw Normal View History

2021-04-07 09:00:27 +02:00
{ lib
, stdenv
, fetchFromGitHub
, writeShellScript
, autoreconfHook
, pkg-config
, runCommand
, coreutils
, gnugrep
, gnused
, lm_sensors
, net-snmp
, openssh
, openssl
, perl
, dnsutils
, libdbi
, libmysqlclient
, uriparser
, zlib
, openldap
, procps
, runtimeShell
}:
let
2021-04-07 09:00:27 +02:00
binPath = lib.makeBinPath [
(placeholder "out")
"/run/wrappers"
coreutils
gnugrep
gnused
lm_sensors
net-snmp
procps
];
2021-04-07 09:00:27 +02:00
mailq = runCommand "mailq-wrapper" { preferLocalBuild = true; } ''
mkdir -p $out/bin
ln -s /run/wrappers/bin/sendmail $out/bin/mailq
'';
2021-04-07 09:00:27 +02:00
# For unknown reasons the installer tries executing $out/share and fails so
# we create it and remove it again later.
share = writeShellScript "share" ''
exit 0
'';
in
stdenv.mkDerivation rec {
pname = "monitoring-plugins";
version = "2.3.0";
src = fetchFromGitHub {
2021-04-07 09:00:27 +02:00
owner = "monitoring-plugins";
repo = "monitoring-plugins";
rev = "v" + lib.versions.majorMinor version;
sha256 = "sha256-yLhHOSrPFRjW701aOL8LPe4OnuJxL6f+dTxNqm0evIg=";
};
2021-04-07 09:00:27 +02:00
# TODO: 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).
2021-04-07 09:00:27 +02:00
#
# --with-ping-command needs to be done here instead of in
# configureFlags due to the spaces in the argument
postPatch = ''
substituteInPlace po/Makefile.in.in \
2021-04-07 09:00:27 +02:00
--replace /bin/sh ${runtimeShell}
sed -i configure.ac \
2021-04-07 09:00:27 +02:00
-e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"${binPath}\"|'
2021-04-07 09:00:27 +02:00
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'
)
2021-04-07 09:00:27 +02:00
install -Dm555 ${share} $out/share
'';
2021-04-07 09:00:27 +02:00
configureFlags = [
"--libexecdir=${placeholder "out"}/bin"
"--with-mailq-command=${mailq}/bin/mailq"
"--with-sudo-command=/run/wrappers/bin/sudo"
];
buildInputs = [
dnsutils
libdbi
libmysqlclient
net-snmp
openldap
# TODO: make openssh a runtime dependency only
openssh
openssl
perl
procps
uriparser
zlib
];
2021-04-07 09:00:27 +02:00
nativeBuildInputs = [ autoreconfHook pkg-config ];
enableParallelBuilding = true;
postInstall = ''
rm $out/share
'';
2021-04-07 09:00:27 +02:00
meta = with lib; {
description = "Official monitoring plugins for Nagios/Icinga/Sensu and others";
2021-04-07 09:00:27 +02:00
homepage = "https://www.monitoring-plugins.org";
license = licenses.gpl3Only;
maintainers = with maintainers; [ thoughtpolice relrod ];
2021-04-07 09:00:27 +02:00
platforms = platforms.linux;
};
}