summary refs log tree commit diff
path: root/pkgs/servers/monitoring/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/monitoring/plugins')
-rw-r--r--pkgs/servers/monitoring/plugins/default.nix142
-rw-r--r--pkgs/servers/monitoring/plugins/esxi.nix19
-rw-r--r--pkgs/servers/monitoring/plugins/labs_consol_de.nix12
-rw-r--r--pkgs/servers/monitoring/plugins/uptime.nix4
-rw-r--r--pkgs/servers/monitoring/plugins/wmic-bin.nix2
-rw-r--r--pkgs/servers/monitoring/plugins/wmiplus/default.nix4
6 files changed, 108 insertions, 75 deletions
diff --git a/pkgs/servers/monitoring/plugins/default.nix b/pkgs/servers/monitoring/plugins/default.nix
index 8f1c08bebd8..c7823789081 100644
--- a/pkgs/servers/monitoring/plugins/default.nix
+++ b/pkgs/servers/monitoring/plugins/default.nix
@@ -1,86 +1,120 @@
-{ stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, runCommand
-, coreutils, gnugrep, gnused, lm_sensors, net-snmp, openssh, openssl, perl
-, dnsutils, libdbi, libmysqlclient, zlib, openldap, procps
-, runtimeShell }:
-
-with stdenv.lib;
+{ 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
-  majorVersion = "2.2";
-  minorVersion = ".0";
+  binPath = lib.makeBinPath [
+    (placeholder "out")
+    "/run/wrappers"
+    coreutils
+    gnugrep
+    gnused
+    lm_sensors
+    net-snmp
+    procps
+  ];
 
-  binPath = makeBinPath [ coreutils gnugrep gnused lm_sensors net-snmp procps ];
+  mailq = runCommand "mailq-wrapper" { preferLocalBuild = true; } ''
+    mkdir -p $out/bin
+    ln -s /run/wrappers/bin/sendmail $out/bin/mailq
+  '';
 
-in stdenv.mkDerivation {
-  name = "monitoring-plugins-${majorVersion}${minorVersion}";
+  # 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 {
-    owner  = "monitoring-plugins";
-    repo   = "monitoring-plugins";
-    rev    = "v${majorVersion}";
-    sha256 = "1pw7i6d2cnb5nxi2lbkwps2qzz04j9zd86fzpv9ka896b4aqrwv1";
+    owner = "monitoring-plugins";
+    repo = "monitoring-plugins";
+    rev = "v" + lib.versions.majorMinor version;
+    sha256 = "sha256-yLhHOSrPFRjW701aOL8LPe4OnuJxL6f+dTxNqm0evIg=";
   };
 
-  patches = [
-    # https://github.com/monitoring-plugins/monitoring-plugins/issues/1508
-    (fetchpatch {
-      url = "https://github.com/monitoring-plugins/monitoring-plugins/commit/ac0437ff896ba9ce2549b2d2ec3de146a886f08a.patch";
-      sha256 = "0jf6fqkyzag66rid92m7asnr2dp8rr8kn4zjvhqg0mqvf8imppky";
-    })
-  ];
-
-  # !!! Awful hack. Grrr... this of course only works on NixOS.
+  # 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).
-  preConfigure= ''
+  #
+  # --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 \
-      --replace /bin/sh ${stdenv.shell}
+      --replace /bin/sh ${runtimeShell}
 
     sed -i configure.ac \
-      -e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"\$out/bin:/run/wrappers/bin:${binPath}\"|'
+      -e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"${binPath}\"|'
 
-    configureFlagsArray=(
+    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'
-      --with-sudo-command='/run/wrappers/bin/sudo'
-      --with-mailq-command='${runCommand "mailq-wrapper" {preferLocalBuild=true;} ''
-        mkdir -p $out/bin
-        ln -s /run/wrappers/bin/sendmail $out/bin/mailq
-        ''}/bin/mailq'
     )
+
+    install -Dm555 ${share} $out/share
   '';
 
-  # !!! make openssh a runtime dependency only
-  buildInputs = [ dnsutils libdbi libmysqlclient net-snmp openldap openssh openssl perl procps zlib ];
+  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
+  ];
 
-  nativeBuildInputs = [ autoreconfHook ];
+  nativeBuildInputs = [ autoreconfHook pkg-config ];
 
   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
-#!${runtimeShell}
-exit 0
-_EOF
-    chmod 755 $out/share
-  '';
-
   postInstall = ''
     rm $out/share
-    ln -s libexec $out/bin
   '';
 
