[Pkg-nagios-devel] Bug#1052218: bookworm-pu: package monitoring-plugins/2.3.3-5+deb12u1

Jan Wagner waja at cyconet.org
Tue Sep 19 07:35:02 BST 2023


Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian.org at packages.debian.org
Usertags: pu
X-Debbugs-Cc: monitoring-plugins at packages.debian.org
Control: affects -1 + src:monitoring-plugins

[ Reason ]
As reported in #1051768, check_disk has gotten very slow on a machine 
with a huge number of mount points (in excess of 16000).

[ Impact ]
check_disk used to take around 10 seconds on bullseye in this scenario,
now it is more than one hour

[ Tests ]
Upstream test suite, It was verified to work in the upstream issue 
tracker 
(https://github.com/monitoring-plugins/monitoring-plugins/issues/1919#issuecomment-1715348368) 
and 2.3.3-6 has also this fix, which is since some time in testing.

[ Risks ]
Low, trivial change.

[ Checklist ]
   [x] *all* changes are documented in the d/changelog
   [x] I reviewed all changes and I approve them
   [x] attach debdiff against the package in (old)stable
   [x] the issue is verified as fixed in unstable

[ Changes ]
The patch is required to speed up check_disk with a huge number of mount 
points.

[ Other info ]
This is a request for pre approval, if you are okay with the changes, 
I'll upload it.

Kind Regards,

Jan
-- 
Never write mail to <waja at spamfalle.info>, you have been warned!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT d-- s+: a C+++ UL++++ P+ L+++ E--- W+++ N+++ o++ K++ w--- O M+ V- PS 
PE Y++
PGP++ t-- 5 X R tv- b+ DI D+ G++ e++ h---- r+++ y++++
------END GEEK CODE BLOCK------
-------------- next part --------------
diff --git a/debian/changelog b/debian/changelog
index d938ad6..d0b7b5b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+monitoring-plugins (2.3.3-5+deb12u1) bookworm; urgency=medium
+
+  * [85eed74] Adding d/p/22_check_disk_avoid_mount from upstream
+    (Closes: #1051768)
+
+ -- Jan Wagner <waja at cyconet.org>  Tue, 19 Sep 2023 07:54:14 +0200
+
 monitoring-plugins (2.3.3-5) unstable; urgency=medium
 
   * [6fb8e25] Adding d/p/14_check_curl_fix_SSL_with_multiple_IPs from upstream
diff --git a/debian/patches/22_check_disk_avoid_mount b/debian/patches/22_check_disk_avoid_mount
new file mode 100644
index 0000000..49a7113
--- /dev/null
+++ b/debian/patches/22_check_disk_avoid_mount
@@ -0,0 +1,47 @@
+From 0dd11100aa92bab172293ec9615a8a56b0e35ee6 Mon Sep 17 00:00:00 2001
+From: Stefan Taferner <stefan.taferner at porscheinformatik.com>
+Date: Wed, 10 May 2023 19:28:05 +0200
+Subject: [PATCH] avoid mounting when searching for matching mount points
+
+---
+ lib/utils_disk.c | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/lib/utils_disk.c b/lib/utils_disk.c
+index 468769b19..582d3ea17 100644
+--- a/lib/utils_disk.c
++++ b/lib/utils_disk.c
+@@ -147,24 +147,25 @@ np_set_best_match(struct parameter_list *desired, struct mount_entry *mount_list
+ 
+       /* set best match if path name exactly matches a mounted device name */
+       for (me = mount_list; me; me = me->me_next) {
+-	if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) < 0)
+-	  continue; /* skip if permissions do not suffice for accessing device */
+-        if (strcmp(me->me_devname, d->name)==0)
+-          best_match = me;
++        if (strcmp(me->me_devname, d->name)==0) {
++          if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) >= 0) {
++            best_match = me;
++          }
++        }
+       }
+ 
+       /* set best match by directory name if no match was found by devname */
+       if (! best_match) {
+         for (me = mount_list; me; me = me->me_next) {
+-	  if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) < 0)
+-	    continue; /* skip if permissions do not suffice for accessing device */
+           size_t len = strlen (me->me_mountdir);
+           if ((exact == FALSE && (best_match_len <= len && len <= name_len &&
+              (len == 1 || strncmp (me->me_mountdir, d->name, len) == 0)))
+              || (exact == TRUE && strcmp(me->me_mountdir, d->name)==0))
+           {
+-            best_match = me;
+-            best_match_len = len;
++            if (get_fs_usage(me->me_mountdir, me->me_devname, &fsp) >= 0) {
++              best_match = me;
++              best_match_len = len;
++            }
+           }
+         }
+       }
diff --git a/debian/patches/series b/debian/patches/series
index ae89285..b024b25 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@
 14_check_curl_fix_SSL_with_multiple_IPs
 15_check_swap_remove_includes
 16_check_snmp_disable_multiplier_when_unused
+22_check_disk_avoid_mount


More information about the Pkg-nagios-devel mailing list