Merge pull request #28025 from peterhoeg/p/checks

Shared monitoring plugins
This commit is contained in:
Peter Hoeg 2017-08-17 19:56:56 +08:00 committed by GitHub
commit bd7bf67927
7 changed files with 235 additions and 37 deletions

View File

@ -0,0 +1,44 @@
{ stdenv, buildPythonPackage, fetchFromGitHub, libxml2
, m2crypto, ply, pyyaml, six
, httpretty, lxml, mock, pytest, requests
}:
buildPythonPackage rec {
name = "pywbem-${version}";
version = "0.10.0";
src = fetchFromGitHub {
owner = "pywbem";
repo = "pywbem";
rev = "v${version}";
sha256 = "0jcwklip03xcni0dvsk9va8ilqz21g4fxwqd5kzvv91slaadfcym";
};
propagatedBuildInputs = [ m2crypto ply pyyaml six ];
checkInputs = [ httpretty lxml mock pytest requests ];
# 1 test fails because it doesn't like running in our sandbox. Deleting the
# whole file is admittedly a little heavy-handed but at least the vast
# majority of tests are run.
checkPhase = ''
rm testsuite/testclient/networkerror.yaml
substituteInPlace makefile \
--replace "PYTHONPATH=." "" \
--replace '--cov $(package_name) --cov-config coveragerc' ""
for f in testsuite/test_cim_xml.py testsuite/validate.py ; do
substituteInPlace $f --replace "'xmllint" "'${stdenv.lib.getBin libxml2}/bin/xmllint"
done
make PATH=$PATH:${stdenv.lib.getBin libxml2}/bin test
'';
meta = with stdenv.lib; {
description = "Support for the WBEM standard for systems management.";
homepage = http://pywbem.github.io/pywbem/;
license = licenses.gpl2;
maintainers = with maintainers; [ peterhoeg ];
};
}

View File

@ -1,36 +0,0 @@
{ stdenv, fetchurl, openssh, openssl }:
stdenv.mkDerivation rec {
name = "nagios-plugins-${version}";
version = "2.2.0";
src = fetchurl {
url = "http://nagios-plugins.org/download/${name}.tar.gz";
sha256 = "074yia04py5y07sbgkvri10dv8nf41kqq1x6kmwqcix5vvm9qyy3";
};
# !!! 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= "
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'
)
";
postInstall = "ln -s libexec $out/bin";
# !!! make openssh a runtime dependency only
buildInputs = [ openssh openssl ];
meta = {
description = "Official plugins for Nagios";
homepage = http://www.nagios.org/download/plugins;
license = stdenv.lib.licenses.gpl2;
platforms = stdenv.lib.platforms.linux;
maintainers = with stdenv.lib.maintainers; [ thoughtpolice relrod ];
};
}

View File

@ -0,0 +1,71 @@
{ stdenv, fetchFromGitHub, autoreconfHook
, coreutils, gnugrep, gnused, lm_sensors, net_snmp, openssh, openssl, perl }:
with stdenv.lib;
let
majorVersion = "2.2";
minorVersion = ".0";
binPath = makeBinPath [ coreutils gnugrep gnused lm_sensors net_snmp ];
in stdenv.mkDerivation rec {
name = "monitoring-plugins-${majorVersion}${minorVersion}";
src = fetchFromGitHub {
owner = "monitoring-plugins";
repo = "monitoring-plugins";
rev = "v${majorVersion}";
sha256 = "1pw7i6d2cnb5nxi2lbkwps2qzz04j9zd86fzpv9ka896b4aqrwv1";
};
# !!! 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= ''
substituteInPlace po/Makefile.in.in \
--replace /bin/sh ${stdenv.shell}
sed -i configure.ac \
-e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"\$out/bin:/run/wrappers/bin:${binPath}\"|'
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'
)
'';
# !!! make openssh a runtime dependency only
buildInputs = [ net_snmp openssh openssl perl ];
nativeBuildInputs = [ autoreconfHook ];
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
#!${stdenv.shell}
exit 0
_EOF
chmod 755 $out/share
'';
postInstall = ''
rm $out/share
ln -s libexec $out/bin
'';
meta = {
description = "Official monitoring plugins for Nagios/Ichinga/Sensu and others.";
homepage = https://www.monitoring-plugins.org;
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ thoughtpolice relrod ];
};
}

View File

