diff options
Diffstat (limited to 'web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch')
-rw-r--r-- | web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch b/web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch new file mode 100644 index 0000000..1e4e0fa --- /dev/null +++ b/web/attachments/325264-nagios-plugins-1.4.13.check_disks.nfs.patch | |||
@@ -0,0 +1,98 @@ | |||
1 | diff -Naur nagios-plugins-1.4.13/configure.in nagios-plugins-1.4.13.nfs/configure.in | ||
2 | --- nagios-plugins-1.4.13/configure.in 2008-09-25 10:15:58.000000000 +0200 | ||
3 | +++ nagios-plugins-1.4.13.nfs/configure.in 2009-05-01 11:33:59.000000000 +0200 | ||
4 | @@ -453,6 +453,18 @@ | ||
5 | with_gnutls="no" | ||
6 | fi | ||
7 | |||
8 | +dnl Check for POSIX thread libraries | ||
9 | +AC_CHECK_HEADERS(pthread.h) | ||
10 | +case $host in | ||
11 | + *sun* | *solaris*) | ||
12 | + AC_CHECK_LIB(pthread,pthread_create,THRLIBS="-lpthread -lrt") | ||
13 | + ;; | ||
14 | + *) | ||
15 | + AC_CHECK_LIB(pthread,pthread_create,THRLIBS="-lpthread") | ||
16 | + ;; | ||
17 | +esac | ||
18 | +AC_SUBST(THRLIBS) | ||
19 | + | ||
20 | dnl | ||
21 | dnl Checks for header files. | ||
22 | dnl | ||
23 | diff -Naur nagios-plugins-1.4.13/plugins/check_disk.c nagios-plugins-1.4.13.nfs/plugins/check_disk.c | ||
24 | --- nagios-plugins-1.4.13/plugins/check_disk.c 2008-07-10 12:03:55.000000000 +0200 | ||
25 | +++ nagios-plugins-1.4.13.nfs/plugins/check_disk.c 2009-05-01 11:34:18.000000000 +0200 | ||
26 | @@ -55,6 +55,9 @@ | ||
27 | # include <limits.h> | ||
28 | #endif | ||
29 | #include "regex.h" | ||
30 | +#if HAVE_PTHREAD_H | ||
31 | +# include <pthread.h> | ||
32 | +#endif | ||
33 | |||
34 | |||
35 | /* If nonzero, show inode information. */ | ||
36 | @@ -129,6 +132,7 @@ | ||
37 | void print_usage (void); | ||
38 | double calculate_percent(uintmax_t, uintmax_t); | ||
39 | void stat_path (struct parameter_list *p); | ||
40 | +void do_stat_path (struct parameter_list *p); | ||
41 | |||
42 | double w_dfp = -1.0; | ||
43 | double c_dfp = -1.0; | ||
44 | @@ -993,6 +997,42 @@ | ||
45 | void | ||
46 | stat_path (struct parameter_list *p) | ||
47 | { | ||
48 | +#ifdef HAVE_PTHREAD_H | ||
49 | + pthread_t stat_thread; | ||
50 | + int status; | ||
51 | + int statdone = 0; | ||
52 | + int timer = timeout_interval; | ||
53 | + struct timespec req, rem; | ||
54 | + req.tv_sec = 0; | ||
55 | + pthread_create(&stat_thread, NULL, do_stat_path, p); | ||
56 | + while (timer-- > 0) { | ||
57 | + req.tv_nsec = 10000000; | ||
58 | + nanosleep(&req, &rem); | ||
59 | + if (pthread_kill(stat_thread, 0)) { | ||
60 | + statdone = 1; | ||
61 | + break; | ||
62 | + } else { | ||
63 | + req.tv_nsec = 990000000; | ||
64 | + nanosleep(&req, &rem); | ||
65 | + } | ||
66 | + } | ||
67 | + if (statdone == 1) { | ||
68 | + pthread_join(stat_thread, (void *)&status); | ||
69 | + } else { | ||
70 | + pthread_detach(stat_thread); | ||
71 | + if (verbose >= 3) | ||
72 | + printf("stat did not return within %ds on %s\n", timeout_interval, p->name); | ||
73 | + printf("DISK %s - ", _("CRITICAL")); | ||
74 | + die (STATE_CRITICAL, _("%s %s: %s\n"), p->name, _("hangs"), _("Timeout")); | ||
75 | + } | ||
76 | +#else | ||
77 | + do_stat_path(p); | ||
78 | +#endif | ||
79 | +} | ||
80 | + | ||
81 | +void | ||
82 | +do_stat_path (struct parameter_list *p) | ||
83 | +{ | ||
84 | /* Stat entry to check that dir exists and is accessible */ | ||
85 | if (verbose >= 3) | ||
86 | printf("calling stat on %s\n", p->name); | ||
87 | diff -Naur nagios-plugins-1.4.13/plugins/Makefile.am nagios-plugins-1.4.13.nfs/plugins/Makefile.am | ||
88 | --- nagios-plugins-1.4.13/plugins/Makefile.am 2008-07-08 11:31:04.000000000 +0200 | ||
89 | +++ nagios-plugins-1.4.13.nfs/plugins/Makefile.am 2009-05-01 11:34:26.000000000 +0200 | ||
90 | @@ -54,7 +54,7 @@ | ||
91 | check_apt_LDADD = $(BASEOBJS) runcmd.o | ||
92 | check_cluster_LDADD = $(BASEOBJS) | ||
93 | check_dig_LDADD = $(NETLIBS) runcmd.o | ||
94 | -check_disk_LDADD = $(BASEOBJS) popen.o | ||
95 | +check_disk_LDADD = $(BASEOBJS) popen.o $(THRLIBS) | ||
96 | check_dns_LDADD = $(NETLIBS) runcmd.o | ||
97 | check_dummy_LDADD = $(BASEOBJS) | ||
98 | check_fping_LDADD = $(NETLIBS) popen.o | ||