From 17eabf477b035ff4590640ebdfd69ca558437c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 17 Jul 2019 11:33:57 +0200 Subject: Add monitoring modules via naemon --- pkgs/default.nix | 4 ++++ pkgs/monitoring-plugins/default.nix | 33 ++++++++++++++++++++++++++ pkgs/naemon-livestatus/default.nix | 23 ++++++++++++++++++ pkgs/naemon-livestatus/naemon-livestatus.json | 15 ++++++++++++ pkgs/naemon/default.nix | 34 +++++++++++++++++++++++++++ pkgs/naemon/naemon.json | 15 ++++++++++++ 6 files changed, 124 insertions(+) create mode 100644 pkgs/monitoring-plugins/default.nix create mode 100644 pkgs/naemon-livestatus/default.nix create mode 100644 pkgs/naemon-livestatus/naemon-livestatus.json create mode 100644 pkgs/naemon/default.nix create mode 100644 pkgs/naemon/naemon.json (limited to 'pkgs') diff --git a/pkgs/default.nix b/pkgs/default.nix index ff9d477b..49495730 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -42,6 +42,10 @@ rec { composerEnv = callPackage ./composer-env {}; webapps = callPackage ./webapps { inherit mylibs composerEnv private; }; + monitoring-plugins = callPackage ./monitoring-plugins {}; + naemon = callPackage ./naemon { inherit mylibs monitoring-plugins; }; + naemon-livestatus = callPackage ./naemon-livestatus { inherit mylibs naemon; }; + private = if builtins.pathExists (./. + "/private") then import ./private { inherit pkgs; } else { webapps = {}; }; diff --git a/pkgs/monitoring-plugins/default.nix b/pkgs/monitoring-plugins/default.nix new file mode 100644 index 00000000..852d29bf --- /dev/null +++ b/pkgs/monitoring-plugins/default.nix @@ -0,0 +1,33 @@ +{ stdenv, iputils, fetchpatch, fetchurl, file, hostname, perl, openssl, + bind, openldap, procps-ng, postfix, + wrapperDir ? "/run/wrappers/bin" +}: +stdenv.mkDerivation rec { + pname = "monitoring-plugins"; + version = "2.2"; + name = "${pname}-${version}"; + + src = fetchurl { + url = "https://www.monitoring-plugins.org/download/${name}.tar.gz"; + sha256 = "0r9nvnk64nv7k8w352n99lw4p92pycxd9wlga9zyzjx9027m6si9"; + }; + + patches = [ + (fetchpatch { + name = "mariadb.patch"; + url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/0001-mariadb.patch?h=packages/monitoring-plugins"; + sha256 = "0jf6fqkyzag66rid92m7asnr2dp8rr8kn4zjvhqg0mqvf8imppky"; + }) + ]; + + # ping needs CAP_NET_RAW capability which is set only in the wrappers namespace + configurePhase = '' + ./configure --disable-static --disable-dependency-tracking \ + --prefix=$out \ + --with-ping-command="${wrapperDir}/ping -4 -n -U -w %d -c %d %s" \ + --with-ping6-command="${wrapperDir}/ping -6 -n -U -w %d -c %d %s" \ + --with-sudo-command="${wrapperDir}/sudo" + ''; + + buildInputs = [ perl file hostname iputils openssl openldap procps-ng bind.dnsutils postfix ]; +} diff --git a/pkgs/naemon-livestatus/default.nix b/pkgs/naemon-livestatus/default.nix new file mode 100644 index 00000000..46ef51ac --- /dev/null +++ b/pkgs/naemon-livestatus/default.nix @@ -0,0 +1,23 @@ +{ stdenv, mylibs, autoconf, automake, + libtool, pkg-config, naemon, + varDir ? "/var/lib/naemon", + etcDir ? "/etc/naemon" +}: +stdenv.mkDerivation (mylibs.fetchedGithub ./naemon-livestatus.json // { + preConfigure = '' + ./autogen.sh || true + ''; + + configureFlags = [ + "--localstatedir=${varDir}" + "--sysconfdir=${etcDir}" + ]; + + preInstall = '' + substituteInPlace Makefile --replace \ + '@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am' \ + '@$(MAKE) $(AM_MAKEFLAGS) install-exec-am' + ''; + + buildInputs = [ autoconf automake libtool pkg-config naemon ]; +}) diff --git a/pkgs/naemon-livestatus/naemon-livestatus.json b/pkgs/naemon-livestatus/naemon-livestatus.json new file mode 100644 index 00000000..c648d2bb --- /dev/null +++ b/pkgs/naemon-livestatus/naemon-livestatus.json @@ -0,0 +1,15 @@ +{ + "tag": "33dbcfe-master", + "meta": { + "name": "naemon-livestatus", + "url": "https://github.com/naemon/naemon-livestatus", + "branch": "master" + }, + "github": { + "owner": "naemon", + "repo": "naemon-livestatus", + "rev": "33dbcfe18e42158f25c27cff95a1e07b73be53b0", + "sha256": "16jk0c6pwr7ck0g6s12hj6czbhgdr7c7f74zzsp5279af86y8fd6", + "fetchSubmodules": true + } +} diff --git a/pkgs/naemon/default.nix b/pkgs/naemon/default.nix new file mode 100644 index 00000000..080a226d --- /dev/null +++ b/pkgs/naemon/default.nix @@ -0,0 +1,34 @@ +{ stdenv, mylibs, help2man, monitoring-plugins, autoconf, automake, + libtool, glib, pkg-config, gperf, + varDir ? "/var/lib/naemon", + etcDir ? "/etc/naemon", + cacheDir ? "/var/cache/naemon", + logDir ? "/var/log/naemon", + runDir ? "/run/naemon", + user ? "naemon", + group ? "naemon" +}: +stdenv.mkDerivation (mylibs.fetchedGithub ./naemon.json // { + preConfigure = '' + ./autogen.sh || true + ''; + + configureFlags = [ + "--localstatedir=${varDir}" + "--sysconfdir=${etcDir}" + "--with-pkgconfdir=${etcDir}" + "--with-pluginsdir=${monitoring-plugins}/libexec" + "--with-tempdir=${cacheDir}" + "--with-checkresultdir=${cacheDir}/checkresults" + "--with-logdir=${logDir}" + "--with-naemon-user=${user}" + "--with-naemon-group=${group}" + "--with-lockfile=${runDir}/naemon.pid" + ]; + + preInstall = '' + substituteInPlace Makefile --replace '$(MAKE) $(AM_MAKEFLAGS) install-exec-hook' "" + ''; + + buildInputs = [ autoconf automake help2man libtool glib pkg-config gperf ]; +}) diff --git a/pkgs/naemon/naemon.json b/pkgs/naemon/naemon.json new file mode 100644 index 00000000..c68647f6 --- /dev/null +++ b/pkgs/naemon/naemon.json @@ -0,0 +1,15 @@ +{ + "tag": "ba6fd20-master", + "meta": { + "name": "naemon", + "url": "https://github.com/naemon/naemon-core", + "branch": "master" + }, + "github": { + "owner": "naemon", + "repo": "naemon-core", + "rev": "ba6fd20221fbdd5c99b4eb5dcf4ee5681c5a9495", + "sha256": "15rvqg985nn05rsgkch4ix8y2wg7a6pb70d63ckzy1inwqjp8z46", + "fetchSubmodules": true + } +} -- cgit v1.2.3