diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-12 11:07:02 +0200 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2015-10-12 11:07:02 +0200 |
commit | 11c5796d0a3ac3cb9ccbf004f67ebf6eabcc95bc (patch) | |
tree | 8ab31fe9b2e88319fe66155abb1ada2bad9a9641 | |
parent | 813b3bd5a40a94ee46b2092357439756c960ae20 (diff) | |
download | monitoring-plugins-11c5796.tar.gz |
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.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | plugins/Makefile.am | 2 | ||||
-rw-r--r-- | plugins/check_disk.c | 43 |
4 files changed, 1 insertions, 51 deletions
@@ -6,7 +6,6 @@ This file documents the major additions and syntax changes between releases. | |||
6 | thresholds | 6 | thresholds |
7 | New check_snmp "-N" option to specify SNMPv3 context name | 7 | New check_snmp "-N" option to specify SNMPv3 context name |
8 | New check_nt "-l" parameters: seconds|minutes|hours|days | 8 | New check_nt "-l" parameters: seconds|minutes|hours|days |
9 | Make sure check_disk won't hang on hanging (network) file systems | ||
10 | New check_mailq -s option which tells the plugin to use sudo(8) | 9 | New check_mailq -s option which tells the plugin to use sudo(8) |
11 | New -W/-C option for check_ldap to check number of entries (Gerhard Lausser) | 10 | New -W/-C option for check_ldap to check number of entries (Gerhard Lausser) |
12 | The check_http -S/--ssl option now accepts the arguments "1.1" and "1.2" | 11 | The check_http -S/--ssl option now accepts the arguments "1.1" and "1.2" |
diff --git a/configure.ac b/configure.ac index ce1728e3..29de4bdc 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -156,12 +156,6 @@ AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket") | |||
156 | AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") | 156 | AC_CHECK_LIB(resolv,main,SOCKETLIBS="$SOCKETLIBS -lresolv") |
157 | AC_SUBST(SOCKETLIBS) | 157 | AC_SUBST(SOCKETLIBS) |
158 | 158 | ||
159 | dnl Check for POSIX thread libraries | ||
160 | AC_CHECK_HEADERS(pthread.h) | ||
161 | AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread", | ||
162 | AC_CHECK_LIB(pthread,pthread_create,THREADLIBS="-lpthread -lrt",-lrt)) | ||
163 | AC_SUBST(THREADLIBS) | ||
164 | |||
165 | dnl | 159 | dnl |
166 | dnl check for math-related functions needing -lm | 160 | dnl check for math-related functions needing -lm |
167 | AC_CHECK_HEADERS(math.h) | 161 | AC_CHECK_HEADERS(math.h) |
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 41906c53..0ddf9bd1 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
@@ -71,7 +71,7 @@ check_apt_LDADD = $(BASEOBJS) | |||
71 | check_cluster_LDADD = $(BASEOBJS) | 71 | check_cluster_LDADD = $(BASEOBJS) |
72 | check_dbi_LDADD = $(NETLIBS) $(DBILIBS) | 72 | check_dbi_LDADD = $(NETLIBS) $(DBILIBS) |
73 | check_dig_LDADD = $(NETLIBS) | 73 | check_dig_LDADD = $(NETLIBS) |
74 | check_disk_LDADD = $(BASEOBJS) $(THREADLIBS) | 74 | check_disk_LDADD = $(BASEOBJS) |
75 | check_dns_LDADD = $(NETLIBS) | 75 | check_dns_LDADD = $(NETLIBS) |
76 | check_dummy_LDADD = $(BASEOBJS) | 76 | check_dummy_LDADD = $(BASEOBJS) |
77 | check_fping_LDADD = $(NETLIBS) | 77 | check_fping_LDADD = $(NETLIBS) |
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 9693bad3..874a0ee0 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -51,9 +51,6 @@ const char *email = "devel@monitoring-plugins.org"; | |||
51 | # include <limits.h> | 51 | # include <limits.h> |
52 | #endif | 52 | #endif |
53 | #include "regex.h" | 53 | #include "regex.h" |
54 | #if HAVE_PTHREAD_H | ||
55 | # include <pthread.h> | ||
56 | #endif | ||
57 | 54 | ||
58 | #ifdef __CYGWIN__ | 55 | #ifdef __CYGWIN__ |
59 | # include <windows.h> | 56 | # include <windows.h> |
@@ -133,7 +130,6 @@ void print_help (void); | |||
133 | void print_usage (void); | 130 | void print_usage (void); |
134 | double calculate_percent(uintmax_t, uintmax_t); | 131 | double calculate_percent(uintmax_t, uintmax_t); |
135 | void stat_path (struct parameter_list *p); | 132 | void stat_path (struct parameter_list *p); |
136 | void *do_stat_path (void *p); | ||
137 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); | 133 | void get_stats (struct parameter_list *p, struct fs_usage *fsp); |
138 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); | 134 | void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); |
139 | 135 | ||
@@ -972,44 +968,6 @@ print_usage (void) | |||
972 | void | 968 | void |
973 | stat_path (struct parameter_list *p) | 969 | stat_path (struct parameter_list *p) |
974 | { | 970 | { |
975 | #ifdef HAVE_PTHREAD_H | ||
976 | pthread_t stat_thread; | ||
977 | int statdone = 0; | ||
978 | int timer = timeout_interval; | ||
979 | struct timespec req, rem; | ||
980 | |||
981 | req.tv_sec = 0; | ||
982 | pthread_create(&stat_thread, NULL, do_stat_path, p); | ||
983 | while (timer-- > 0) { | ||
984 | req.tv_nsec = 10000000; | ||
985 | nanosleep(&req, &rem); | ||
986 | if (pthread_kill(stat_thread, 0)) { | ||
987 | statdone = 1; | ||
988 | break; | ||
989 | } else { | ||
990 | req.tv_nsec = 990000000; | ||
991 | nanosleep(&req, &rem); | ||
992 | } | ||
993 | } | ||
994 | if (statdone == 1) { | ||
995 | pthread_join(stat_thread, NULL); | ||
996 | } else { | ||
997 | pthread_detach(stat_thread); | ||
998 | if (verbose >= 3) | ||
999 | printf("stat did not return within %ds on %s\n", timeout_interval, p->name); | ||
1000 | printf("DISK %s - ", _("CRITICAL")); | ||
1001 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("hangs"), _("Timeout")); | ||
1002 | } | ||
1003 | #else | ||
1004 | do_stat_path(p); | ||
1005 | #endif | ||
1006 | } | ||
1007 | |||
1008 | void * | ||
1009 | do_stat_path (void *in) | ||
1010 | { | ||
1011 | struct parameter_list *p = in; | ||
1012 | |||
1013 | /* Stat entry to check that dir exists and is accessible */ | 971 | /* Stat entry to check that dir exists and is accessible */ |
1014 | if (verbose >= 3) | 972 | if (verbose >= 3) |
1015 | printf("calling stat on %s\n", p->name); | 973 | printf("calling stat on %s\n", p->name); |
@@ -1019,7 +977,6 @@ do_stat_path (void *in) | |||
1019 | printf("DISK %s - ", _("CRITICAL")); | 977 | printf("DISK %s - ", _("CRITICAL")); |
1020 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); | 978 | die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("is not accessible"), strerror(errno)); |
1021 | } | 979 | } |
1022 | return NULL; | ||
1023 | } | 980 | } |
1024 | 981 | ||
1025 | 982 | ||