Merge pull request #120924 from helsinki-systems/pkg/icinga2
icinga2: Init at 2.12.3
This commit is contained in:
commit
85784a66c8
|
@ -0,0 +1,101 @@
|
||||||
|
{ stdenv, lib, fetchFromGitHub, cmake, flex, bison, systemd
|
||||||
|
, boost, openssl, patchelf, mariadb-connector-c, postgresql, zlib
|
||||||
|
# Databases
|
||||||
|
, withMysql ? true, withPostgresql ? false
|
||||||
|
# Features
|
||||||
|
, withChecker ? true, withCompat ? false, withLivestatus ? false
|
||||||
|
, withNotification ? true, withPerfdata ? true, withIcingadb ? true
|
||||||
|
, nameSuffix ? "" }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "icinga2${nameSuffix}";
|
||||||
|
version = "2.12.3";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "icinga";
|
||||||
|
repo = "icinga2";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "0pq6ixv7d9bqys8qjxqq0jki3zncj8jdfavkp7qw125iyfjq48xk";
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./etc-icinga2.patch # Makes /etc/icinga2 relative to / instead of the store path
|
||||||
|
./no-systemd-service.patch # Prevent systemd service from being written to /usr
|
||||||
|
./no-var-directories.patch # Prevent /var directories from being created
|
||||||
|
];
|
||||||
|
|
||||||
|
cmakeFlags = let
|
||||||
|
mkFeatureFlag = label: value: "-DICINGA2_WITH_${label}=${if value then "ON" else "OFF"}";
|
||||||
|
in [
|
||||||
|
# Paths
|
||||||
|
"-DCMAKE_INSTALL_SYSCONFDIR=etc"
|
||||||
|
"-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
|
||||||
|
"-DCMAKE_INSTALL_FULL_SBINDIR=bin"
|
||||||
|
"-DICINGA2_RUNDIR=/run"
|
||||||
|
"-DMYSQL_INCLUDE_DIR=${mariadb-connector-c.dev}/include/mariadb"
|
||||||
|
"-DMYSQL_LIB=${mariadb-connector-c.out}/lib/mariadb/libmysqlclient.a"
|
||||||
|
"-DICINGA2_PLUGINDIR=bin"
|
||||||
|
"-DICINGA2_UNITY_BUILD=no"
|
||||||
|
# Features
|
||||||
|
(mkFeatureFlag "MYSQL" withMysql)
|
||||||
|
(mkFeatureFlag "PGSQL" withPostgresql)
|
||||||
|
(mkFeatureFlag "CHECKER" withChecker)
|
||||||
|
(mkFeatureFlag "COMPAT" withCompat)
|
||||||
|
(mkFeatureFlag "LIVESTATUS" withLivestatus)
|
||||||
|
(mkFeatureFlag "NOTIFICATION" withNotification)
|
||||||
|
(mkFeatureFlag "PERFDATA" withPerfdata)
|
||||||
|
(mkFeatureFlag "ICINGADB" withIcingadb)
|
||||||
|
# Misc.
|
||||||
|
"-DICINGA2_USER=icinga2"
|
||||||
|
"-DICINGA2_GROUP=icinga2"
|
||||||
|
"-DICINGA2_GIT_VERSION_INFO=OFF"
|
||||||
|
"-DICINGA2_WITH_TESTS=OFF"
|
||||||
|
"-DUSE_SYSTEMD=ON"
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [ boost openssl systemd ]
|
||||||
|
++ lib.optional withPostgresql postgresql;
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake flex bison patchelf ];
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
rm -r $out/etc/logrotate.d $out/etc/sysconfig $out/lib/icinga2/prepare-dirs
|
||||||
|
|
||||||
|
# Fix hardcoded paths
|
||||||
|
sed -i 's:/usr/bin/::g' $out/etc/icinga2/scripts/*
|
||||||
|
|
||||||
|
# Cleanup sbin
|
||||||
|
sed -i 's/sbin/bin/g' $out/lib/icinga2/safe-reload
|
||||||
|
rm $out/sbin
|
||||||
|
|
||||||
|
${lib.optionalString withMysql ''
|
||||||
|
# Add dependencies of the MySQL shim to the shared library
|
||||||
|
patchelf --add-needed ${zlib.out}/lib/libz.so $(readlink -f $out/lib/icinga2/libmysql_shim.so)
|
||||||
|
|
||||||
|
# Make Icinga find the MySQL shim
|
||||||
|
icinga2Bin=$out/lib/icinga2/sbin/icinga2
|
||||||
|
patchelf --set-rpath $out/lib/icinga2:$(patchelf --print-rpath $icinga2Bin) $icinga2Bin
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
|
||||||
|
vim = stdenv.mkDerivation {
|
||||||
|
pname = "vim-icinga2";
|
||||||
|
inherit version src;
|
||||||
|
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/share/vim-plugins
|
||||||
|
cp -r tools/syntax/vim $out/share/vim-plugins/icinga2
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Open source monitoring system";
|
||||||
|
homepage = "https://www.icinga.com";
|
||||||
|
license = lib.licenses.gpl2Plus;
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
maintainers = with lib.maintainers; [ das_j ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/config.h.cmake b/config.h.cmake
|
||||||
|
index 16fa190..152bf43 100644
|
||||||
|
--- a/config.h.cmake
|
||||||
|
+++ b/config.h.cmake
|
||||||
|
@@ -13,7 +13,7 @@
|
||||||
|
|
||||||
|
#cmakedefine ICINGA2_UNITY_BUILD
|
||||||
|
|
||||||
|
-#define ICINGA_CONFIGDIR "${ICINGA2_FULL_CONFIGDIR}"
|
||||||
|
+#define ICINGA_CONFIGDIR "/etc/icinga2"
|
||||||
|
#define ICINGA_DATADIR "${ICINGA2_FULL_DATADIR}"
|
||||||
|
#define ICINGA_LOGDIR "${ICINGA2_FULL_LOGDIR}"
|
||||||
|
#define ICINGA_CACHEDIR "${ICINGA2_FULL_CACHEDIR}"
|
|
@ -0,0 +1,15 @@
|
||||||
|
diff --git a/etc/initsystem/CMakeLists.txt b/etc/initsystem/CMakeLists.txt
|
||||||
|
index e702c83..c23cabb 100644
|
||||||
|
--- a/etc/initsystem/CMakeLists.txt
|
||||||
|
+++ b/etc/initsystem/CMakeLists.txt
|
||||||
|
@@ -50,10 +50,5 @@ if(NOT WIN32)
|
||||||
|
|
||||||
|
if (USE_SYSTEMD OR INSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT)
|
||||||
|
configure_file(icinga2.service.cmake ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service @ONLY)
|
||||||
|
- install(
|
||||||
|
- FILES ${CMAKE_CURRENT_BINARY_DIR}/initsystem/icinga2.service
|
||||||
|
- DESTINATION ${DESTDIR}/usr/lib/systemd/system
|
||||||
|
- PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||||
|
- )
|
||||||
|
endif()
|
||||||
|
endif()
|
|
@ -0,0 +1,66 @@
|
||||||
|
diff --git a/icinga-app/CMakeLists.txt b/icinga-app/CMakeLists.txt
|
||||||
|
index 87993df..819c87b 100644
|
||||||
|
--- a/icinga-app/CMakeLists.txt
|
||||||
|
+++ b/icinga-app/CMakeLists.txt
|
||||||
|
@@ -106,7 +106,3 @@ install(
|
||||||
|
TARGETS icinga-app
|
||||||
|
RUNTIME DESTINATION ${InstallPath}
|
||||||
|
)
|
||||||
|
-
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_INITRUNDIR}\")")
|
||||||
|
diff --git a/lib/base/CMakeLists.txt b/lib/base/CMakeLists.txt
|
||||||
|
index 5dda179..22cf69f 100644
|
||||||
|
--- a/lib/base/CMakeLists.txt
|
||||||
|
+++ b/lib/base/CMakeLists.txt
|
||||||
|
@@ -125,7 +125,4 @@ set_target_properties (
|
||||||
|
FOLDER Lib
|
||||||
|
)
|
||||||
|
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_CACHEDIR}\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}/crash\")")
|
||||||
|
-
|
||||||
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
|
||||||
|
diff --git a/lib/perfdata/CMakeLists.txt b/lib/perfdata/CMakeLists.txt
|
||||||
|
index ab963f7..3d9d506 100644
|
||||||
|
--- a/lib/perfdata/CMakeLists.txt
|
||||||
|
+++ b/lib/perfdata/CMakeLists.txt
|
||||||
|
@@ -74,7 +74,4 @@ install_if_not_exists(
|
||||||
|
${ICINGA2_CONFIGDIR}/features-available
|
||||||
|
)
|
||||||
|
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_SPOOLDIR}/perfdata\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_SPOOLDIR}/tmp\")")
|
||||||
|
-
|
||||||
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
|
||||||
|
diff --git a/lib/remote/CMakeLists.txt b/lib/remote/CMakeLists.txt
|
||||||
|
index 65113d2..5e4398f 100644
|
||||||
|
--- a/lib/remote/CMakeLists.txt
|
||||||
|
+++ b/lib/remote/CMakeLists.txt
|
||||||
|
@@ -55,12 +55,3 @@ set_target_properties (
|
||||||
|
remote PROPERTIES
|
||||||
|
FOLDER Lib
|
||||||
|
)
|
||||||
|
-
|
||||||
|
-#install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api/log\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api/zones\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/api/zones-stage\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/certs\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_DATADIR}/certificate-requests\")")
|
||||||
|
-
|
||||||
|
-
|
||||||
|
diff --git a/lib/compat/CMakeLists.txt b/lib/compat/CMakeLists.txt
|
||||||
|
index 1438626..d882ae2 100644
|
||||||
|
--- a/lib/compat/CMakeLists.txt
|
||||||
|
+++ b/lib/compat/CMakeLists.txt
|
||||||
|
@@ -55,8 +55,4 @@ install_if_not_exists(
|
||||||
|
${ICINGA2_CONFIGDIR}/features-available
|
||||||
|
)
|
||||||
|
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_LOGDIR}/compat/archives\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_SPOOLDIR}\")")
|
||||||
|
-install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${ICINGA2_FULL_INITRUNDIR}/cmd\")")
|
||||||
|
-
|
||||||
|
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "${CPACK_NSIS_EXTRA_INSTALL_COMMANDS}" PARENT_SCOPE)
|
|
@ -19206,10 +19206,19 @@ in
|
||||||
|
|
||||||
miniflux = callPackage ../servers/miniflux { };
|
miniflux = callPackage ../servers/miniflux { };
|
||||||
|
|
||||||
nagios = callPackage ../servers/monitoring/nagios { };
|
icinga2 = callPackage ../servers/monitoring/icinga2 { };
|
||||||
|
|
||||||
|
icinga2-agent = callPackage ../servers/monitoring/icinga2 {
|
||||||
|
nameSuffix = "-agent";
|
||||||
|
withMysql = false;
|
||||||
|
withNotification = false;
|
||||||
|
withIcingadb = false;
|
||||||
|
};
|
||||||
|
|
||||||
munin = callPackage ../servers/monitoring/munin { };
|
munin = callPackage ../servers/monitoring/munin { };
|
||||||
|
|
||||||
|
nagios = callPackage ../servers/monitoring/nagios { };
|
||||||
|
|
||||||
monitoring-plugins = callPackage ../servers/monitoring/plugins { };
|
monitoring-plugins = callPackage ../servers/monitoring/plugins { };
|
||||||
|
|
||||||
inherit (callPackage ../servers/monitoring/plugins/labs_consol_de.nix { })
|
inherit (callPackage ../servers/monitoring/plugins/labs_consol_de.nix { })
|
||||||
|
|
Loading…
Reference in New Issue