summaryrefslogtreecommitdiffstats
path: root/plugins/check_time.c
diff options
context:
space:
mode:
authorKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-09 13:36:49 (GMT)
committerKarl DeBisschop <kdebisschop@users.sourceforge.net>2003-08-09 13:36:49 (GMT)
commit90b45deb4138efb47efbdd98a4aede1aebb47146 (patch)
treed27a0180ce89542ee546a0b1e958b68a114ea7ce /plugins/check_time.c
parent4784cac1f017a67978c2f3f2af75b161d1ef33c0 (diff)
downloadmonitoring-plugins-90b45deb4138efb47efbdd98a4aede1aebb47146.tar.gz
more pedantic compiler warnings
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@674 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_time.c')
-rw-r--r--plugins/check_time.c113
1 files changed, 61 insertions, 52 deletions
diff --git a/plugins/check_time.c b/plugins/check_time.c
index dde6eea..36b622f 100644
--- a/plugins/check_time.c
+++ b/plugins/check_time.c
@@ -29,51 +29,6 @@ enum {
29 TIME_PORT = 37 29 TIME_PORT = 37
30}; 30};
31 31
32void
33print_usage (void)
34{
35 printf (_("\
36Usage: %s -H <host_address> [-p port] [-w variance] [-c variance]\n\
37 [-W connect_time] [-C connect_time] [-t timeout]\n"), progname);
38 printf (_(UT_HLP_VRS), progname, progname);
39}
40
41void
42print_help (void)
43{
44 char *myport;
45 asprintf (&myport, "%d", TIME_PORT);
46
47 print_revision (progname, revision);
48
49 printf (_("Copyright (c) 1999 Ethan Galstad\n"));
50 printf (_(COPYRIGHT), copyright, email);
51
52 printf (_("\
53This plugin will check the time on the specified host.\n\n"));
54
55 print_usage ();
56
57 printf (_(UT_HELP_VRSN));
58
59 printf (_(UT_HOST_PORT), 'p', myport);
60
61 printf (_("\
62 -w, --warning-variance=INTEGER\n\
63 Time difference (sec.) necessary to result in a warning status\n\
64 -c, --critical-variance=INTEGER\n\
65 Time difference (sec.) necessary to result in a critical status\n\
66 -W, --warning-connect=INTEGER\n\
67 Response time (sec.) necessary to result in warning status\n\
68 -C, --critical-connect=INTEGER\n\
69 Response time (sec.) necessary to result in critical status\n"));
70
71 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
72
73 support ();
74}
75
76
77#define UNIX_EPOCH 2208988800UL 32#define UNIX_EPOCH 2208988800UL
78 33
79unsigned long server_time, raw_server_time; 34unsigned long server_time, raw_server_time;
@@ -89,11 +44,9 @@ int check_critical_diff = FALSE;
89int server_port = TIME_PORT; 44int server_port = TIME_PORT;
90char *server_address = NULL; 45char *server_address = NULL;
91 46
92
93int process_arguments (int, char **); 47int process_arguments (int, char **);
94void print_usage (void);
95void print_help (void); 48void print_help (void);
96 49void print_usage (void);
97 50
98int 51int
99main (int argc, char **argv) 52main (int argc, char **argv)
@@ -276,24 +229,28 @@ process_arguments (int argc, char **argv)
276 case 'W': /* warning-connect */ 229 case 'W': /* warning-connect */
277 if (!is_intnonneg (optarg)) 230 if (!is_intnonneg (optarg))
278 usage (_("Warning threshold must be a nonnegative integer\n")); 231 usage (_("Warning threshold must be a nonnegative integer\n"));
279 warning_time = atoi (optarg); 232 else
233 warning_time = atoi (optarg);
280 check_warning_time = TRUE; 234 check_warning_time = TRUE;
281 break; 235 break;
282 case 'C': /* critical-connect */ 236 case 'C': /* critical-connect */
283 if (!is_intnonneg (optarg)) 237 if (!is_intnonneg (optarg))
284 usage (_("Critical threshold must be a nonnegative integer\n")); 238 usage (_("Critical threshold must be a nonnegative integer\n"));
285 critical_time = atoi (optarg); 239 else
240 critical_time = atoi (optarg);
286 check_critical_time = TRUE; 241 check_critical_time = TRUE;
287 break; 242 break;
288 case 'p': /* port */ 243 case 'p': /* port */
289 if (!is_intnonneg (optarg)) 244 if (!is_intnonneg (optarg))
290 usage (_("Server port must be a nonnegative integer\n")); 245 usage (_("Server port must be a nonnegative integer\n"));
291 server_port = atoi (optarg); 246 else
247 server_port = atoi (optarg);
292 break; 248 break;
293 case 't': /* timeout */ 249 case 't': /* timeout */
294 if (!is_intnonneg (optarg)) 250 if (!is_intnonneg (optarg))
295 usage (_("Timeout interval must be a nonnegative integer\n")); 251 usage (_("Timeout interval must be a nonnegative integer\n"));
296 socket_timeout = atoi (optarg); 252 else
253 socket_timeout = atoi (optarg);
297 break; 254 break;
298 } 255 }
299 } 256 }
@@ -312,3 +269,55 @@ process_arguments (int argc, char **argv)
312 269
313 return OK; 270 return OK;
314} 271}
272
273
274
275
276
277
278void
279print_help (void)
280{
281 char *myport;
282 asprintf (&myport, "%d", TIME_PORT);
283
284 print_revision (progname, revision);
285
286 printf (_("Copyright (c) 1999 Ethan Galstad\n"));
287 printf (_(COPYRIGHT), copyright, email);
288
289 printf (_("\
290This plugin will check the time on the specified host.\n\n"));
291
292 print_usage ();
293
294 printf (_(UT_HELP_VRSN));
295
296 printf (_(UT_HOST_PORT), 'p', myport);
297
298 printf (_("\
299 -w, --warning-variance=INTEGER\n\
300 Time difference (sec.) necessary to result in a warning status\n\
301 -c, --critical-variance=INTEGER\n\
302 Time difference (sec.) necessary to result in a critical status\n\
303 -W, --warning-connect=INTEGER\n\
304 Response time (sec.) necessary to result in warning status\n\
305 -C, --critical-connect=INTEGER\n\
306 Response time (sec.) necessary to result in critical status\n"));
307
308 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
309
310 support ();
311}
312
313
314
315
316void
317print_usage (void)
318{
319 printf (_("\
320Usage: %s -H <host_address> [-p port] [-w variance] [-c variance]\n\
321 [-W connect_time] [-C connect_time] [-t timeout]\n"), progname);
322 printf (_(UT_HLP_VRS), progname, progname);
323}