Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 15 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
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 ];
};
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{ lib, fetchFromGitHub, python3Packages }:
{
lib,
fetchFromGitHub,
python3Packages,
}:

python3Packages.buildPythonApplication rec {
pname = "check-openvpn";
Expand All @@ -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 ];
};
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{ 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;
owner = "driehuis";
repo = "Nagios_check_smartmon";
rev = "refs/tags/${version}";
sha256 = "tiIeFiHdDgqoeznk9XdCE7owIMnnsQ0fmtj8foFoUD8=";
};

Expand All @@ -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 = ''
Expand All @@ -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 changes: 67 additions & 0 deletions pkgs/servers/monitoring/nagios-plugins/check_ssl_cert/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
bc,
bind,
coreutils,
curl,
fetchFromGitHub,
file,
iproute2,
lib,
makeWrapper,
netcat-gnu,
nmap,
openssl,
python3,
stdenv,
which,
}:

stdenv.mkDerivation rec {
pname = "check_ssl_cert";
version = "2.84.4";

src = fetchFromGitHub {
owner = "matteocorti";
repo = "check_ssl_cert";
rev = "refs/tags/v${version}";
hash = "sha256-HVif2pjVumrf2YFSHbNiL9pfXy8XNeXHRgaIlx/Tzds=";
};

nativeBuildInputs = [ makeWrapper ];

makeFlags = [
"DESTDIR=$(out)/bin"
"MANDIR=$(out)/share/man"
];

postInstall = ''
wrapProgram $out/bin/check_ssl_cert \
--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 = {
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";
homepage = "https://github.com/matteocorti/check_ssl_cert";
license = lib.licenses.gpl3Plus;
mainProgram = "check_ssl_cert";
maintainers = with lib.maintainers; [ fab ];
platforms = lib.platforms.all;
};
}
50 changes: 50 additions & 0 deletions pkgs/servers/monitoring/nagios-plugins/check_systemd/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
fetchFromGitHub,
lib,
python3Packages,
}:

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

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

postPatch = ''
substituteInPlace tests/test_argparse.py \
--replace-fail "./check_systemd.py" "check_systemd"
'';

build-system = with python3Packages; [
poetry-core
];

dependencies = with python3Packages; [
nagiosplugin
];

# needs to be able to run check_systemd from PATH
preCheck = ''
export PATH=$PATH:$out/bin
'';

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";
maintainers = with lib.maintainers; [ symphorien ];
platforms = lib.platforms.linux;
};
}
34 changes: 34 additions & 0 deletions pkgs/servers/monitoring/nagios-plugins/check_uptime/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
autoreconfHook,
fetchFromGitHub,
lib,
stdenv,
}:

stdenv.mkDerivation {
pname = "check-uptime";
version = "unstable-2016-11-12";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a 0- prefix


src = fetchFromGitHub {
owner = "madrisan";
repo = "nagios-plugins-uptime";
rev = "51822dacd1d404b3eabf3b4984c64b2475ed6f3b";
hash = "sha256-0zOvaVWCFKlbblGyObir1QI0cU186J6y1+0ki/+KCaM=";
};

nativeBuildInputs = [ autoreconfHook ];

enableParallelBuilding = true;

postInstall = ''
ln -sr $out/libexec $out/bin
'';

meta = {
description = "Uptime check plugin for Sensu/Nagios/others";
homepage = "https://github.com/madrisan/nagios-plugins-uptime";
license = lib.licenses.gpl3Plus;
mainProgram = "check_uptime";
maintainers = with lib.maintainers; [ peterhoeg ];
};
}
Original file line number Diff line number Diff line change
@@ -1,46 +1,74 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper, perlPackages, txt2man
, monitoring-plugins
, wmic-bin ? null }:
{
fetchFromGitHub,
lib,
makeWrapper,
monitoring-plugins,
perlPackages,
stdenv,
txt2man,
wmic-bin ? null,
}:

stdenv.mkDerivation rec {
pname = "check-wmiplus";
pname = "check-wmi-plus";
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
# Upstream has been moved from Github to tarballs on the author's website.
# See https://edcint.co.nz/checkwmiplus/releases/
src = fetchFromGitHub {
owner = "speartail";
repo = "checkwmiplus";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repository is dead since October 2021, speartail/checkwmiplus@37fa4f9.

On a first glance I was unable to find another repository, but tarballs on the author's webpage: https://edcint.co.nz/checkwmiplus/releases/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rev = "v${version}";
rev = "refs/tags/v${version}";
sha256 = "1as0iyhy4flpm37mb7lvah7rnd6ax88appjm1icwhy7iq03wi8pl";
};

patches = [
./wmiplus_fix_manpage.patch
];
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
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 ];
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"
--replace-fail /usr/bin/wmic ${wmic-bin}/bin/wmic \
--replace-fail /etc/check_wmi_plus $out/etc/check_wmi_plus \
--replace-fail /opt/nagios/bin/plugins $out/etc/check_wmi_plus \
--replace-fail /usr/lib/nagios/plugins ${monitoring-plugins}/libexec \
--replace-fail '$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
Expand Down Expand Up @@ -70,8 +98,9 @@ stdenv.mkDerivation rec {

meta = with lib; {
description = "Sensu/nagios plugin using WMI to query Windows hosts";
homepage = "http://edcint.co.nz/checkwmiplus";
homepage = "https://edcint.co.nz/checkwmiplus/";
license = licenses.gpl2Plus;
mainProgram = "check_wmi_plus";
maintainers = with maintainers; [ peterhoeg ];
};
}
Loading