[pkg-nagios-changes] [Git][nagios-team/nagios-plugins-contrib][master] 3 commits: check_redis: add acl support
Bernd Zeimetz (@bzed)
gitlab at salsa.debian.org
Tue Dec 12 10:02:25 GMT 2023
Bernd Zeimetz pushed to branch master at Debian Nagios Maintainer Group / nagios-plugins-contrib
Commits:
0b8a7ff4 by Bernd Zeimetz at 2023-12-12T10:54:44+01:00
check_redis: add acl support
- - - - -
b663d9fa by Bernd Zeimetz at 2023-12-12T10:54:57+01:00
check_v46: remove leading spaces from perf data
github #84
- - - - -
9f95871d by Bernd Zeimetz at 2023-12-12T11:01:25+01:00
Update madrisan nagios plugins
- - - - -
22 changed files:
- + debian/patches/check_redis/acl_support
- + debian/patches/check_v6/remove_spaces_from_perf_data
- debian/patches/series
- madrisan-nagios-plugins-linux/control
- madrisan-nagios-plugins-linux/nagios-plugins-linux/.github/workflows/build-checks.yml
- madrisan-nagios-plugins-linux/nagios-plugins-linux/AUTHORS
- madrisan-nagios-plugins-linux/nagios-plugins-linux/NEWS.md
- madrisan-nagios-plugins-linux/nagios-plugins-linux/README.md
- madrisan-nagios-plugins-linux/nagios-plugins-linux/VERSION
- madrisan-nagios-plugins-linux/nagios-plugins-linux/configure.ac
- madrisan-nagios-plugins-linux/nagios-plugins-linux/debian/changelog
- madrisan-nagios-plugins-linux/nagios-plugins-linux/debian/rules
- madrisan-nagios-plugins-linux/nagios-plugins-linux/include/common.h
- madrisan-nagios-plugins-linux/nagios-plugins-linux/lib/netinfo-private.c
- madrisan-nagios-plugins-linux/nagios-plugins-linux/packages/Makefile.am
- madrisan-nagios-plugins-linux/nagios-plugins-linux/packages/multibuild.sh
- madrisan-nagios-plugins-linux/nagios-plugins-linux/packages/specs/nagios-plugins-linux.spec.in
- madrisan-nagios-plugins-linux/nagios-plugins-linux/plugins/check_memory.c
- madrisan-nagios-plugins-linux/nagios-plugins-linux/plugins/check_users.c
- madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/Makefile.am
- madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/tslibkernelver.c
- madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/tslib_uname.c → madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/tslibuname.c
Changes:
=====================================
debian/patches/check_redis/acl_support
=====================================
@@ -0,0 +1,13 @@
+Index: nagios-plugins-contrib/check_redis/check_redis.pl
+===================================================================
+--- nagios-plugins-contrib.orig/check_redis/check_redis.pl
++++ nagios-plugins-contrib/check_redis/check_redis.pl
+@@ -2654,7 +2654,7 @@ $start_time = [ Time::HiRes::gettimeofda
+ $redis = Redis-> new ( server => $dsn, 'debug' => (defined($o_verb))?1:0 );
+
+ if ($PASSWORD) {
+- $redis->auth($PASSWORD);
++ $redis->auth(split(' ', $PASSWORD));
+ }
+ if ($DATABASE) {
+ $redis->select($DATABASE);
=====================================
debian/patches/check_v6/remove_spaces_from_perf_data
=====================================
@@ -0,0 +1,13 @@
+Index: nagios-plugins-contrib/check_v46/check_v46
+===================================================================
+--- nagios-plugins-contrib.orig/check_v46/check_v46
++++ nagios-plugins-contrib/check_v46/check_v46
+@@ -165,7 +165,7 @@ foreach my $p (@protocols) {
+
+ # Strip off performance data from the $first line of plugin
+ # output.
+- $first =~ s/^([^\|]+)\|(.*)/$1/;
++ $first =~ s/^([^\|]+)\|\s*(.*)/$1/;
+ $out->{$p}->{$a}->{first} = $first;
+
+ # Add lc($p) as prefix to performance data labels, e.g.
=====================================
debian/patches/series
=====================================
@@ -62,3 +62,5 @@ check_email_delivery/check_smtp_send-hello
check_raid/sort_megacli_numerical
check_raid/hpacucli_cache_fail
check_raid/fix_unparsed_error_cciss
+check_redis/acl_support
+check_v6/remove_spaces_from_perf_data
=====================================
madrisan-nagios-plugins-linux/control
=====================================
@@ -1,5 +1,5 @@
Watch: https://github.com/madrisan/nagios-plugins-linux/commit/master >commit <[^>]*>([0-9a-f]+)<
-Version: bbbdc5279cd2569d4c6b5e0ed19d12c082e322ad
+Version: 2ea02e2173a4307a051a7ae97c7867da7e6ac70a
Homepage: https://github.com/madrisan/nagios-plugins-linux
Uploaders: Peter Palfrader <weasel at debian.org>
Description: Nagios-compatible Plugins for Linux
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/.github/workflows/build-checks.yml
=====================================
@@ -16,15 +16,12 @@ jobs:
fail-fast: false
matrix:
container:
- - 'alpine:3.14'
- - 'alpine:3.15'
- - 'alpine:3.16'
- - 'debian:9'
- - 'debian:10'
+ - 'alpine:3.17'
+ - 'alpine:3.18'
- 'debian:11'
- - 'fedora:34'
- - 'fedora:35'
- - 'fedora:36'
+ - 'debian:12'
+ - 'fedora:38'
+ - 'fedora:39'
- 'ubuntu:20.04'
- 'ubuntu:22.04'
@@ -41,18 +38,26 @@ jobs:
debian*|ubuntu*)
export DEBIAN_FRONTEND=noninteractive
apt-get update -q
- apt-get install -q -y --no-install-recommends autoconf automake bzip2 gcc libcurl4-gnutls-dev libtool m4 make pkg-config xz-utils
+ apt-get install -q -y --no-install-recommends autoconf automake bzip2 gcc libcurl4-gnutls-dev libsystemd-dev libtool m4 make pkg-config xz-utils
;;
fedora*)
dnf -y update
- dnf -y install autoconf automake bzip2 gcc glibc-devel libcurl-devel libvarlink-devel libtool make m4 xz
+ dnf -y install autoconf automake bzip2 diffutils gcc glibc-devel libcurl-devel libvarlink-devel libtool make m4 systemd-devel xz
;;
esac
- id: configure
run: |
autoreconf --install
- ./configure --enable-debug
+ case "${{ matrix.container }}" in
+ alpine*|debian*|ubuntu*)
+ ./configure --enable-libcurl --enable-debug
+ ;;
+ # libvarlink is only available in Fedora
+ *)
+ ./configure --enable-libcurl --enable-libvarlink --enable-debug
+ ;;
+ esac
- id: make
run: |
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/AUTHORS
=====================================
@@ -25,6 +25,9 @@ Contributors:
RincewindsHat - https://github.com/RincewindsHat
Configuration file for icinga2;
fix a typo in the check_network help message
+ nE0sIghT - https://github.com/nE0sIghT
+ Bug report and patch for fixing check_network
+ when run in a containerized environment
Some code and coding styles/ideas belong to the following open source projects:
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/NEWS.md
=====================================
@@ -1,3 +1,118 @@
+## Version 31 ("Counter-intuitive")
+### Aug 28th, 2022
+
+#### FIXES
+
+##### Libraries
+
+ * lib/container_docker_memory: fix an issue reported by clang-analyzer.
+ * Make sure sysfs is mounted in the plugins that require it.
+
+#### ENHANCEMENTS / CHANGES
+
+##### Plugin check_filecount
+
+ * New plugin `check_filecount` that returns the number of files found in one or more directories.
+
+##### Plugin check_memory
+
+ * check_memory: support new units kiB/MiB/GiB.
+ Feature asked by [mdicss](https://github.com/mdicss).
+ See the discussion [#120](https://github.com/madrisan/nagios-plugins-linux/discussions/120).
+
+##### contrib/icinga2/CheckCommands.conf
+
+ * Contribution from Lorenz [RincewindsHat](https://github.com/RincewindsHat): add icinga2 command configurations.
+
+##### Build
+
+ * configure: ensure libprocps is v4.0.0 or better if the experimental option `--enable-libprocps` is passed to `configure`.
+
+##### Test framework
+
+ * Add some unit tests for `lib/xstrton`.
+ * New unit tests `tslibfiles_{filecount,hiddenfile,size}`.
+
+##### Package creation
+
+ * Add Linux Alpine 3.16 and remove version 3.13.
+ * Do not package experimental plugins in the rpm `nagios-plugins-linux-all`.
+ * Add Fedora 36 and drop Fedora 33 support.
+ * CentOS 8 died a premature death at the end of 2021. Add packages for CentOS Stream 8 and 9.
+
+##### GitHub workflows
+
+ * Build the Nagios Plugins Linux on the LTS Ubuntu versions only. The version 21 seems dead.
+ * Add build tests for all the supported oses.
+ * Update the os versions used in tests.
+ * CentOS 8 died a premature death at the end of 2021. Remove it from the list of test oses.
+ * Add CodeQL analysis
+
+### GIT DIFF
+```
+$ git diff --stat db94dc16 6edcf3aa
+ .github/workflows/build-checks.yml | 9 +-
+ .github/workflows/codeql-analysis.yml | 59 ++++++++++
+ .gitignore | 3 +
+ AUTHORS | 6 ++
+ DEVELOPERS.md | 14 ++-
+ README.md | 50 ++++-----
+ SECURITY.md | 24 +++++
+ configure.ac | 15 ++-
+ contrib/README.md | 6 ++
+ contrib/icinga2/CheckCommands.conf | 923 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ include/Makefile.am | 1 +
+ include/common.h | 2 +
+ include/cpudesc.h | 2 +-
+ include/files.h | 56 ++++++++++
+ include/procparser.h | 2 +-
+ include/sysfsparser.h | 3 +
+ include/xstrton.h | 16 +--
+ lib/Makefile.am | 1 +
+ lib/container_docker_memory.c | 8 +-
+ lib/container_podman_count.c | 2 +-
+ lib/cpudesc.c | 8 +-
+ lib/cpufreq.c | 2 +-
+ lib/cputopology.c | 5 +-
+ lib/files.c | 252 +++++++++++++++++++++++++++++++++++++++++++
+ lib/interrupts.c | 2 +-
+ lib/meminfo.c | 2 +-
+ lib/messages.c | 2 +-
+ lib/processes.c | 2 +-
+ lib/sysfsparser.c | 30 ++++--
+ lib/thresholds.c | 4 +-
+ lib/xmalloc.c | 2 +-
+ lib/xstrton.c | 148 ++++++++++++++++++++++++--
+ nagios-plugins-linux-logo-128.png | Bin 0 -> 10505 bytes
+ packages/Makefile.am | 22 ++--
+ packages/docker-shell-helpers | 2 +-
+ packages/multibuild.sh | 7 +-
+ packages/specs/APKBUILD.in | 2 +-
+ packages/specs/Makefile.am | 2 +
+ packages/specs/nagios-plugins-linux.spec.in | 10 +-
+ plugins/Makefile.am | 3 +
+ plugins/check_cpu.c | 9 +-
+ plugins/check_cpufreq.c | 7 +-
+ plugins/check_fc.c | 9 +-
+ plugins/check_filecount.c | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ plugins/check_load.c | 8 +-
+ plugins/check_memory.c | 51 ++++++---
+ plugins/check_network.c | 2 +-
+ plugins/check_swap.c | 2 +-
+ plugins/check_temperature.c | 6 +-
+ tests/Makefile.am | 34 ++++--
+ tests/testutils.c | 2 +-
+ tests/tslibfiles_age.c | 85 +++++++++++++++
+ tests/tslibfiles_filecount.c | 227 +++++++++++++++++++++++++++++++++++++++
+ tests/tslibfiles_hiddenfile.c | 72 +++++++++++++
+ tests/tslibfiles_size.c | 79 ++++++++++++++
+ tests/tslibkernelver.c | 2 +-
+ tests/{tslib_uname.c => tslibuname.c} | 0
+ tests/tslibxstrton_agetoint64.c | 92 ++++++++++++++++
+ tests/tslibxstrton_sizetoint64.c | 91 ++++++++++++++++
+ 59 files changed, 2638 insertions(+), 141 deletions(-)
+```
+
## Version 30 ("Low Pressure")
### Jan 25th, 2022
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/README.md
=====================================
@@ -4,7 +4,7 @@
![Release Status](https://img.shields.io/badge/status-stable-brightgreen.svg)
[![License](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://spdx.org/licenses/GPL-3.0-only.html)
-[![Download Latest Release](https://img.shields.io/badge/download-latest--tarball-blue.svg)](https://github.com/madrisan/nagios-plugins-linux/releases/download/v30/nagios-plugins-linux-30.tar.xz)
+[![Download Latest Release](https://img.shields.io/badge/download-latest--tarball-blue.svg)](https://github.com/madrisan/nagios-plugins-linux/releases/download/v31/nagios-plugins-linux-31.tar.xz)
[![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/madrisan)
[![Build Status](https://travis-ci.org/madrisan/nagios-plugins-linux.svg?branch=master)](https://travis-ci.org/madrisan/nagios-plugins-linux)
@@ -13,9 +13,9 @@
[![Language Grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/madrisan/nagios-plugins-linux.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/madrisan/nagios-plugins-linux/context:cpp)
<a href='https://ko-fi.com/K3K57TH3' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
-<a href='http://amzn.eu/8axPDQ1'><img height='36' src='http://png-1.findicons.com/files/icons/2229/social_media_mini/48/amazon.png' border='0' alt='Wish List at Amazon.fr' /></a>
+<a href='http://amzn.eu/8axPDQ1'><img height='36' src='https://images.freeimages.com/fic/images/icons/2229/social_media_mini/48/amazon.png' border='0' alt='Wish List at Amazon.fr' /></a>
-*This package contains several binary plugins for monitoring (physical and virtual) Linux hosts with [Nagios](http://www.nagios.org/) and Nagios-compatible monitoring systems like [Icinga](https://icinga.com/learn/) and [Naemon](https://www.naemon.org/).*
+*This project provides several plugins for monitoring physical and virtual Linux hosts with [Nagios](http://www.nagios.org/) and Nagios-compatible monitoring systems like [Icinga](https://icinga.com/learn/) and [Naemon](https://www.naemon.org/).*
Here is the list of the available plugins:
@@ -23,7 +23,7 @@ Here is the list of the available plugins:
* **check_cpu** - checks the CPU (user mode) utilization
* **check_cpufreq** - displays the CPU frequency characteristics
* **check_cswch** - checks the total number of context switches across all CPUs
-* **check_docker** - checks the number of running docker containers (:warning: *alpha*, requires *libcurl* version 7.40.0+)
+* **check_docker** - checks the number of running docker containers (:warning: *pre-alpha*, requires *libcurl* version 7.40.0+)
* **check_fc** - monitors the status of the fiber status ports
* **check_filecount** - checks the number of files found in one or more directories :new:
* **check_ifmountfs** - checks whether the given filesystems are mounted
@@ -40,7 +40,7 @@ Here is the list of the available plugins:
* check_network_multicast
* **check_paging** - checks the memory and swap paging
* **check_pressure** - checks Linux Pressure Stall Information (PSI) data :new:
-* **check_podman** - monitor the status of podman containers (:warning: *beta*, requires *libvarlink*)
+* **check_podman** - monitor the status of podman containers (:warning: *alpha*, requires *libvarlink*)
* **check_readonlyfs** - checks for readonly filesystems
* **check_swap** - checks the swap usage
* **check_tcpcount** - checks the tcp network usage
@@ -53,7 +53,7 @@ Here is the list of the available plugins:
The full documentation of the `nagios-plugins-linux` is available online
in the GitHub [wiki page](https://github.com/madrisan/nagios-plugins-linux/wiki).
-## Installation
+## Get and configure the source code
This package uses `GNU autotools` for configuration and installation.
@@ -80,6 +80,13 @@ Example (RHEL5 and RHEL6 and other old distributions):
./configure --with-socketfile=/var/run/multipathd.sock
+If you want to compile the code with a C compiler different from the system default,
+you can set the environment variable CC accordingly. Here's an example:
+
+ CC=clang-17 ./configure --libexecdir=/usr/lib/nagios/plugins
+
+## Installation
+
After `./configure` has completed successfully run `make install` and
you're done!
@@ -106,14 +113,14 @@ This package is known to compile with:
* gcc 4.1 (RHEL 5 / CentOS 5),
* gcc 4.4 (RHEL6 / CentOS 6),
* gcc 4.8 (RHEL7 / CentOS 7),
-* gcc 3.x, 5.1, 5.3, 6.3, 7, 8, 9, 10, 11 (openmamba GNU/Linux, Debian 8+, Fedora 25+),
-* clang 3.7, 3.8, 4.9, 5, 6, 7, 8, 10, 11, 12, 13 (openmamba GNU/Linux, Fedora 25+),
+* gcc 3.x, 5.1, 5.3, 6.3, 7-13 (openmamba GNU/Linux, Debian 8+, Fedora 25+),
+* clang 3.7, 3.8, 4.9, 5, 6, 7, 8, 10-17 (openmamba GNU/Linux, Fedora 25+),
List of the Linux kernels that have been successfully tested:
* 2.6.18, 2.6.32,
* 3.10, 3.14, 3.18,
* 4.2, 4.4, 4,9, 4.14, 4.15, 4.16, 4.19
-* 5.6, 5.7, 5.8, 5.12-5.16
+* 5.6, 5.7, 5.8, 5.12-5.18, 6.1-6.5
The Nagios Plugins Linux are regularly tested on
* Alpine Linux (musl libc),
@@ -125,18 +132,20 @@ The `.apk`, `.rpm` and `.deb` packages for Alpine, CentOS/RHEL, Debian, and Fedo
Command | Distribution
-------------------- | ------------
-Alpine 3.13 | `make -C packages alpine-3.13`
-Alpine 3.14 | `make -C packages alpine-3.14`
-Alpine 3.15 | `make -C packages alpine-3.15`
+Alpine 3.16 | `make -C packages alpine-3.16`
+Alpine 3.17 | `make -C packages alpine-3.17`
+Alpine 3.18 | `make -C packages alpine-3.18`
CentOS Stream 8 | `make -C packages centos-stream-8`
CentOS Stream 9 | `make -C packages centos-stream-9`
-Debian 9 (Stretch) | `make -C packages debian-stretch`
Debian 10 (Buster) | `make -C packages debian-buster`
Debian 11 (Bullseye) | `make -C packages debian-bullseye`
-Fedora 34 | `make -C packages fedora-34`
-Fedora 35 | `make -C packages fedora-35`
-Fedora 36 | `make -C packages fedora-36`
+Debian 12 (Bookworm) | `make -C packages debian-bookworm`
+Fedora 37 | `make -C packages fedora-37`
+Fedora 38 | `make -C packages fedora-38`
+Fedora 39 | `make -C packages fedora-39`
Fedora Rawhide | `make -C packages fedora-rawhide`
+Rocky Linux 8 | `make -C packages rockylinux-8`
+Rocky Linux 9 | `make -C packages rockylinux-9`
in the root source folder.
The building process requires the _Docker_ software containerization platform running on your system, and an internet connection to download the Docker images of the operating systems you want to build the packages for.
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/VERSION
=====================================
@@ -1 +1 @@
-30
+31
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/configure.ac
=====================================
@@ -337,25 +337,43 @@ AC_CHECK_DECLS([CPU_ALLOC], [], [],
dnl Check for libcurl
AC_ARG_ENABLE([libcurl],
- AS_HELP_STRING([--disable-libcurl], [Disable libcurl]))
-AS_IF([test "x$enable_libcurl" != "xno"], [
- LIBCURL_CHECK_CONFIG([], 7.40.0, [],
- [AC_MSG_WARN([Missing required libcurl >= 7.40.0])])
+ 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])])
AC_SUBST([LIBCURL_CPPFLAGS])
AC_SUBST([LIBCURL])
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([--disable-libvarlink], [Disable libvarlink]))
-AS_IF([test "x$enable_libvarlink" != "xno"], [
+ AS_HELP_STRING([--enable-libvarlink], [Enable libvarlink]))
+AS_IF([test "x$enable_libvarlink" = "xyes"], [
PKG_CHECK_EXISTS([libvarlink],
[PKG_CHECK_MODULES(LIBVARLINK, [libvarlink >= 18],
[AC_DEFINE(HAVE_LIBVARLINK, 1, [Define if libvarlink is available])
have_libvarlink=yes],
- AC_MSG_ERROR([*** libvarlink version 18 or better not found]))])
-])
+ [AC_MSG_ERROR([*** libvarlink version 18 or better not found])])],
+ [AC_MSG_ERROR([*** libvarlink not found])])])
AM_CONDITIONAL(HAVE_LIBVARLINK, [test "$have_libvarlink" = "yes"])
dnl Check for the procps newlib
@@ -566,18 +584,23 @@ echo " LDFLAGS = $LDFLAGS"
echo
if test "$have_libprocps" = "yes"; then
+ echo "Optional procps-ng library support is enabled:"
echo " LIBPROCPS_CFLAGS = $LIBPROCPS_CFLAGS"
echo " LIBPROCPS_LIBS = $LIBPROCPS_LIBS"
echo
fi
if test "$libcurl_cv_lib_curl_usable" = "yes"; then
+ echo "Optional curl library support is enabled (required by check_docker):"
echo " LIBCURL_CPPFLAGS = $LIBCURL_CPPFLAGS"
echo " LIBCURL = $LIBCURL"
echo
fi
if test "$have_libvarlink" = "yes"; then
+ echo "Optional varlink library support is enabled (required by check_podman):"
+ echo " LIBVARLINK_CFLAGS = $LIBVARLINK_CFLAGS"
+ echo " LIBVARLINK_LIBS = -lvarlink"
echo " VARLINK_ADDRESS = $VARLINK_ADDRESS"
echo
fi
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/debian/changelog
=====================================
@@ -1,10 +1,18 @@
+nagios-plugins-linux (31-1) stable; urgency=low
+ * Release 31 "Counter-intuitive":
+ - New plugin check_filecount
+ - Support new units kiB/MiB/GiB in check_memory
+ - Minor fixes
+
+ -- Davide Madrisan <davide.madrisan at gmail.com> Sun, 28 Aug 2022 22:44:00 +0200
+
nagios-plugins-linux (30-1) stable; urgency=low
* Release 30 "Low pressure":
- Fixes in the plugin check_pressure
- Fix a LGTM issue in lib/netinfo
- Fix Debian multi-package creation
- -- Davide Madrisan <davide.madrisan at gmail.com> Tue, 25 Jan 202Z 18:57:05 +0200
+ -- Davide Madrisan <davide.madrisan at gmail.com> Tue, 25 Jan 2022 18:57:05 +0200
nagios-plugins-linux (29-1) stable; urgency=low
* Release 29 "High Temperatures":
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/debian/rules
=====================================
@@ -6,4 +6,4 @@ NP_LIBEXEC:=/usr/lib/nagios/plugins
dh $@ --with autoreconf
override_dh_auto_configure:
- dh_auto_configure -- --libexecdir=${NP_LIBEXEC}
+ dh_auto_configure -- --libexecdir=${NP_LIBEXEC} --enable-libcurl
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/include/common.h
=====================================
@@ -32,6 +32,8 @@ There is NO WARRANTY, to the extent permitted by law.\n"
#define USAGE_OPTIONS "Options:\n"
#define USAGE_EXAMPLES "Examples:\n"
#define USAGE_NOTE "Note:\n"
+#define USAGE_NOTE_1 "Note 1:\n"
+#define USAGE_NOTE_2 "Note 2:\n"
#define USAGE_SEPARATOR "\n"
#define USAGE_HELP \
" -h, --help display this help and exit\n"
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/lib/netinfo-private.c
=====================================
@@ -135,8 +135,8 @@ check_link_speed (const char *ifname, uint32_t *speed, uint8_t *duplex)
#ifdef ETHTOOL_GLINKSETTINGS
# define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 (SCHAR_MAX)
struct elinkset {
- struct ethtool_link_settings req;
uint32_t link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
+ struct ethtool_link_settings req;
} elinkset;
#endif
@@ -260,7 +260,7 @@ get_rtnl_fd ()
memset (&u.local, 0, sizeof (u.local));
u.local.nl_family = AF_NETLINK;
u.local.nl_groups = 0;
- u.local.nl_pid = getpid ();
+ u.local.nl_pid = 0;
if (bind (fd, &u.addr, sizeof (u.addr)) < 0)
{
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/packages/Makefile.am
=====================================
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-## Copyright (c) 2016-2019 Davide Madrisan <davide.madrisan at gmail.com>
+## Copyright (c) 2016-2024 Davide Madrisan <davide.madrisan at gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -33,26 +33,31 @@ MULTIBUILD_OPTS = \
--pckver $(PACKAGE_VERSION)
TARGETS_ALPINE = \
- alpine-3.14 \
- alpine-3.15 \
- alpine-3.16
-alpine-latest: alpine-3.16
+ alpine-3.16 \
+ alpine-3.17 \
+ alpine-3.18
+alpine-latest: alpine-3.18
TARGETS_CENTOS_STREAM = \
centos-stream-8 centos-stream-9
centos-stream-latest: centos-stream-9
TARGETS_DEBIAN = \
- debian-stretch debian-buster debian-bullseye
-debian-9: debian-stretch
+ debian-buster debian-bullseye debian-bookworm
debian-10: debian-buster
debian-11: debian-bullseye
-debian-latest: debian-bullseye
+debian-12: debian-bookworm
+debian-latest: debian-bookworm
-TARGETS_REDHAT = \
- fedora-34 fedora-35 fedora-36 \
+TARGETS_FEDORA = \
+ fedora-37 fedora-38 fedora-39 \
fedora-rawhide
-fedora-latest: fedora-36
+fedora-latest: fedora-39
+
+TARGETS_ROCKY = \
+ rockylinux-8 \
+ rockylinux-9
+rockylinux-latest: rockylinux-9
.PHONY: specfile
specfile:
@@ -79,7 +84,13 @@ $(TARGETS_DEBIAN): source-archive $(DOCKER) $(MULTIBUILD_SCRIPT)
$(SHELL) $(MULTIBUILD_SCRIPT) $(MULTIBUILD_OPTS) \
--os $$distr --target pcks/$@
-$(TARGETS_REDHAT): specfile source-archive $(DOCKER) $(MULTIBUILD_SCRIPT)
+$(TARGETS_FEDORA): specfile source-archive $(DOCKER) $(MULTIBUILD_SCRIPT)
+ @distr=`echo $@ | sed s/-/:/`; \
+ $(SHELL) $(MULTIBUILD_SCRIPT) $(MULTIBUILD_OPTS) \
+ --spec $(multibuilddir)/specs/$(SPECFILE) \
+ --os $$distr --target pcks/$@
+
+$(TARGETS_ROCKY): specfile source-archive $(DOCKER) $(MULTIBUILD_SCRIPT)
@distr=`echo $@ | sed s/-/:/`; \
$(SHELL) $(MULTIBUILD_SCRIPT) $(MULTIBUILD_OPTS) \
--spec $(multibuilddir)/specs/$(SPECFILE) \
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/packages/multibuild.sh
=====================================
@@ -1,6 +1,6 @@
#!/bin/bash
# Multi-platform build system
-# Copyright (C) 2016-2020 Davide Madrisan <davide.madrisan at gmail.com>
+# Copyright (C) 2016-2023 Davide Madrisan <davide.madrisan at gmail.com>
PROGNAME="${0##*/}"
PROGPATH="${0%/*}"
@@ -33,9 +33,11 @@ Where:
-u|--uid : user ID of the user 'developer' used for building the software
Supported distributions:
- CentOS 5/6/7/8
- Debian 9/10/11
- Fedora 33/34/35/rawhide
+ CentOS 5-8
+ CentOS Stream 8, 9
+ Debian 9-12
+ Fedora 33-38/rawhide
+ Rocky Linux 8, 9
Example:
$0 -s $PROGPATH/../../nagios-plugins-linux:/shared:rw \\
@@ -50,7 +52,7 @@ __EOF
help () {
cat <<__EOF
$PROGNAME v$REVISION - containerized software build checker
-Copyright (C) 2016-2021 Davide Madrisan <davide.madrisan at gmail.com>
+Copyright (C) 2016-2023 Davide Madrisan <davide.madrisan at gmail.com>
__EOF
@@ -159,6 +161,13 @@ build-essential bzip2 debhelper devscripts fakeroot gcc make pkg-config xz-utils
pcks_dev="bzip2 make gcc libcurl-devel libvarlink-devel xz rpm-build util-linux"
have_libcurl="1"
have_libvarlink="1" ;;
+ rockylinux-*)
+ pck_format="rpm"
+ pck_install="dnf install -y"
+ pck_dist=".el${os:11:1}"
+ pcks_dev="bzip2 make gcc libcurl-devel xz rpm-build util-linux"
+ have_libcurl="1"
+ have_libvarlink="0" ;;
*) die "unsupported os: $os" ;;
esac
pck_dist="${pck_dist}${usr_distro:+.$usr_distro}"
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/packages/specs/nagios-plugins-linux.spec.in
=====================================
@@ -28,6 +28,8 @@ Requires: nagios-plugins-linux-clock
Requires: nagios-plugins-linux-cpu
Requires: nagios-plugins-linux-cpufreq
Requires: nagios-plugins-linux-cswch
+Requires: nagios-plugins-linux-fc
+Requires: nagios-plugins-linux-filecount
Requires: nagios-plugins-linux-ifmountfs
Requires: nagios-plugins-linux-intr
Requires: nagios-plugins-linux-iowait
@@ -92,6 +94,13 @@ Group: Applications/System
%description fc
This Nagios plugin monitors the status of the fiber status ports.
+%package filecount
+Summary: Nagios plugins for Linux - check_filecount
+Group: Applications/System
+
+%description filecount
+This Nagios plugin checks the number of files found in one or more directories.
+
%package ifmountfs
Summary: Nagios plugins for Linux - check_ifmountfs
Group: Applications/System
@@ -218,6 +227,10 @@ This Nagios plugin displays the number of users that are currently logged on.
%build
%configure --libexecdir=%{_libdir}/nagios/plugins \
+ --enable-libcurl \
+%if 0%{?have_libvarlink}
+ --enable-libvarlink \
+%endif
%if 0%{?rhel} < 7
--with-socketfile=/var/run/multipathd.sock
%endif
@@ -258,6 +271,10 @@ make DESTDIR=%{buildroot} install
%defattr(-,root,root)
%{_libdir}/nagios/plugins/check_fc
+%files filecount
+%defattr(-,root,root)
+%{_libdir}/nagios/plugins/check_filecount
+
%files ifmountfs
%defattr(-,root,root)
%{_libdir}/nagios/plugins/check_ifmountfs
@@ -330,6 +347,5 @@ make DESTDIR=%{buildroot} install
%{_libdir}/nagios/plugins/check_users
%changelog
-
* @date@ Davide Madrisan <davide.madrisan at gmail.com> @version at -@release@
- Upstream version @version@
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/plugins/check_memory.c
=====================================
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
/*
* License: GPLv3+
- * Copyright (c) 2014-2019 Davide Madrisan <davide.madrisan at gmail.com>
+ * Copyright (c) 2014-2022 Davide Madrisan <davide.madrisan at gmail.com>
*
* A Nagios plugin to check system memory usage on Linux.
*
@@ -34,6 +34,7 @@
#include "perfdata.h"
#include "progname.h"
#include "progversion.h"
+#include "string-macros.h"
#include "system.h"
#include "thresholds.h"
#include "units.h"
@@ -42,7 +43,7 @@
#include "xasprintf.h"
static const char *program_copyright =
- "Copyright (C) 2014-2019 Davide Madrisan <" PACKAGE_BUGREPORT ">\n";
+ "Copyright (C) 2014-2022 Davide Madrisan <" PACKAGE_BUGREPORT ">\n";
static struct option const longopts[] = {
{(char *) "available", no_argument, NULL, 'a'},
@@ -54,6 +55,7 @@ static struct option const longopts[] = {
{(char *) "kilobyte", no_argument, NULL, 'k'},
{(char *) "megabyte", no_argument, NULL, 'm'},
{(char *) "gigabyte", no_argument, NULL, 'g'},
+ {(char *) "units", required_argument, 0, 'u'},
{(char *) "help", no_argument, NULL, GETOPT_HELP_CHAR},
{(char *) "version", no_argument, NULL, GETOPT_VERSION_CHAR},
{NULL, 0, NULL, 0}
@@ -66,7 +68,7 @@ usage (FILE * out)
fputs ("This plugin checks the system memory utilization.\n", out);
fputs (program_copyright, out);
fputs (USAGE_HEADER, out);
- fprintf (out, " %s [-a] [-b,-k,-m,-g] [-s] -w PERC -c PERC\n",
+ fprintf (out, " %s [-a] [-b,-k,-m,-g] [-s] [-u UNIT] -w PERC -c PERC\n",
program_name);
fputs (USAGE_OPTIONS, out);
fputs (" -a, --available display the free/available memory\n",
@@ -74,11 +76,15 @@ usage (FILE * out)
fputs (" -b,-k,-m,-g "
"show output in bytes, KB (the default), MB, or GB\n", out);
fputs (" -s, --vmstats display the virtual memory perfdata\n", out);
+ fputs (" -u, --units show output in the selected unit (default: KB),\n",
+ out);
+ fputs (" choose bytes, B, kB, MB, GB, KiB, MiB, GiB\n",
+ out);
fputs (" -w, --warning PERCENT warning threshold\n", out);
fputs (" -c, --critical PERCENT critical threshold\n", out);
fputs (USAGE_HELP, out);
fputs (USAGE_VERSION, out);
- fputs (USAGE_NOTE, out);
+ fputs (USAGE_NOTE_1, out);
fputs (" The option '-a|--available' gives an estimation of the "
"available memory\n"
" for starting new applications without swapping.\n", out);
@@ -86,11 +92,15 @@ usage (FILE * out)
"information in\n"
" /proc/meminfo (see the parameter 'MemAvailable').\n", out);
fputs (" A MemAvailable fall-back code is implemented for "
- "kernels 2.6.27 and above.\n", out);
- fputs (" For older kernels 'MemFree' is returned instead.\n",
- out);
+ "kernels 2.6.27 and above.\n", out);
+ fputs (" For older kernels 'MemFree' is returned instead.\n", out);
+ fputs (USAGE_NOTE_2, out);
+ fputs (" kB/MB/GB are still calculated as their respective binary units "
+ "due to\n", out);
+ fputs (" backward compatibility issues.\n", out);
fputs (USAGE_EXAMPLES, out);
fprintf (out, " %s --available -w 20%%: -c 10%%:\n", program_name);
+ fprintf (out, " %s --available --units MiB -w 20%%: -c 10%%:\n", program_name);
fprintf (out, " %s --vmstats -w 80%% -c90%%\n", program_name);
exit (out == stderr ? STATE_UNKNOWN : STATE_OK);
@@ -147,7 +157,7 @@ main (int argc, char **argv)
set_program_name (argv[0]);
while ((c = getopt_long (argc, argv,
- "aMSCsc:w:bkmg" GETOPT_HELP_VERSION_STRING,
+ "aMSCsc:w:bkmgu:" GETOPT_HELP_VERSION_STRING,
longopts, NULL)) != -1)
{
switch (c)
@@ -173,6 +183,23 @@ main (int argc, char **argv)
case 'k': shift = k_shift; units = xstrdup ("kB"); break;
case 'm': shift = m_shift; units = xstrdup ("MB"); break;
case 'g': shift = g_shift; units = xstrdup ("GB"); break;
+ case 'u':
+ if (units)
+ free (units);
+
+ if (STREQ (optarg, "B") || STREQ (optarg, "bytes"))
+ shift = b_shift;
+ else if (STREQ (optarg, "kB") || STREQ (optarg, "KiB"))
+ shift = k_shift;
+ else if (STREQ (optarg, "MB") || STREQ (optarg, "MiB"))
+ shift = m_shift;
+ else if (STREQ (optarg, "GB") || STREQ (optarg, "GiB"))
+ shift = g_shift;
+ else
+ plugin_error (STATE_UNKNOWN, 0, "unit type %s not known", optarg);
+
+ units = xstrdup (optarg);
+ break;
case_GETOPT_HELP_CHAR
case_GETOPT_VERSION_CHAR
@@ -188,7 +215,7 @@ main (int argc, char **argv)
usage (stderr);
/* output in kilobytes by default */
- if (units == NULL)
+ if (NULL == units)
units = xstrdup ("kB");
err = proc_sysmem_new (&sysmem);
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/plugins/check_users.c
=====================================
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
/*
* License: GPLv3+
- * Copyright (c) 2014,2015 Davide Madrisan <davide.madrisan at gmail.com>
+ * Copyright (c) 2014,2015,2023 Davide Madrisan <davide.madrisan at gmail.com>
*
* A Nagios plugin that ckecks for the number of logged on users.
*
@@ -24,7 +24,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#if !defined(WITH_SYSTEMD)
#include <utmpx.h>
+#else
+#include <systemd/sd-login.h>
+#endif
#include "common.h"
#include "messages.h"
@@ -33,7 +37,7 @@
#include "thresholds.h"
static const char *program_copyright =
- "Copyright (C) 2014,2015 Davide Madrisan <" PACKAGE_BUGREPORT ">\n";
+ "Copyright (C) 2014,2015,2023 Davide Madrisan <" PACKAGE_BUGREPORT ">\n";
static struct option const longopts[] = {
{(char *) "critical", required_argument, NULL, 'c'},
@@ -76,13 +80,50 @@ print_version (void)
exit (STATE_OK);
}
+static int
+count_users (bool verbose)
+{
+ int numuser = 0;
+
+#if defined(WITH_SYSTEMD)
+ /* sd_get_sessions() will not return ENOENT as error, as this only means
+ * that there is no session, not that systemd is not used.
+ * Use the recommended sd_booted() function for this.
+ */
+ if (sd_booted() > 0)
+ return sd_get_sessions(NULL);
+#endif
+
+ struct utmpx *ut;
+
+ if (verbose)
+ printf ("user PID line host date/time\n");
+ setutxent ();
+ while ((ut = getutxent ()))
+ {
+ if ((ut->ut_type == USER_PROCESS) && (ut->ut_user[0] != '\0'))
+ {
+ numuser++;
+ if (!verbose)
+ continue;
+ char buf[26];
+ time_t timetmp = ut->ut_tv.tv_sec;
+ printf ("%-8s %6ld %-6.6s %-9.9s %s", ut->ut_user,
+ (long) ut->ut_pid, ut->ut_line, ut->ut_host,
+ ctime_r (&timetmp, buf));
+ }
+ }
+ endutxent ();
+
+ return numuser;
+}
+
int
main (int argc, char **argv)
{
int c, numuser;
bool verbose = false;
char *critical = NULL, *warning = NULL;
- struct utmpx *ut;
nagstatus status = STATE_OK;
thresholds *my_threshold = NULL;
@@ -116,25 +157,10 @@ main (int argc, char **argv)
if (status == NP_RANGE_UNPARSEABLE)
usage (stderr);
- numuser = 0;
- if (verbose)
- printf ("user PID line host date/time\n");
- setutxent ();
- while ((ut = getutxent ()))
- {
- if ((ut->ut_type == USER_PROCESS) && (ut->ut_user[0] != '\0'))
- {
- numuser++;
- if (!verbose)
- continue;
- char buf[26];
- time_t timetmp = ut->ut_tv.tv_sec;
- printf ("%-8s %5ld %-6.6s %-9.9s %s", ut->ut_user,
- (long) ut->ut_pid, ut->ut_line, ut->ut_host,
- ctime_r (&timetmp, buf));
- }
- }
- endutxent ();
+ numuser = count_users (verbose);
+ if (numuser < 0)
+ plugin_error (STATE_UNKNOWN, numuser,
+ "cannot determine all current login sessions");
status = get_status (numuser, my_threshold);
free (my_threshold);
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/Makefile.am
=====================================
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-## Copyright (c) 2016-2019 Davide Madrisan <davide.madrisan at gmail.com>
+## Copyright (c) 2016-2022 Davide Madrisan <davide.madrisan at gmail.com>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -76,7 +76,7 @@ test_programs += \
tsuptime \
tstemperature
-test_libraries = tslib_uname.la
+test_libraries = tslibuname.la
test_utils = \
$(top_srcdir)/include/testutils.h \
@@ -156,8 +156,8 @@ tstemperature_LDADD = $(LDADDS)
tstestutils_SOURCES = $(test_utils) tstestutils.c
tstestutils_LDADD = $(LDADDS)
-tslib_uname_la_SOURCES = tslib_uname.c
-tslib_uname_la_LDFLAGS = $(TSLIBS_LDFLAGS)
+tslibuname_la_SOURCES = tslibuname.c
+tslibuname_la_LDFLAGS = $(TSLIBS_LDFLAGS)
if WITH_TESTS
noinst_PROGRAMS = $(test_programs)
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/tslibkernelver.c
=====================================
@@ -43,4 +43,4 @@ mymain (void)
#endif
}
-TEST_MAIN_PRELOAD (mymain, abs_builddir "/.libs/tslib_uname.so");
+TEST_MAIN_PRELOAD (mymain, abs_builddir "/.libs/tslibuname.so");
=====================================
madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/tslib_uname.c → madrisan-nagios-plugins-linux/nagios-plugins-linux/tests/tslibuname.c
=====================================
View it on GitLab: https://salsa.debian.org/nagios-team/nagios-plugins-contrib/-/compare/4f389594eda1047627adbff2f7fb711324e53212...9f95871ded022e9d7e302553417d37c36ab857e5
--
View it on GitLab: https://salsa.debian.org/nagios-team/nagios-plugins-contrib/-/compare/4f389594eda1047627adbff2f7fb711324e53212...9f95871ded022e9d7e302553417d37c36ab857e5
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nagios-changes/attachments/20231212/22dc7a39/attachment-0001.htm>
More information about the pkg-nagios-changes
mailing list