Unverified Commit 2c2b5ef9 authored by Anthony Roussel's avatar Anthony Roussel Committed by GitHub
Browse files

nagiosPlugins: init from pkgs/servers/monitoring/nagios/plugins (#298757)

parents 01b7c60b d5d83eae
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  python3Packages,
}:

python3Packages.buildPythonApplication rec {
  pname = "check-esxi-hardware";
  version = "20221230";
  format = "other";

  src = fetchFromGitHub {
    owner = "Napsty";
    repo = "check_esxi_hardware";
    rev = "refs/tags/${version}";
    hash = "sha256-u0LklUrzj92mzSzD61C/lxA37bx6nWlRzE1+1fcTL14=";
  };

  dontBuild = true;

  dependencies = with python3Packages; [
    pywbem
    requests
    setuptools
  ];

  doCheck = false;

  installPhase = ''
    runHook preInstall

    install -Dm755 check_esxi_hardware.py $out/bin/check_esxi_hardware
    install -Dm644 -t $out/share/doc/${pname} README.md

    runHook postInstall
  '';

  meta = {
    homepage = "https://github.com/Napsty/check_esxi_hardware";
    changelog = "https://github.com/Napsty/check_esxi_hardware/releases/tag/${version}";
    license = lib.licenses.gpl2Plus;
    mainProgram = "check_esxi_hardware";
    maintainers = with lib.maintainers; [ peterhoeg ];
  };
}
+8 −4
Original line number Diff line number Diff line
{ lib, fetchFromGitHub, python3Packages }:
{
  lib,
  fetchFromGitHub,
  python3Packages,
}:

