diff options
Diffstat (limited to 'nixpkgs/pkgs/servers/monitoring/plugins')
8 files changed, 451 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/default.nix b/nixpkgs/pkgs/servers/monitoring/plugins/default.nix new file mode 100644 index 000000000000..ae0db59d0b32 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/default.nix @@ -0,0 +1,123 @@ +{ lib +, stdenv +, fetchFromGitHub +, fetchpatch +, autoreconfHook +, pkg-config +, runCommand +, coreutils +, gnugrep +, gnused +, lm_sensors +, net-snmp +, openssh +, openssl +, perl +, dnsutils +, libdbi +, libmysqlclient +, uriparser +, zlib +, openldap +, procps +, runtimeShell +, unixtools +}: + +let + binPath = lib.makeBinPath [ + (placeholder "out") + "/run/wrappers" + 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 rec { + pname = "monitoring-plugins"; + version = "2.3.5"; + + src = fetchFromGitHub { + owner = "monitoring-plugins"; + repo = "monitoring-plugins"; + rev = "v${version}"; + sha256 = "sha256-J9fzlxIpujoG7diSRscFhmEV9HpBOxFTJSmGGFjAzcM="; + }; + + patches = [ + # fix build (makefile cannot produce -lcrypto) + # remove on next release + (fetchpatch { + url = "https://github.com/monitoring-plugins/monitoring-plugins/commit/bad156676894a2755c8b76519a11cdd2037e5cd6.patch"; + hash = "sha256-aI/sX04KXe968SwdS8ZamNtgdNbHtho5cDsDaA+cjZY="; + }) + # fix check_smtp with --starttls https://github.com/monitoring-plugins/monitoring-plugins/pull/1952 + # remove on next release + (fetchpatch { + url = "https://github.com/monitoring-plugins/monitoring-plugins/commit/2eea6bb2a04bbfb169bac5f0f7c319f998e8ab87.patch"; + hash = "sha256-CyVD340+zOxuxRRPmtowD3DFFRB1Q7+AANzul9HqwBI="; + }) + ]; + + # TODO: Awful hack. Grrr... + # 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). + # + # --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 ${runtimeShell} + + sed -i configure.ac \ + -e 's|^DEFAULT_PATH=.*|DEFAULT_PATH=\"${binPath}\"|' + + configureFlagsArray+=( + --with-ping-command='${lib.getBin unixtools.ping}/bin/ping -4 -n -U -w %d -c %d %s' + --with-ping6-command='${lib.getBin unixtools.ping}/bin/ping -6 -n -U -w %d -c %d %s' + ) + ''; + + 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 pkg-config ]; + + enableParallelBuilding = true; + + 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/nixpkgs/pkgs/servers/monitoring/plugins/esxi.nix b/nixpkgs/pkgs/servers/monitoring/plugins/esxi.nix new file mode 100644 index 000000000000..ccd77548c0c0 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/esxi.nix @@ -0,0 +1,37 @@ +{ lib, fetchFromGitHub, python3Packages }: + +let + bName = "check_esxi_hardware"; + +in python3Packages.buildPythonApplication rec { + pname = lib.replaceStrings [ "_" ] [ "-" ] bName; + version = "20200710"; + format = "other"; + + src = fetchFromGitHub { + owner = "Napsty"; + repo = bName; + rev = version; + sha256 = "EC6np/01S+5SA2H9z5psJ9Pq/YoEyGdHL9wHUKKsNas="; + }; + + dontBuild = true; + doCheck = false; + + installPhase = '' + runHook preInstall + + install -Dm755 ${bName}.py $out/bin/${bName} + install -Dm644 -t $out/share/doc/${pname} README.md + + runHook postInstall + ''; + + propagatedBuildInputs = with python3Packages; [ pywbem requests setuptools ]; + + meta = with lib; { + homepage = "https://www.claudiokuenzler.com/nagios-plugins/"; + license = licenses.gpl2; + maintainers = with maintainers; [ peterhoeg ]; + }; +} diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/labs_consol_de.nix b/nixpkgs/pkgs/servers/monitoring/plugins/labs_consol_de.nix new file mode 100644 index 000000000000..c293a4daa215 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/labs_consol_de.nix @@ -0,0 +1,77 @@ +{ lib, stdenv, fetchFromGitHub, fetchurl, autoreconfHook, makeWrapper +, perlPackages, coreutils, gnused, gnugrep }: + +let + glplugin = fetchFromGitHub { + owner = "lausser"; + repo = "GLPlugin"; + rev = "ef3107f01afe55fad5452e64ac5bbea00b18a8d5"; + sha256 = "047fwrycsl2vmpi4wl46fs6f8y191d6qc9ms5rvmrj1dm2r828ws"; + }; + + generic = { pname, version, sha256, description, buildInputs, ... }: + stdenv.mkDerivation { + inherit pname version; + + src = fetchurl { + url = "https://labs.consol.de/assets/downloads/nagios/${pname}-${version}.tar.gz"; + inherit sha256; + }; + + buildInputs = [ perlPackages.perl ] ++ buildInputs; + + nativeBuildInputs = [ autoreconfHook makeWrapper ]; + + prePatch = with lib; '' + rm -rf GLPlugin + 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 lib; { + homepage = "https://labs.consol.de/"; + license = licenses.gpl2; + maintainers = with maintainers; [ peterhoeg ]; + inherit description; + }; + }; + +in { + check-mssql-health = generic { + pname = "check_mssql_health"; + version = "2.6.4.15"; + sha256 = "12z0b3c2p18viy7s93r6bbl8fvgsqh80136d07118qhxshp1pwxg"; + description = "Check plugin for Microsoft SQL Server"; + buildInputs = [ perlPackages.DBDsybase ]; + }; + + check-nwc-health = generic { + pname = "check_nwc_health"; + version = "7.10.0.6"; + sha256 = "092rhaqnk3403z0y60x38vgh65gcia3wrd6gp8mr7wszja38kxv2"; + description = "Check plugin for network equipment"; + buildInputs = [ perlPackages.NetSNMP ]; + }; + + check-ups-health = generic { + pname = "check_ups_health"; + version = "2.8.3.3"; + sha256 = "0qc2aglppwr9ms4p53kh9nr48625sqrbn46xs0k9rx5sv8hil9hm"; + description = "Check plugin for UPSs"; + buildInputs = [ perlPackages.NetSNMP ]; + }; +} diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/openvpn.nix b/nixpkgs/pkgs/servers/monitoring/plugins/openvpn.nix new file mode 100644 index 000000000000..3ae474d6d9e8 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/openvpn.nix @@ -0,0 +1,23 @@ +{ lib, fetchFromGitHub, python3Packages }: + +python3Packages.buildPythonApplication rec { + pname = "check-openvpn"; + version = "0.0.1"; + + src = fetchFromGitHub { + owner = "liquidat"; + repo = "nagios-icinga-openvpn"; + rev = version; + sha256 = "1vz3p7nckc5k5f06nm1xfzpykhyndh2dzyagmifrzg5k478p1lpm"; + }; + + # no tests + doCheck = false; + + meta = with lib; { + description = "A nagios/icinga/sensu check plugin for OpenVPN"; + mainProgram = "check_openvpn"; + license = licenses.mit; + maintainers = with maintainers; [ peterhoeg ]; + }; +} diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/uptime.nix b/nixpkgs/pkgs/servers/monitoring/plugins/uptime.nix new file mode 100644 index 000000000000..04a3ba18aa79 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/uptime.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook }: + +stdenv.mkDerivation { + pname = "check-uptime"; + version = "20161112"; + + src = fetchFromGitHub { + owner = "madrisan"; + repo = "nagios-plugins-uptime"; + rev = "51822dacd1d404b3eabf3b4984c64b2475ed6f3b"; + sha256 = "18q9ibzqn97dsyr9xs3w9mqk80nmmfw3kcjidrdsj542amlsycyk"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + + enableParallelBuilding = true; + + postInstall = "ln -sr $out/libexec $out/bin"; + + meta = with lib; { + description = "Uptime check plugin for Sensu/Nagios/others"; + homepage = "https://github.com/madrisan/nagios-plugins-uptime"; + license = licenses.gpl3; + maintainers = with maintainers; [ peterhoeg ]; + }; +} diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/wmic-bin.nix b/nixpkgs/pkgs/servers/monitoring/plugins/wmic-bin.nix new file mode 100644 index 000000000000..64cf171afea1 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/wmic-bin.nix @@ -0,0 +1,48 @@ +{ stdenv, lib, fetchFromGitHub, autoPatchelfHook, popt, libxcrypt-legacy }: + +stdenv.mkDerivation rec { + pname = "wmic-bin"; + version = "0.5.0"; + + src = fetchFromGitHub { + owner = "R-Vision"; + repo = "wmi-client"; + rev = version; + sha256 = "1w1mdbiwz37wzry1q38h8dyjaa6iggmsb9wcyhhlawwm1vj50w48"; + }; + + buildInputs = [ popt libxcrypt-legacy ]; + + nativeBuildInputs = [ autoPatchelfHook ]; + + dontConfigure = true; + dontBuild = true; + doInstallCheck = true; + + installPhase = '' + runHook preInstall + + install -Dm755 bin/wmic_ubuntu_x64 $out/bin/wmic + install -Dm644 -t $out/share/doc/wmic LICENSE README.md + + runHook postInstall + ''; + + installCheckPhase = '' + runHook preInstallCheck + + $out/bin/wmic --help >/dev/null + + runHook postInstallCheck + ''; + + meta = with lib; { + description = "WMI client for Linux (binary)"; + mainProgram = "wmic"; + homepage = "https://www.openvas.org"; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.mit; + maintainers = with maintainers; [ peterhoeg ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/wmiplus/default.nix b/nixpkgs/pkgs/servers/monitoring/plugins/wmiplus/default.nix new file mode 100644 index 000000000000..00474e12b9ac --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/wmiplus/default.nix @@ -0,0 +1,77 @@ +{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages, txt2man +, monitoring-plugins +, wmic-bin ? null }: + +stdenv.mkDerivation rec { + pname = "check-wmiplus"; + version = "1.65"; + + # We fetch from github.com instead of the proper upstream as nix-build errors + # out with 406 when trying to fetch the sources + src = fetchFromGitHub { + owner = "speartail"; + repo = "checkwmiplus"; + rev = "v${version}"; + sha256 = "1as0iyhy4flpm37mb7lvah7rnd6ax88appjm1icwhy7iq03wi8pl"; + }; + + patches = [ + ./wmiplus_fix_manpage.patch + ]; + + propagatedBuildInputs = with perlPackages; [ + BHooksEndOfScope ClassDataInheritable ClassInspector ClassSingleton + ConfigIniFiles DateTime DateTimeLocale DateTimeTimeZone DevelStackTrace + EvalClosure ExceptionClass FileShareDir ModuleImplementation ModuleRuntime + MROCompat namespaceautoclean namespaceclean NumberFormat PackageStash + ParamsValidate ParamsValidationCompiler RoleTiny Specio + SubExporterProgressive SubIdentify TryTiny + ]; + + nativeBuildInputs = [ makeWrapper txt2man ]; + + dontConfigure = true; + dontBuild = true; + doCheck = false; # no checks + + postPatch = '' + substituteInPlace check_wmi_plus.pl \ + --replace /usr/bin/wmic ${wmic-bin}/bin/wmic \ + --replace /etc/check_wmi_plus $out/etc/check_wmi_plus \ + --replace /opt/nagios/bin/plugins $out/etc/check_wmi_plus \ + --replace /usr/lib/nagios/plugins ${monitoring-plugins}/libexec \ + --replace '$base_dir/check_wmi_plus_help.pl' "$out/bin/check_wmi_plus_help.pl" + + for f in *.pl ; do + substituteInPlace $f --replace /usr/bin/perl ${perlPackages.perl}/bin/perl + done + ''; + + installPhase = '' + runHook preInstall + + install -Dm755 -t $out/bin *.pl + install -Dm644 -t $out/share/doc/${pname} *.txt + cp -r etc $out/ + + runHook postInstall + ''; + + # 1. we need to wait until the main binary has been fixed up with proper perl paths before we can run it to generate the man page + # 2. txt2man returns exit code 3 even if it works, so we add the || true bit + postFixup = '' + wrapProgram $out/bin/check_wmi_plus.pl \ + --set PERL5LIB "${perlPackages.makePerlPath propagatedBuildInputs}" + + mkdir -p $out/share/man/man1 + $out/bin/check_wmi_plus.pl --help | txt2man -d 1970-01-01 -s 1 -t check_wmi_plus -r "Check WMI Plus ${version}" > $out/share/man/man1/check_wmi_plus.1 || true + gzip $out/share/man/man1/check_wmi_plus.1 + ''; + + meta = with lib; { + description = "A sensu/nagios plugin using WMI to query Windows hosts"; + homepage = "http://edcint.co.nz/checkwmiplus"; + license = licenses.gpl2; + maintainers = with maintainers; [ peterhoeg ]; + }; +} diff --git a/nixpkgs/pkgs/servers/monitoring/plugins/wmiplus/wmiplus_fix_manpage.patch b/nixpkgs/pkgs/servers/monitoring/plugins/wmiplus/wmiplus_fix_manpage.patch new file mode 100644 index 000000000000..16e81d1014d2 --- /dev/null +++ b/nixpkgs/pkgs/servers/monitoring/plugins/wmiplus/wmiplus_fix_manpage.patch @@ -0,0 +1,40 @@ +diff --git a/check_wmi_plus.makeman.sh b/check_wmi_plus.makeman.sh +index 38dc7a4..3fe4369 100755 +--- a/check_wmi_plus.makeman.sh ++++ b/check_wmi_plus.makeman.sh +@@ -19,15 +19,6 @@ mkdir -p "$manpage_dir/man1" + # the full path to the manpage file + manfile="$manpage_dir/man1/check_wmi_plus.1" + +-# if we are not running in a terminal then only show the text-based help +-if [ ! -t 0 ]; then +- # we are not running in a terminal +- echo "Not running in a terminal - showing text-based help" +- echo +- exec $check_wmi_plus_text_help +-fi +- +- + usage() + { + cat << EOT +diff --git a/check_wmi_plus_help.pl b/check_wmi_plus_help.pl +index 3440db2..2982da2 100755 +--- a/check_wmi_plus_help.pl ++++ b/check_wmi_plus_help.pl +@@ -24,7 +24,7 @@ if ($opt_help) { + # we have the script to make the manpage and have not been asked to show text only help + exec ("$make_manpage_script \"$0 --itexthelp\" \"$manpage_dir\"") or print STDERR "couldn't exec $make_manpage_script: $!"; + } else { +- print "Warning: Can not access/execute Manpage script ($make_manpage_script).\nShowing help in text-only format.\n\n"; ++ # print "Warning: Can not access/execute Manpage script ($make_manpage_script).\nShowing help in text-only format.\n\n"; + } + } + +@@ -692,4 +692,4 @@ show_ini_help_overview(1); + finish_program($ERRORS{'UNKNOWN'}); + } + +-1; +\ No newline at end of file ++1; |