summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am2
-rw-r--r--plugins/check_disk.c43
-rw-r--r--plugins/check_dns.c2
-rw-r--r--plugins/check_ldap.c2
-rw-r--r--plugins/check_smtp.c2
-rw-r--r--plugins/check_snmp.c3
-rw-r--r--plugins/check_ups.c12
-rw-r--r--plugins/t/check_http.t2
-rw-r--r--plugins/t/check_snmp.t4
9 files changed, 14 insertions, 58 deletions
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)
71check_cluster_LDADD = $(BASEOBJS) 71check_cluster_LDADD = $(BASEOBJS)
72check_dbi_LDADD = $(NETLIBS) $(DBILIBS) 72check_dbi_LDADD = $(NETLIBS) $(DBILIBS)
73check_dig_LDADD = $(NETLIBS) 73check_dig_LDADD = $(NETLIBS)
74check_disk_LDADD = $(BASEOBJS) $(THREADLIBS) 74check_disk_LDADD = $(BASEOBJS)
75check_dns_LDADD = $(NETLIBS) 75check_dns_LDADD = $(NETLIBS)
76check_dummy_LDADD = $(BASEOBJS) 76check_dummy_LDADD = $(BASEOBJS)
77check_fping_LDADD = $(NETLIBS) 77check_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@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);
133void print_usage (void); 130void print_usage (void);
134double calculate_percent(uintmax_t, uintmax_t); 131double calculate_percent(uintmax_t, uintmax_t);
135void stat_path (struct parameter_list *p); 132void stat_path (struct parameter_list *p);
136void *do_stat_path (void *p);
137void get_stats (struct parameter_list *p, struct fs_usage *fsp); 133void get_stats (struct parameter_list *p, struct fs_usage *fsp);
138void get_path_stats (struct parameter_list *p, struct fs_usage *fsp); 134void get_path_stats (struct parameter_list *p, struct fs_usage *fsp);
139 135
@@ -972,44 +968,6 @@ print_usage (void)
972void 968void
973stat_path (struct parameter_list *p) 969stat_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
1008void *
1009do_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
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index d6bd2c0..48601f0 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -127,7 +127,7 @@ main (int argc, char **argv)
127 if (verbose) 127 if (verbose)
128 puts(chld_out.line[i]); 128 puts(chld_out.line[i]);
129 129
130 if (strstr (chld_out.line[i], ".in-addr.arpa")) { 130 if (strcasestr (chld_out.line[i], ".in-addr.arpa")) {
131 if ((temp_buffer = strstr (chld_out.line[i], "name = "))) 131 if ((temp_buffer = strstr (chld_out.line[i], "name = ")))
132 addresses[n_addresses++] = strdup (temp_buffer + 7); 132 addresses[n_addresses++] = strdup (temp_buffer + 7);
133 else { 133 else {
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index e70d6a5..66be4b4 100644
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
@@ -483,7 +483,7 @@ print_help (void)
483 483
484 printf (" %s\n", "-W [--warn-entries]"); 484 printf (" %s\n", "-W [--warn-entries]");
485 printf (" %s\n", _("Number of found entries to result in warning status")); 485 printf (" %s\n", _("Number of found entries to result in warning status"));
486 printf (" %s\n", "-W [--crit-entries]"); 486 printf (" %s\n", "-C [--crit-entries]");
487 printf (" %s\n", _("Number of found entries to result in critical status")); 487 printf (" %s\n", _("Number of found entries to result in critical status"));
488 488
489 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); 489 printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT);
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 2e9b68b..1996c6d 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -231,7 +231,7 @@ main (int argc, char **argv)
231 send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); 231 send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0);
232 232
233 recvlines(buffer, MAX_INPUT_BUFFER); /* wait for it */ 233 recvlines(buffer, MAX_INPUT_BUFFER); /* wait for it */
234 if (!strstr (buffer, server_expect)) { 234 if (!strstr (buffer, SMTP_EXPECT)) {
235 printf (_("Server does not support STARTTLS\n")); 235 printf (_("Server does not support STARTTLS\n"));
236 smtp_quit(); 236 smtp_quit();
237 return STATE_UNKNOWN; 237 return STATE_UNKNOWN;
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 28cc44d..9839d6e 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -41,7 +41,6 @@ const char *email = "devel@monitoring-plugins.org";
41#define DEFAULT_PORT "161" 41#define DEFAULT_PORT "161"
42#define DEFAULT_MIBLIST "ALL" 42#define DEFAULT_MIBLIST "ALL"
43#define DEFAULT_PROTOCOL "1" 43#define DEFAULT_PROTOCOL "1"
44#define DEFAULT_TIMEOUT 1
45#define DEFAULT_RETRIES 5 44#define DEFAULT_RETRIES 5
46#define DEFAULT_AUTH_PROTOCOL "MD5" 45#define DEFAULT_AUTH_PROTOCOL "MD5"
47#define DEFAULT_PRIV_PROTOCOL "DES" 46#define DEFAULT_PRIV_PROTOCOL "DES"
@@ -227,7 +226,7 @@ main (int argc, char **argv)
227 outbuff = strdup (""); 226 outbuff = strdup ("");
228 delimiter = strdup (" = "); 227 delimiter = strdup (" = ");
229 output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); 228 output_delim = strdup (DEFAULT_OUTPUT_DELIMITER);
230 timeout_interval = DEFAULT_TIMEOUT; 229 timeout_interval = DEFAULT_SOCKET_TIMEOUT;
231 retries = DEFAULT_RETRIES; 230 retries = DEFAULT_RETRIES;
232 231
233 np_init( (char *) progname, argc, argv ); 232 np_init( (char *) progname, argc, argv );
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index dc5a348..e9e56a5 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -242,8 +242,8 @@ main (int argc, char **argv)
242 } 242 }
243 xasprintf (&data, "%s %s", data, 243 xasprintf (&data, "%s %s", data,
244 perfdata ("battery", (long)ups_battery_percent, "%", 244 perfdata ("battery", (long)ups_battery_percent, "%",
245 check_warn, (long)(1000*warning_value), 245 check_warn, (long)(warning_value),
246 check_crit, (long)(1000*critical_value), 246 check_crit, (long)(critical_value),
247 TRUE, 0, TRUE, 100)); 247 TRUE, 0, TRUE, 100));
248 } else { 248 } else {
249 xasprintf (&data, "%s %s", data, 249 xasprintf (&data, "%s %s", data,
@@ -271,8 +271,8 @@ main (int argc, char **argv)
271 } 271 }
272 xasprintf (&data, "%s %s", data, 272 xasprintf (&data, "%s %s", data,
273 perfdata ("load", (long)ups_load_percent, "%", 273 perfdata ("load", (long)ups_load_percent, "%",
274 check_warn, (long)(1000*warning_value), 274 check_warn, (long)(warning_value),
275 check_crit, (long)(1000*critical_value), 275 check_crit, (long)(critical_value),
276 TRUE, 0, TRUE, 100)); 276 TRUE, 0, TRUE, 100));
277 } else { 277 } else {
278 xasprintf (&data, "%s %s", data, 278 xasprintf (&data, "%s %s", data,
@@ -308,8 +308,8 @@ main (int argc, char **argv)
308 } 308 }
309 xasprintf (&data, "%s %s", data, 309 xasprintf (&data, "%s %s", data,
310 perfdata ("temp", (long)ups_temperature, tunits, 310 perfdata ("temp", (long)ups_temperature, tunits,
311 check_warn, (long)(1000*warning_value), 311 check_warn, (long)(warning_value),
312 check_crit, (long)(1000*critical_value), 312 check_crit, (long)(critical_value),
313 TRUE, 0, FALSE, 0)); 313 TRUE, 0, FALSE, 0));
314 } else { 314 } else {
315 xasprintf (&data, "%s %s", data, 315 xasprintf (&data, "%s %s", data,
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t
index c2caec6..2b906e3 100644
--- a/plugins/t/check_http.t
+++ b/plugins/t/check_http.t
@@ -154,7 +154,7 @@ SKIP: {
154 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' ); 154 like ( $res->output, '/time_ssl=[\d\.]+/', 'Extended Performance Data SSL Output OK' );
155 155
156 $res = NPTest->testCmd( 156 $res = NPTest->testCmd(
157 "./check_http --ssl www.e-paycobalt.com" 157 "./check_http --ssl -H www.e-paycobalt.com"
158 ); 158 );
159 cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" ); 159 cmp_ok( $res->return_code, "==", 0, "Can read https for www.e-paycobalt.com (uses AES certificate)" );
160 160
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index 2d6c44a..aefd872 100644
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
@@ -166,8 +166,8 @@ SKIP: {
166SKIP: { 166SKIP: {
167 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive ); 167 skip "no non responsive host defined", 2 if ( ! $host_nonresponsive );
168 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:"); 168 $res = NPTest->testCmd( "./check_snmp -H $host_nonresponsive -C np_foobar -o system.sysUpTime.0 -w 1: -c 1:");
169 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 169 cmp_ok( $res->return_code, '==', 2, "Exit CRITICAL with non responsive host" );
170 like($res->output, '/External command error: Timeout: No Response from /', "String matches timeout problem"); 170 like($res->output, '/Plugin timed out while executing system call/', "String matches timeout problem");
171} 171}
172 172
173SKIP: { 173SKIP: {