-  meta = {
-    description = "Official monitoring plugins for Nagios/Icinga/Sensu and others.";
-    homepage    = "https://www.monitoring-plugins.org";
-    license     = licenses.gpl2;
-    platforms   = platforms.linux;
+  meta = with lib; {
+    description = "Official monitoring plugins for Nagios/Icinga/Sensu and others";
+    homepage = "https://www.monitoring-plugins.org";
+    license = licenses.gpl3Only;
     maintainers = with maintainers; [ thoughtpolice relrod ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/servers/monitoring/plugins/esxi.nix b/pkgs/servers/monitoring/plugins/esxi.nix
index 897d6395f95..1ca9e702e7a 100644
--- a/pkgs/servers/monitoring/plugins/esxi.nix
+++ b/pkgs/servers/monitoring/plugins/esxi.nix
@@ -1,18 +1,17 @@
-{ stdenv, fetchFromGitHub, python2Packages }:
+{ lib, fetchFromGitHub, python3Packages }:
 
 let
   bName = "check_esxi_hardware";
-  pName = stdenv.lib.replaceStrings [ "_" ] [ "-" ] bName;
 
-in python2Packages.buildPythonApplication rec {
-  name = "${pName}-${version}";
-  version = "20181001";
+in python3Packages.buildPythonApplication rec {
+  pname = lib.replaceStrings [ "_" ] [ "-" ] bName;
+  version = "20200710";
 
   src = fetchFromGitHub {
     owner  = "Napsty";
     repo   = bName;
     rev    = version;
-    sha256 = "0azfacxcnnxxfqzrhh29k8cnjyr88gz35bi6h8fq931fl3plv10l";
+    sha256 = "EC6np/01S+5SA2H9z5psJ9Pq/YoEyGdHL9wHUKKsNas=";
   };
 
   dontBuild = true;
@@ -21,15 +20,15 @@ in python2Packages.buildPythonApplication rec {
   installPhase = ''
     runHook preInstall
 
-    install -Dm755 -t $out/bin                ${bName}.py
-    install -Dm644 -t $out/share/doc/${pName} README.md
+    install -Dm755 ${bName}.py $out/bin/${bName}
+    install -Dm644 -t $out/share/doc/${pname} README.md
 
     runHook postInstall
   '';
 
-  propagatedBuildInputs = with python2Packages; [ pywbem ];
+  propagatedBuildInputs = with python3Packages; [ pywbem requests setuptools ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "https://www.claudiokuenzler.com/nagios-plugins/";
     license = licenses.gpl2;
     maintainers = with maintainers; [ peterhoeg ];
diff --git a/pkgs/servers/monitoring/plugins/labs_consol_de.nix b/pkgs/servers/monitoring/plugins/labs_consol_de.nix
index 8464d4f1b2f..c293a4daa21 100644
--- a/pkgs/servers/monitoring/plugins/labs_consol_de.nix
+++ b/pkgs/servers/monitoring/plugins/labs_consol_de.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fetchurl, autoreconfHook, makeWrapper
+{ lib, stdenv, fetchFromGitHub, fetchurl, autoreconfHook, makeWrapper
 , perlPackages, coreutils, gnused, gnugrep }:
 
 let
@@ -22,7 +22,7 @@ let
 
     nativeBuildInputs = [ autoreconfHook makeWrapper ];
 
-    prePatch = with stdenv.lib; ''
+    prePatch = with lib; ''
       rm -rf GLPlugin
       ln -s ${glplugin} GLPlugin
       substituteInPlace plugins-scripts/Makefile.am \
@@ -42,7 +42,7 @@ let
       done
     '';
 
-    meta = with stdenv.lib; {
+    meta = with lib; {
       homepage    = "https://labs.consol.de/";
       license     = licenses.gpl2;
       maintainers = with maintainers; [ peterhoeg ];
@@ -55,7 +55,7 @@ in {
     pname       = "check_mssql_health";
     version     = "2.6.4.15";
     sha256      = "12z0b3c2p18viy7s93r6bbl8fvgsqh80136d07118qhxshp1pwxg";
-    description = "Check plugin for Microsoft SQL Server.";
+    description = "Check plugin for Microsoft SQL Server";
     buildInputs = [ perlPackages.DBDsybase ];
   };
 
@@ -63,7 +63,7 @@ in {
     pname       = "check_nwc_health";
     version     = "7.10.0.6";
     sha256      = "092rhaqnk3403z0y60x38vgh65gcia3wrd6gp8mr7wszja38kxv2";
-    description = "Check plugin for network equipment.";
+    description = "Check plugin for network equipment";
     buildInputs = [ perlPackages.NetSNMP ];
   };
 
@@ -71,7 +71,7 @@ in {
     pname       = "check_ups_health";
     version     = "2.8.3.3";
     sha256      = "0qc2aglppwr9ms4p53kh9nr48625sqrbn46xs0k9rx5sv8hil9hm";
-    description = "Check plugin for UPSs.";
+    description = "Check plugin for UPSs";
     buildInputs = [ perlPackages.NetSNMP ];
   };
 }
diff --git a/pkgs/servers/monitoring/plugins/uptime.nix b/pkgs/servers/monitoring/plugins/uptime.nix
index d4861309fe5..04a3ba18aa7 100644
--- a/pkgs/servers/monitoring/plugins/uptime.nix
+++ b/pkgs/servers/monitoring/plugins/uptime.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
 
 stdenv.mkDerivation {
   pname = "check-uptime";
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
 
   postInstall = "ln -sr $out/libexec $out/bin";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Uptime check plugin for Sensu/Nagios/others";
     homepage    = "https://github.com/madrisan/nagios-plugins-uptime";
     license     = licenses.gpl3;
diff --git a/pkgs/servers/monitoring/plugins/wmic-bin.nix b/pkgs/servers/monitoring/plugins/wmic-bin.nix
index c8f4eb77c46..e091727e48e 100644
--- a/pkgs/servers/monitoring/plugins/wmic-bin.nix
+++ b/pkgs/servers/monitoring/plugins/wmic-bin.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     runHook postInstallCheck
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "WMI client for Linux (binary)";
     homepage    = "https://www.openvas.org";
     license     = licenses.mit;
diff --git a/pkgs/servers/monitoring/plugins/wmiplus/default.nix b/pkgs/servers/monitoring/plugins/wmiplus/default.nix
index dacd4e2c5b7..00474e12b9a 100644
--- a/pkgs/servers/monitoring/plugins/wmiplus/default.nix
+++ b/pkgs/servers/monitoring/plugins/wmiplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, makeWrapper, perlPackages, txt2man
+{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages, txt2man
 , monitoring-plugins
 , wmic-bin ? null }:
 
@@ -68,7 +68,7 @@ stdenv.mkDerivation rec {
     gzip $out/share/man/man1/check_wmi_plus.1
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A sensu/nagios plugin using WMI to query Windows hosts";
     homepage = "http://edcint.co.nz/checkwmiplus";
     license = licenses.gpl2;