Merge pull request #28025 from peterhoeg/p/checks
Shared monitoring plugins
This commit is contained in:
@@ -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 ];
|
||||
};
|
||||
}
|
||||
@@ -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 ];
|
||||
};
|
||||
}
|
||||
@@ -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.";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user