[monitoring-plugins] Revert "Don' t let check_disk hang on hanging file ...

Holger Weiss git at monitoring-plugins.org
Mon Oct 12 11:40:10 CEST 2015


 Module: monitoring-plugins
 Branch: master
 Commit: 11c5796d0a3ac3cb9ccbf004f67ebf6eabcc95bc
 Author: Holger Weiss <holger at zedat.fu-berlin.de>
   Date: Mon Oct 12 11:07:02 2015 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=11c5796

Revert "Don't let check_disk hang on hanging file systems"

This reverts commit 6986aa1d0a352d8d02eed4896034631fffd25a27.  That
commit leads to issues on non-Linux systems, and it seems to not
(always) work as expected on Linux, either.

Conflicts:
	plugins/Makefile.am
	plugins/check_disk.c

Closes #1377 and closes #1329.

---

 NEWS                 |  1 -
 configure.ac         |  6 ------
 plugins/Makefile.am  |  2 +-
 plugins/check_disk.c | 43 -------------------------------------------
 4 files changed, 1 insertion(+), 51 deletions(-)

diff --git a/NEWS b/NEWS
index ce1a389..e1efcc6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,6 @@ This file documents the major additions and syntax changes between releases.
 	  thresholds
 	New check_snmp "-N" option to specify SNMPv3 context name
 	New check_nt "-l" parameters: seconds|minutes|hours|days
-	Make sure check_disk won't hang on hanging (network) file systems
 	New check_mailq -s option which tells the plugin to use sudo(8)
 	New -W/-C option for check_ldap to check number of entries (Gerhard Lausser)
 	The check_http -S/--ssl option now accepts the arguments "1.1" and "1.2"
diff --git a/configure.ac b/configure.ac
index ce1728e..29de4bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,12 +156,6 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
 AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv")
 AC_SUBST(SOCKETLIBS)
 
-dnl Check for POSIX thread libraries
-AC_CHECK_HEADERS(pthread.h)
-AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread",
-             AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread -lrt",-lrt))
-AC_SUBST(THREADLIBS)
-
 dnl
 dnl check for math-related functions needing -lm
 AC_CHECK_HEADERS(math.h)
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 41906c5..0ddf9bd 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -71,7 +71,7 @@ check_apt_LDADD = $(BASEOBJS)
 check_cluster_LDADD = $(BASEOBJS)
 check_dbi_LDADD = $(NETLIBS) $(DBILIBS)
 check_dig_LDADD = $(NETLIBS)
-check_disk_LDADD = $(BASEOBJS) $(THREADLIBS)
+check_disk_LDADD = $(BASEOBJS)
 check_dns_LDADD = $(NETLIBS)
 check_dummy_LDADD = $(BASEOBJS)
 check_fping_LDADD = $(NETLIBS)
diff --git a/plugins/check_disk.c b/plugins/check_disk.c
index 9693bad..874a0ee 100644
--- a/plugins/check_disk.c
+++ b/plugins/check_disk.c
@@ -51,9 +51,6 @@ const char *email = "devel at monitoring-plugins.org";
 # include <limits.h>
 #endif
 #include "regex.h"
-#if HAVE_PTHREAD_H
-# include <pthread.h>
-#endif
 
 #ifdef __CYGWIN__
 # include <windows.h>
@@ -133,7 +130,6 @@ void print_help (void);
 void print_usage (void);
 double calculate_percent(uintmax_t, uintmax_t);
 void stat_path (struct parameter_list *p);
-void *do_stat_path (void *p);
 void get_stats (struct parameter_list *p, struct fs_usage *fsp);
 void get_path_stats (struct parameter_list *p, struct fs_usage *fsp);
 
@@ -972,44 +968,6 @@ print_usage (void)
 void
 stat_path (struct parameter_list *p)
 {
-#ifdef HAVE_PTHREAD_H
-  pthread_t stat_thread;
-  int statdone = 0;
-  int timer = timeout_interval;
-  struct timespec req, rem;
-
-  req.tv_sec = 0;
-  pthread_create(&stat_thread, NULL, do_stat_path, p);
-  while (timer-- > 0) {
-    req.tv_nsec = 10000000;
-    nanosleep(&req, &rem);
-    if (pthread_kill(stat_thread, 0)) {
-      statdone = 1;
-      break;
-    } else {
-      req.tv_nsec = 990000000;
-      nanosleep(&req, &rem);
-    }
-  }
-  if (statdone == 1) {
-    pthread_join(stat_thread, NULL);
-  } else {
-    pthread_detach(stat_thread);
-    if (verbose >= 3)
-      printf("stat did not return within %ds on %s\n", timeout_interval, p->name);
-    printf("DISK %s - ", _("CRITICAL"));
-    die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("hangs"), _("Timeout"));
-  }
-#else
-  do_stat_path(p);
-#endif
-}
-
-void *
-do_stat_path (void *in)
-{
-  struct parameter_list *p = in;
-
   /* Stat entry to check that dir exists and is accessible */
   if (verbose >= 3)
     printf("calling stat on %s\n", p->name);
@@ -1019,7 +977,6 @@ do_stat_path (void *in)
     printf("DISK %s - ", _("CRITICAL"));
     die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno));
   }
-  return NULL;
 }
 
 



More information about the Commits mailing list