nixpkgs/pkgs/servers/monitoring/nagios/default.nix
symphorien+git@xlumurb.eu be25e45fc8 nagios: various improvements
* structured config for main config file allows to launch nagios in
debug mode without having to write the whole config file by hand
* build time syntax check
* all options have types, one more example
* I find it misleading that the main nagios config file is linked in
/etc but that if you change the link in /etc/ and restart nagios, it
has no effect. Have nagios use /etc/nagios.cfg
* fix paths in example nagios config files, which allows to reuse it:
  services.nagios.objectDefs =
   (map (x: "${pkgs.nagios}/etc/objects/${x}.cfg")
   [ "templates" "timeperiods" "commands" ]) ++ [ ./main.cfg ]
* for the above reason, add mailutils to default plugins

Co-Authored-By: Aaron Andersen <aaron@fosslib.net>
2019-12-30 16:40:52 +01:00

39 lines
1.2 KiB
Nix

{ stdenv, fetchurl, perl, php, gd, libpng, zlib, unzip }:
stdenv.mkDerivation rec {
pname = "nagios";
version = "4.4.5";
src = fetchurl {
url = "mirror://sourceforge/nagios/nagios-4.x/${pname}-${version}/${pname}-${version}.tar.gz";
sha256 = "079rgi3dqdg6h511c96hrch62rxsap9p4x37hm2nj672zb9f4sdz";
};
patches = [ ./nagios.patch ];
buildInputs = [ php perl gd libpng zlib unzip ];
configureFlags = [ "--localstatedir=/var/lib/nagios" ];
buildFlags = "all";
# Do not create /var directories
preInstall = ''
substituteInPlace Makefile --replace '$(MAKE) install-basic' ""
'';
installTargets = "install install-config";
postInstall = ''
# don't make default files use hardcoded paths to commands
sed -i 's@command_line *[^ ]*/\([^/]*\) @command_line \1 @' $out/etc/objects/commands.cfg
sed -i 's@/usr/bin/@@g' $out/etc/objects/commands.cfg
sed -i 's@/bin/@@g' $out/etc/objects/commands.cfg
'';
meta = {
description = "A host, service and network monitoring program";
homepage = https://www.nagios.org/;
license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
maintainers = with stdenv.lib.maintainers; [ thoughtpolice relrod ];
};
}