diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-12-04 12:24:48 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-12-04 12:24:48 +0000 |
commit | 084a9b444fab26b756bc2bf751e93c5494b926f4 (patch) | |
tree | a7d19f36f0c8d5100d05677e9bc432ab6914db6c /plugins/check_ntp_peer.c | |
parent | 79cc962eb8c17d849e7c698e25aed25938a0efae (diff) | |
download | monitoring-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
Diffstat (limited to 'plugins/check_ntp_peer.c')
-rw-r--r-- | plugins/check_ntp_peer.c | 32 |
1 files changed, 16 insertions, 16 deletions
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 | ||
542 | int main(int argc, char *argv[]){ | 542 | int 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){ | |||
675 | void | 675 | void |
676 | print_usage(void) | 676 | print_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 | } |