@ -0,0 +1,37 @@
{ stdenv, fetchFromGitHub, python2Packages }:
let
bName = "check_esxi_hardware";
pName = stdenv.lib.replaceStrings [ "_" ] [ "-" ] "${bName}";
in python2Packages.buildPythonApplication rec {
name = "${pName}-${version}";
version = "20161013";
src = fetchFromGitHub {
owner = "Napsty";
repo = bName;
rev = version;
sha256 = "19zybcg62dqcinixnp1p8zw916x3w7xvy6dlsmn347iigfa5s55s";
};
dontBuild = true;
doCheck = false;
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin ${bName}.py
install -Dm644 -t $out/share/doc/${pName} README.md
runHook postInstall
'';
propagatedBuildInputs = with python2Packages; [ pywbem ];
meta = with stdenv.lib; {
homepage = https://www.claudiokuenzler.com/nagios-plugins/;
license = licenses.gpl2;
maintainer = with maintainers; [ peterhoeg ];
};
}

View File

@ -0,0 +1,72 @@
{ stdenv, fetchFromGitHub, buildPerlPackage, autoreconfHook, makeWrapper
, perl, NetSNMP, coreutils, gnused, gnugrep }:
let
owner = "lausser";
glplugin = fetchFromGitHub {
repo = "GLPlugin";
rev = "b92a261ca4bf84e5b20d3025cc9a31ade03c474b";
sha256 = "0kflnmpjmklq8fy2vf2h8qyvaiznymdi09z2h5qscrfi51xc9gmh";
inherit owner;
};
generic = { pname, version, rev, sha256, description, ... } @ attrs:
let
attrs' = builtins.removeAttrs attrs [ "pname" "version" "rev" "sha256"];
in perl.stdenv.mkDerivation rec {
name = stdenv.lib.replaceStrings [ "-" ] [ "_" ] "${pname}-${version}";
src = fetchFromGitHub {
repo = pname;
inherit owner rev sha256;
};
buildInputs = [ perl NetSNMP ];
nativeBuildInputs = [ autoreconfHook makeWrapper ];
prePatch = with stdenv.lib; ''
ln -s ${glplugin}/* GLPlugin
substituteInPlace plugins-scripts/Makefile.am \
--replace /bin/cat ${getBin coreutils}/bin/cat \
--replace /bin/echo ${getBin coreutils}/bin/echo \
--replace /bin/grep ${getBin gnugrep}/bin/grep \
--replace /bin/sed ${getBin gnused}/bin/sed
'';
postInstall = ''
test -d $out/libexec && ln -sr $out/libexec $out/bin
'';
postFixup = ''
for f in $out/bin/* ; do
wrapProgram $f --prefix PERL5LIB : $PERL5LIB
done
'';
meta = with stdenv.lib; {
homepage = https://labs.consol.de/;
license = licenses.gpl2;
maintainer = with maintainers; [ peterhoeg ];
inherit description;
};
};
in {
check-nwc-health = generic {
pname = "check_nwc_health";
version = "20170804";
rev = "e959b412b5cf027c82a446668e026214fdcf8df3";
sha256 = "11l74xw62g15rqrbf9ff2bfd5iw159gwhhgbkxwdqi8sp9j6navk";
description = "Check plugin for network equipment.";
};
check-ups-health = generic {
pname = "check_ups_health";
version = "20170804";
rev = "32a8a359ea46ec0d6f3b7aea19ddedaad63b04b9";
sha256 = "05na48dxfxrg0i9185j1ck2795p0rw1zwcs8ra0f14cm0qw0lp4l";
description = "Check plugin for UPSs.";
};
}

View File

@ -11365,12 +11365,19 @@ with pkgs;
munin = callPackage ../servers/monitoring/munin { };
nagiosPluginsOfficial = callPackage ../servers/monitoring/nagios/plugins/official-2.x.nix { };
monitoring-plugins = callPackage ../servers/monitoring/plugins { };
nagiosPluginsOfficial = monitoring-plugins;
inherit (callPackage ../servers/monitoring/plugins/labs_consol_de.nix { inherit (perlPackages) NetSNMP; })
check-nwc-health
check-ups-health;
checkSSLCert = callPackage ../servers/monitoring/nagios/plugins/check_ssl_cert.nix { };
neo4j = callPackage ../servers/nosql/neo4j { };
check-esxi-hardware = callPackage ../servers/monitoring/plugins/esxi.nix {};
net_snmp = callPackage ../servers/monitoring/net-snmp {
# https://sourceforge.net/p/net-snmp/bugs/2712/
# remove after net-snmp > 5.7.3

View File

@ -28588,6 +28588,9 @@ EOF
};
};
# We need "normal" libxml2 and not the python package by the same name.
pywbem = callPackage ../development/python-modules/pywbem { libxml2 = pkgs.libxml2; };
unicorn = buildPythonPackage rec {
name = "unicorn-${version}";
version = "1.0.1";