summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-12-04 12:24:48 +0000
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>2007-12-04 12:24:48 +0000
commit084a9b444fab26b756bc2bf751e93c5494b926f4 (patch)
treea7d19f36f0c8d5100d05677e9bc432ab6914db6c
parent79cc962eb8c17d849e7c698e25aed25938a0efae (diff)
downloadmonitoring-plugins-084a9b444fab26b756bc2bf751e93c5494b926f4.tar.gz
Cleanups only
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/branches/dermoth_ntp_rework@1842 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--NEWS10
-rw-r--r--plugins/check_ntp_peer.c32
-rw-r--r--plugins/check_ntp_time.c18
3 files changed, 30 insertions, 30 deletions
diff --git a/NEWS b/NEWS
index 53547b43..62009443 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,7 @@ This file documents the major additions and syntax changes between releases.
9 and the offset is unavailable, will return UNKNOWN as well. 9 and the offset is unavailable, will return UNKNOWN as well.
10 NOTE: If jitter thresholds are specified as integers it will return CRITICAL if jitter 10 NOTE: If jitter thresholds are specified as integers it will return CRITICAL if jitter
11 is "-1" as the default range starts at 0. See Examples in --help output. 11 is "-1" as the default range starts at 0. See Examples in --help output.
12 Merge two new checks that deprecates check_ntp: check_ntp_peer and check_ntp_time. 12 Merge two new checks that deprecates check_ntp: check_ntp_peer and check_ntp_time.
13 You should read the --help output so see which one is suitable for you. check_ntp_peer 13 You should read the --help output so see which one is suitable for you. check_ntp_peer
14 implement stratum thresholds support (feature request #1703823). 14 implement stratum thresholds support (feature request #1703823).
15 15
@@ -17,9 +17,9 @@ This file documents the major additions and syntax changes between releases.
17 Fix check_http buffer overflow vulnerability when following HTTP redirects 17 Fix check_http buffer overflow vulnerability when following HTTP redirects
18 check_http now explicitly asks HTTP/1.1 servers to close the connection 18 check_http now explicitly asks HTTP/1.1 servers to close the connection
19 after completion of the response 19 after completion of the response
20 Check_ldaps' guessing which secure method to use (starttls vs. ssl on connect) 20 Check_ldaps' guessing which secure method to use (starttls vs. ssl on connect)
21 is now deprecated. See --help for further information. 21 is now deprecated. See --help for further information.
22 Check_disk now calls stat() on all filesystems to check. (Old: only the ones selected using -p) 22 Check_disk now calls stat() on all filesystems to check. (Old: only the ones selected using -p)
23 A meaningful error message (eg "Stale NFS Handle") is printed if stat fails. 23 A meaningful error message (eg "Stale NFS Handle") is printed if stat fails.
24 New check_disk option -L: Only check local filesystems, but call stat() on remote ones, too. 24 New check_disk option -L: Only check local filesystems, but call stat() on remote ones, too.
25 Thus accessibility of remote filesystems can be checked without any threshold comparison. 25 Thus accessibility of remote filesystems can be checked without any threshold comparison.
@@ -38,7 +38,7 @@ This file documents the major additions and syntax changes between releases.
38 Fix possible check_icmp bus errors on some (non-x86/AMD64) platforms 38 Fix possible check_icmp bus errors on some (non-x86/AMD64) platforms
39 Fix check_smtp's handling of multiple-packet server responses 39 Fix check_smtp's handling of multiple-packet server responses
40 WARNING: Fix for negate which may break existing commands: 40 WARNING: Fix for negate which may break existing commands:
41 - stop evaluating command line options through shell twice 41 - stop evaluating command line options through shell twice
42 - enforce a full path for the command to run 42 - enforce a full path for the command to run
43 The "negate" utility can now remap custom states 43 The "negate" utility can now remap custom states
44 Check_radius now supports radiusclient-ng 44 Check_radius now supports radiusclient-ng
@@ -113,7 +113,7 @@ This file documents the major additions and syntax changes between releases.
113 SSL plugins work with gnutls as well as OpenSSL 113 SSL plugins work with gnutls as well as OpenSSL
114 check_mysql_query added to run arbitrary SQL commands, with threshold checking 114 check_mysql_query added to run arbitrary SQL commands, with threshold checking
115 libtool now required for development systems 115 libtool now required for development systems
116 Notice: check_udp (compiled from check_udp.c) will be deprecated in the next release. 116 Notice: check_udp (compiled from check_udp.c) will be deprecated in the next release.
117 check_udp2 should be used instead and will be renamed to check_udp 117 check_udp2 should be used instead and will be renamed to check_udp
118 118
1191.4.2 1191.4.2
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c
index 83fa8aba..1c4702c8 100644
--- a/plugins/check_ntp_peer.c
+++ b/plugins/check_ntp_peer.c
@@ -181,7 +181,7 @@ char *extract_value(const char *varlist, const char *name){
181 char *tmpvarlist=NULL, *tmpkey=NULL, *value=NULL; 181 char *tmpvarlist=NULL, *tmpkey=NULL, *value=NULL;
182 int last=0; 182 int last=0;
183 183
184 /* The following code require a non-empty varlist */ 184 /* The following code require a non-empty varlist */
185 if(strlen(varlist) == 0) 185 if(strlen(varlist) == 0)
186 return NULL; 186 return NULL;
187 187
@@ -279,7 +279,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
279 } while(req.op&REM_MORE); 279 } while(req.op&REM_MORE);
280 280
281 /* first, let's find out if we have a sync source, or if there are 281 /* first, let's find out if we have a sync source, or if there are
282 * at least some candidates. in the case of the latter we'll issue 282 * at least some candidates. In the latter case we'll issue
283 * a warning but go ahead with the check on them. */ 283 * a warning but go ahead with the check on them. */
284 for (i = 0; i < npeers; i++){ 284 for (i = 0; i < npeers; i++){
285 if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){ 285 if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){
@@ -302,7 +302,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
302 /* Only query this server if it is the current sync source */ 302 /* Only query this server if it is the current sync source */
303 /* If there's no sync.peer, query all candidates and use the best one */ 303 /* If there's no sync.peer, query all candidates and use the best one */
304 if (PEER_SEL(peers[i].status) >= min_peer_sel){ 304 if (PEER_SEL(peers[i].status) >= min_peer_sel){
305 if(verbose) printf("Getting offset, jitter and stratum for peer %.2x\n", ntohs(peers[i].assoc)); 305 if(verbose) printf("Getting offset, jitter and stratum for peer %.2x\n", ntohs(peers[i].assoc));
306 asprintf(&data, ""); 306 asprintf(&data, "");
307 do{ 307 do{
308 setup_control_request(&req, OP_READVAR, 2); 308 setup_control_request(&req, OP_READVAR, 2);
@@ -335,7 +335,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
335 getvar = "stratum,offset,dispersion"; 335 getvar = "stratum,offset,dispersion";
336 i--; 336 i--;
337 continue; 337 continue;
338 } else if(strlen(getvar)) { 338 } else if(strlen(getvar)) {
339 if(verbose) printf("Server didn't like dispersion either; will retrieve everything\n"); 339 if(verbose) printf("Server didn't like dispersion either; will retrieve everything\n");
340 getvar = ""; 340 getvar = "";
341 i--; 341 i--;
@@ -541,7 +541,7 @@ char *perfd_stratum (int stratum)
541 541
542int main(int argc, char *argv[]){ 542int main(int argc, char *argv[]){
543 int result, offset_result, stratum; 543 int result, offset_result, stratum;
544 double offset=0, jitter=0; 544 double offset=0, jitter=0;
545 char *result_line, *perfdata_line; 545 char *result_line, *perfdata_line;
546 546
547 if (process_arguments (argc, argv) == ERROR) 547 if (process_arguments (argc, argv) == ERROR)
@@ -557,11 +557,11 @@ int main(int argc, char *argv[]){
557 /* set socket timeout */ 557 /* set socket timeout */
558 alarm (socket_timeout); 558 alarm (socket_timeout);
559 559
560 /* This returns either OK or WARNING (See comment preceeding ntp_request) */ 560 /* This returns either OK or WARNING (See comment preceeding ntp_request) */
561 result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum); 561 result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum);
562 562
563 if(offset_result == STATE_UNKNOWN) { 563 if(offset_result == STATE_UNKNOWN) {
564 /* if there's no sync peer (this overrides ntp_request output): */ 564 /* if there's no sync peer (this overrides ntp_request output): */
565 result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL); 565 result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL);
566 } else { 566 } else {
567 /* Be quiet if there's no candidates either */ 567 /* Be quiet if there's no candidates either */
@@ -602,11 +602,11 @@ int main(int argc, char *argv[]){
602 } 602 }
603 if (do_jitter) { 603 if (do_jitter) {
604 asprintf(&result_line, "%s, jitter=%f", result_line, jitter); 604 asprintf(&result_line, "%s, jitter=%f", result_line, jitter);
605 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter)); 605 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter));
606 } 606 }
607 if (do_stratum) { 607 if (do_stratum) {
608 asprintf(&result_line, "%s, stratum=%i", result_line, stratum); 608 asprintf(&result_line, "%s, stratum=%i", result_line, stratum);
609 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_stratum(stratum)); 609 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_stratum(stratum));
610 } 610 }
611 printf("%s|%s\n", result_line, perfdata_line); 611 printf("%s|%s\n", result_line, perfdata_line);
612 612
@@ -621,11 +621,11 @@ void print_help(void){
621 621
622 printf ("Copyright (c) 2006 Sean Finney\n"); 622 printf ("Copyright (c) 2006 Sean Finney\n");
623 printf (COPYRIGHT, copyright, email); 623 printf (COPYRIGHT, copyright, email);
624
625 printf ("%s\n", _("This plugin checks the selected ntp server"));
626 624
627 printf ("\n\n"); 625 printf ("%s\n", _("This plugin checks the selected ntp server"));
628 626
627 printf ("\n\n");
628
629 print_usage(); 629 print_usage();
630 printf (_(UT_HELP_VRSN)); 630 printf (_(UT_HELP_VRSN));
631 printf (_(UT_HOST_PORT), 'p', "123"); 631 printf (_(UT_HOST_PORT), 'p', "123");
@@ -675,7 +675,7 @@ void print_help(void){
675void 675void
676print_usage(void) 676print_usage(void)
677{ 677{
678 printf (_("Usage:")); 678 printf (_("Usage:"));
679 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname); 679 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname);
680 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n"); 680 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n");
681} 681}
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c
index 042d3037..ad7f6c4b 100644
--- a/plugins/check_ntp_time.c
+++ b/plugins/check_ntp_time.c
@@ -356,13 +356,13 @@ double offset_request(const char *host, int *status){
356 ai_tmp = ai_tmp->ai_next; 356 ai_tmp = ai_tmp->ai_next;
357 } 357 }
358 358
359 /* now do AVG_NUM checks to each host. we stop before timeout/2 seconds 359 /* now do AVG_NUM checks to each host. We stop before timeout/2 seconds
360 * have passed in order to ensure post-processing and jitter time. */ 360 * have passed in order to ensure post-processing and jitter time. */
361 now_time=start_ts=time(NULL); 361 now_time=start_ts=time(NULL);
362 while(servers_completed<num_hosts && now_time-start_ts <= socket_timeout/2){ 362 while(servers_completed<num_hosts && now_time-start_ts <= socket_timeout/2){
363 /* loop through each server and find each one which hasn't 363 /* loop through each server and find each one which hasn't
364 * been touched in the past second or so and is still lacking 364 * been touched in the past second or so and is still lacking
365 * some responses. for each of these servers, send a new request, 365 * some responses. For each of these servers, send a new request,
366 * and update the "waiting" timestamp with the current time. */ 366 * and update the "waiting" timestamp with the current time. */
367 one_written=0; 367 one_written=0;
368 now_time=time(NULL); 368 now_time=time(NULL);
@@ -586,11 +586,11 @@ void print_help(void){
586 586
587 printf ("Copyright (c) 2006 Sean Finney\n"); 587 printf ("Copyright (c) 2006 Sean Finney\n");
588 printf (COPYRIGHT, copyright, email); 588 printf (COPYRIGHT, copyright, email);
589
590 printf ("%s\n", _("This plugin checks the clock offset with the ntp server"));
591 589
592 printf ("\n\n"); 590 printf ("%s\n", _("This plugin checks the clock offset with the ntp server"));
593 591
592 printf ("\n\n");
593
594 print_usage(); 594 print_usage();
595 printf (_(UT_HELP_VRSN)); 595 printf (_(UT_HELP_VRSN));
596 printf (_(UT_HOST_PORT), 'p', "123"); 596 printf (_(UT_HOST_PORT), 'p', "123");
@@ -625,8 +625,8 @@ void print_help(void){
625void 625void
626print_usage(void) 626print_usage(void)
627{ 627{
628 printf (_("Usage:")); 628 printf (_("Usage:"));
629 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname); 629 printf(" %s -H <host> [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>]\n", progname);
630 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n"); 630 printf(" [-j <warn>] [-k <crit>] [-v verbose]\n");
631} 631}
632 632