python3Packages.buildPythonApplication rec {
  pname = "check-openvpn";
@@ -14,10 +18,10 @@ python3Packages.buildPythonApplication rec {
  # no tests
  doCheck = false;

  meta = with lib; {
  meta = {
    description = "Nagios/icinga/sensu check plugin for OpenVPN";
    license = lib.licenses.mit;
    mainProgram = "check_openvpn";
    license = licenses.mit;
    maintainers = with maintainers; [ peterhoeg ];
    maintainers = with lib.maintainers; [ peterhoeg ];
  };
}
+14 −13
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, python3
, smartmontools
{
  fetchFromGitHub,
  lib,
  python3,
  smartmontools,
  stdenv,
}:

stdenv.mkDerivation rec {
  pname = "check_smartmon";
  pname = "check-smartmon";
  version = "1.0.1";

  src = fetchFromGitHub {
    owner = "driehuis";
    repo = "Nagios_check_smartmon";
    rev    = version;
    rev = "refs/tags/${version}";
    sha256 = "tiIeFiHdDgqoeznk9XdCE7owIMnnsQ0fmtj8foFoUD8=";
  };

@@ -24,7 +25,7 @@ stdenv.mkDerivation rec {
  postPatch = ''
    patchShebangs check_smartmon.py
    substituteInPlace check_smartmon.py \
      --replace '"/usr/sbin/smartctl"' '"${smartmontools}/bin/smartctl"'
      --replace-fail '"/usr/sbin/smartctl"' '"${smartmontools}/bin/smartctl"'
  '';

  installPhase = ''
@@ -33,11 +34,11 @@ stdenv.mkDerivation rec {
    runHook postInstall
  '';

  meta = with lib; {
  meta = {
    description = "Nagios-Plugin that uses smartmontools to check disk health status and temperature";
    mainProgram = "check_smartmon";
    homepage = "https://github.com/driehuis/Nagios_check_smartmon";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ mariaa144 ];
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ mariaa144 ];
  };
}
+67 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, bc
, bind # host and dig binary
, coreutils # date and timeout binary
, curl
, fetchFromGitHub
, file
, iproute2
, makeWrapper
, netcat-gnu
, nmap
, openssl
, python3
, which
{
  bc,
  bind,
  coreutils,
  curl,
  fetchFromGitHub,
  file,
  iproute2,
  lib,
  makeWrapper,
  netcat-gnu,
  nmap,
  openssl,
  python3,
  stdenv,
  which,
}:

stdenv.mkDerivation rec {
@@ -26,9 +27,7 @@ stdenv.mkDerivation rec {
    hash = "sha256-HVif2pjVumrf2YFSHbNiL9pfXy8XNeXHRgaIlx/Tzds=";
  };

  nativeBuildInputs = [
    makeWrapper
  ];
  nativeBuildInputs = [ makeWrapper ];

  makeFlags = [
    "DESTDIR=$(out)/bin"
@@ -37,16 +36,32 @@ stdenv.mkDerivation rec {

  postInstall = ''
    wrapProgram $out/bin/check_ssl_cert \
      --prefix PATH : "${lib.makeBinPath ([ openssl file which curl bc coreutils bind nmap netcat-gnu python3 ] ++ lib.optional stdenv.hostPlatform.isLinux iproute2) }"
      --prefix PATH : "${
        lib.makeBinPath (
          [
            bc
            bind # host and dig binary
            coreutils # date and timeout binary
            curl
            file
            netcat-gnu
            nmap
            openssl
            python3
            which
          ]
          ++ lib.optional stdenv.hostPlatform.isLinux iproute2
        )
      }"
  '';

  meta = with lib; {
  meta = {
    changelog = "https://github.com/matteocorti/check_ssl_cert/releases/tag/v${version}";
    description = "Nagios plugin to check the CA and validity of an X.509 certificate";
    mainProgram = "check_ssl_cert";
    homepage = "https://github.com/matteocorti/check_ssl_cert";
    changelog = "https://github.com/matteocorti/check_ssl_cert/releases/tag/v${version}";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ fab ];
    platforms = platforms.all;
    license = lib.licenses.gpl3Plus;
    mainProgram = "check_ssl_cert";
    maintainers = with lib.maintainers; [ fab ];
    platforms = lib.platforms.all;
  };
}
+50 −0
Original line number Diff line number Diff line
{ fetchFromGitHub, python3Packages, lib }:
{
  fetchFromGitHub,
  lib,
  python3Packages,
}:

python3Packages.buildPythonApplication rec {
  pname = "check_systemd";
  version = "2.3.1";
  pname = "check-systemd";
  version = "4.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Josef-Friedrich";
    repo = pname;
    rev = "v${version}";
    sha256 = "11sc0gycxzq1vfvin501jnwnky2ky6ns64yjiw8vq9vmkbf8nni6";
    repo = "check_systemd";
    rev = "refs/tags/v${version}";
    hash = "sha256-1e1WtWRTmOxozuOP2ndfsozuiy9LCT/Lsvb+yKH+8eY=";
  };

  propagatedBuildInputs = with python3Packages; [ nagiosplugin ];

  postInstall = ''
    # check_systemd is only a broken stub calling check_systemd.py
    mv $out/bin/check_systemd{.py,}
  postPatch = ''
    substituteInPlace tests/test_argparse.py \
      --replace-fail "./check_systemd.py" "check_systemd"
  '';

  # the test scripts run ./check_systemd.py and check_systemd. Patch to
  # the installed, patchShebanged executable in $out/bin
  build-system = with python3Packages; [
    poetry-core
  ];

  dependencies = with python3Packages; [
    nagiosplugin
  ];

  # needs to be able to run check_systemd from PATH
  preCheck = ''
    find test -name "*.py" -execdir sed -i "s@./check_systemd.py@$out/bin/check_systemd@" '{}' ";"
    export PATH=$PATH:$out/bin
  '';
  nativeCheckInputs = [ python3Packages.pytestCheckHook ];

  meta = with lib; {
  nativeCheckInputs = with python3Packages; [
    pytestCheckHook
  ];

  meta = {
    changelog = "https://github.com/Josef-Friedrich/check_systemd/releases";
    description = "Nagios / Icinga monitoring plugin to check systemd for failed units";
    homepage = "https://github.com/Josef-Friedrich/check_systemd";
    license = lib.licenses.lgpl2Only;
    mainProgram = "check_systemd";
    inherit (src.meta) homepage;
    changelog = "https://github.com/Josef-Friedrich/check_systemd/releases";
    maintainers = with maintainers; [ symphorien ];
    license = licenses.lgpl2Only;
    platforms = platforms.linux;
    maintainers = with lib.maintainers; [ symphorien ];
    platforms = lib.platforms.linux;
  };
}
Loading