diff options
Diffstat (limited to 'net-analyzer/nagios-plugins-linux-madrisan/files')
2 files changed, 234 insertions, 0 deletions
diff --git a/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-32-rename-with-systemd.patch b/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-32-rename-with-systemd.patch new file mode 100644 index 000000000000..f47319dcd39a --- /dev/null +++ b/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-32-rename-with-systemd.patch @@ -0,0 +1,86 @@ +https://github.com/madrisan/nagios-plugins-linux/commit/63914284097e3a59e3407bf894376b859a0d1a2e + +From 63914284097e3a59e3407bf894376b859a0d1a2e Mon Sep 17 00:00:00 2001 +From: Davide Madrisan <d.madrisan@proton.me> +Date: Tue, 30 Jan 2024 18:57:16 +0100 +Subject: [PATCH] fix(configure): rename cmdline option --with-systemd + + Rename --with-systemd to --enable-systemd for consistency + with the other optional boolean options. + +Signed-off-by: Davide Madrisan <d.madrisan@proton.me> +--- a/configure.ac ++++ b/configure.ac +@@ -337,7 +337,7 @@ AC_CHECK_DECLS([CPU_ALLOC], [], [], + + dnl Check for libcurl + AC_ARG_ENABLE([libcurl], +- AS_HELP_STRING([--enable-libcurl], [Enable libcurl])) ++ AS_HELP_STRING([--enable-libcurl], [enable libcurl])) + AS_IF([test "x$enable_libcurl" = "xyes"], [ + LIBCURL_CHECK_CONFIG([], [7.40.0], [], + [AC_MSG_ERROR([Missing required libcurl >= 7.40.0])]) +@@ -346,27 +346,9 @@ AS_IF([test "x$enable_libcurl" = "xyes"], [ + AM_CONDITIONAL(HAVE_LIBCURL, [test "$libcurl_cv_lib_curl_usable" = "yes"]) + ], [AM_CONDITIONAL(HAVE_LIBCURL, false)]) + +-dnl Check for systemd-login libraries +-AC_ARG_WITH([systemd], +- AS_HELP_STRING([--without-systemd], [do not build with systemd support]), +- [], [with_systemd=check] +-) +-have_systemd=no +-AS_IF([test "x$with_systemd" != "xno"], [ +- PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no]) +- AS_CASE([$with_systemd:$have_systemd], +- [yes:no], +- [AC_MSG_ERROR([systemd expected but libsystemd not found])], +- [*:yes], +- AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if libsystemd is available]) +- AC_DEFINE([USE_SYSTEMD], [1], [Define if systemd support is wanted ]) +- ) +-]) +-AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$have_systemd" = "xyes"]) +- + dnl Check for libvarlink + AC_ARG_ENABLE([libvarlink], +- AS_HELP_STRING([--enable-libvarlink], [Enable libvarlink])) ++ AS_HELP_STRING([--enable-libvarlink], [enable libvarlink])) + AS_IF([test "x$enable_libvarlink" = "xyes"], [ + PKG_CHECK_EXISTS([libvarlink], + [PKG_CHECK_MODULES(LIBVARLINK, [libvarlink >= 18], +@@ -394,6 +376,24 @@ AS_IF([test "x$enable_libprocps" = "xyes"], [ + ]) + AM_CONDITIONAL(HAVE_LIBPROCPS, [test "$have_libprocps" = "yes"]) + ++dnl Check for systemd-login libraries ++AC_ARG_ENABLE([systemd], ++ AS_HELP_STRING([--enable-systemd], [enable systemd related features]), ++ [], [enable_systemd=check] ++) ++have_systemd=no ++AS_IF([test "x$enable_systemd" != "xno"], [ ++ PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [have_systemd=yes], [have_systemd=no]) ++ AS_CASE([$enable_systemd:$have_systemd], ++ [yes:no], ++ [AC_MSG_ERROR([systemd expected but libsystemd not found])], ++ [*:yes], ++ AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Define if libsystemd is available]) ++ AC_DEFINE([USE_SYSTEMD], [1], [Define if systemd support is wanted]) ++ ) ++]) ++AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$have_systemd" = "xyes"]) ++ + dnl Add the option '--with-proc-meminfo=PATH' + AC_ARG_WITH(proc-meminfo, + AS_HELP_STRING([--with-proc-meminfo=PATH], +@@ -604,3 +604,9 @@ if test "$have_libvarlink" = "yes"; then + echo " VARLINK_ADDRESS = $VARLINK_ADDRESS" + echo + fi ++ ++if test "$have_systemd" = "yes"; then ++ echo "Optional systemd library support is enabled:" ++ echo " SYSTEMD_CFLAGS = $SYSTEMD_CFLAGS" ++ echo " SYSTEMD_LIBS = $SYSTEMD_LIBS" ++fi diff --git a/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-32-x86-fixes.patch b/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-32-x86-fixes.patch new file mode 100644 index 000000000000..657cd458f06e --- /dev/null +++ b/net-analyzer/nagios-plugins-linux-madrisan/files/nagios-plugins-linux-madrisan-32-x86-fixes.patch @@ -0,0 +1,148 @@ +https://github.com/madrisan/nagios-plugins-linux/pull/146 + +From d09bfd1b3974743af4b719629f59b5b96e1393a1 Mon Sep 17 00:00:00 2001 +From: Davide Madrisan <d.madrisan@proton.me> +Date: Wed, 27 Mar 2024 09:29:59 +0100 +Subject: [PATCH 1/3] fix: size_t variables on 32 and 64 bits arch have + different type + +Fix the following warning on 32-bits architectures: + + In file included from ../lib/container_docker_count.c:44, + from tslibcontainer_docker_count.c:33: + ../lib/container_docker_count.c: In function 'docker_running_containers': + ../include/logging.h:28:44: warning: format '%lu' expects argument of type 'long unsigned int', + but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=] + 28 | # define dbg(format, ...) fprintf (stdout, "DEBUG: " format, ##__VA_ARGS__) + | ^~~~~~~~~ + ../lib/container_docker_count.c:213:3: note: in expansion of macro 'dbg' + 213 | dbg ("%lu bytes retrieved\n", chunk.size); + | ^~~ + +Signed-off-by: Davide Madrisan <d.madrisan@proton.me> +--- a/lib/container_docker_count.c ++++ b/lib/container_docker_count.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-3.0-or-later + /* + * License: GPLv3+ +- * Copyright (c) 2018 Davide Madrisan <davide.madrisan@gmail.com> ++ * Copyright (c) 2018,2024 Davide Madrisan <davide.madrisan@gmail.com> + * + * A library for checking for Docker exposed metrics. + * +@@ -210,7 +210,7 @@ docker_running_containers (unsigned int *count, const char *image, + #endif /* NPL_TESTING */ + + assert (chunk.memory); +- dbg ("%lu bytes retrieved\n", chunk.size); ++ dbg ("%zu bytes retrieved\n", chunk.size); + dbg ("json data: %s", chunk.memory); + + hashtable = docker_json_parser (chunk.memory, "Image", 1); + +From 4574e9ed77ebda062279622bb3d8678fa983d272 Mon Sep 17 00:00:00 2001 +From: Davide Madrisan <d.madrisan@proton.me> +Date: Wed, 27 Mar 2024 17:36:04 +0100 +Subject: [PATCH 2/3] fix: workaround for a round issue on 32 bits + +On Gentoo Base System release 2.14 for 32-bits + + (unsigned long)(6.26*100) = 625 + +So the test fails. +As a workaround modify the data file used by the test. + +Signed-off-by: Davide Madrisan <d.madrisan@proton.me> +--- a/tests/ts_procpressurecpu.data ++++ b/tests/ts_procpressurecpu.data +@@ -1 +1 @@ +-some avg10=7.48 avg60=6.26 avg300=6.66 total=200932088 ++some avg10=7.48 avg60=6.25 avg300=6.66 total=200932088 +--- a/tests/tslibpressure.c ++++ b/tests/tslibpressure.c +@@ -103,7 +103,7 @@ mymain (void) + /* we multiply by 100 the averages to somewhat transform + * the double values into integer ones */ + DO_TEST ("cpu some avg10", psi_oneline->avg10 * 100, 748ULL); +- DO_TEST ("cpu some avg60", psi_oneline->avg60 * 100, 626ULL); ++ DO_TEST ("cpu some avg60", psi_oneline->avg60 * 100, 625ULL); + DO_TEST ("cpu some avg300", psi_oneline->avg300 * 100, 666ULL); + DO_TEST ("cpu single total", psi_oneline->total, 200932088ULL); + + +From c90afc02705fd6c32a6764741616b4e17688117b Mon Sep 17 00:00:00 2001 +From: Davide Madrisan <d.madrisan@proton.me> +Date: Wed, 27 Mar 2024 21:06:25 +0100 +Subject: [PATCH 3/3] fix: fix test tslibxstrton_sizetollint on 32-bit arch + +Fix the following errors: + + 1) check function sizetollint with arg 1024b ... OK + 2) check function sizetollint with arg 8k ... OK + 3) check function sizetollint with arg 50m ... OK + 4) check function sizetollint with arg 2g ... OK + 5) check function sizetollint with arg 3t ... FAILED + 6) check function sizetollint with arg 2p ... FAILED + 7) check function sizetollint with arg 1024B ... OK + 8) check function sizetollint with arg 8K ... OK + 9) check function sizetollint with arg 50M ... OK + 10) check function sizetollint with arg 2G ... OK + 11) check function sizetollint with arg 3T ... FAILED + 12) check function sizetollint with arg 2P ... FAILED + +The long int is not large enough on 32-bit architectures. + +Signed-off-by: Davide Madrisan <d.madrisan@proton.me> +--- a/tests/tslibxstrton_sizetoint64.c ++++ b/tests/tslibxstrton_sizetoint64.c +@@ -1,7 +1,7 @@ + // SPDX-License-Identifier: GPL-3.0-or-later + /* + * License: GPLv3+ +- * Copyright (c) 2022 Davide Madrisan <davide.madrisan@gmail.com> ++ * Copyright (c) 2022,2024 Davide Madrisan <davide.madrisan@gmail.com> + * + * Unit test for lib/xstrton.c + * +@@ -29,11 +29,11 @@ + typedef struct test_data + { + char *size; +- int64_t expect_value; ++ long long int expect_value; + } test_data; + + static int +-test_sizetoint64 (const void *tdata) ++test_sizetollint (const void *tdata) + { + const struct test_data *data = tdata; + long long int result; +@@ -57,19 +57,19 @@ mymain (void) + .size = SIZE, \ + .expect_value = EXPECT_VALUE, \ + }; \ +- if (test_run("check function sizetoint64 with arg " SIZE, \ +- test_sizetoint64, (&data)) < 0) \ ++ if (test_run("check function sizetollint with arg " SIZE, \ ++ test_sizetollint, (&data)) < 0) \ + ret = -1; \ + } \ + while (0) + + /* test the function sizetoint64() */ + +-#define ONE_KILOBYTE 1000UL +-#define ONE_MEGABYTE (1000UL * ONE_KILOBYTE) +-#define ONE_GIGABYTE (1000UL * ONE_MEGABYTE) +-#define ONE_TERABYTE (1000UL * ONE_GIGABYTE) +-#define ONE_PETABYTE (1000UL * ONE_TERABYTE) ++#define ONE_KILOBYTE 1000ULL ++#define ONE_MEGABYTE (1000ULL * ONE_KILOBYTE) ++#define ONE_GIGABYTE (1000ULL * ONE_MEGABYTE) ++#define ONE_TERABYTE (1000ULL * ONE_GIGABYTE) ++#define ONE_PETABYTE (1000ULL * ONE_TERABYTE) + + DO_TEST ("1024b", 1024); + DO_TEST ("8k", 8 * ONE_KILOBYTE); |