summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_ntp.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index 99537c88..61b2d699 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -40,10 +40,10 @@ const char *email = "devel@monitoring-plugins.org";
40 40
41static char *server_address=NULL; 41static char *server_address=NULL;
42static int verbose=0; 42static int verbose=0;
43static short do_offset=0; 43static bool do_offset = false;
44static char *owarn="60"; 44static char *owarn="60";
45static char *ocrit="120"; 45static char *ocrit="120";
46static short do_jitter=0; 46static bool do_jitter = false;
47static char *jwarn="5000"; 47static char *jwarn="5000";
48static char *jcrit="10000"; 48static char *jcrit="10000";
49 49
@@ -513,7 +513,8 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){
513 513
514/* XXX handle responses with the error bit set */ 514/* XXX handle responses with the error bit set */
515double jitter_request(int *status){ 515double jitter_request(int *status){
516 int conn=-1, i, npeers=0, num_candidates=0, syncsource_found=0; 516 int conn=-1, i, npeers=0, num_candidates=0;
517 bool syncsource_found = false;
517 int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0; 518 int run=0, min_peer_sel=PEER_INCLUDED, num_selected=0, num_valid=0;
518 int peers_size=0, peer_offset=0; 519 int peers_size=0, peer_offset=0;
519 ntp_assoc_status_pair *peers=NULL; 520 ntp_assoc_status_pair *peers=NULL;
@@ -570,7 +571,7 @@ double jitter_request(int *status){
570 if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){ 571 if (PEER_SEL(peers[i].status) >= PEER_INCLUDED){
571 num_candidates++; 572 num_candidates++;
572 if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){ 573 if(PEER_SEL(peers[i].status) >= PEER_SYNCSOURCE){
573 syncsource_found=1; 574 syncsource_found = true;
574 min_peer_sel=PEER_SYNCSOURCE; 575 min_peer_sel=PEER_SYNCSOURCE;
575 } 576 }
576 } 577 }
@@ -699,23 +700,23 @@ int process_arguments(int argc, char **argv){
699 verbose++; 700 verbose++;
700 break; 701 break;
701 case 'w': 702 case 'w':
702 do_offset=1; 703 do_offset = true;
703 owarn = optarg; 704 owarn = optarg;
704 break; 705 break;
705 case 'c': 706 case 'c':
706 do_offset=1; 707 do_offset = true;
707 ocrit = optarg; 708 ocrit = optarg;
708 break; 709 break;
709 case 'j': 710 case 'j':
710 do_jitter=1; 711 do_jitter = true;
711 jwarn = optarg; 712 jwarn = optarg;
712 break; 713 break;
713 case 'k': 714 case 'k':
714 do_jitter=1; 715 do_jitter = true;
715 jcrit = optarg; 716 jcrit = optarg;
716 break; 717 break;
717 case 'H': 718 case 'H':
718 if(is_host(optarg) == FALSE) 719 if(!is_host(optarg))
719 usage2(_("Invalid hostname/address"), optarg); 720 usage2(_("Invalid hostname/address"), optarg);
720 server_address = strdup(optarg); 721 server_address = strdup(optarg);
721 break; 722 break;
@@ -749,9 +750,9 @@ int process_arguments(int argc, char **argv){
749char *perfd_offset (double offset) 750char *perfd_offset (double offset)
750{ 751{
751 return fperfdata ("offset", offset, "s", 752 return fperfdata ("offset", offset, "s",
752 TRUE, offset_thresholds->warning->end, 753 true, offset_thresholds->warning->end,
753 TRUE, offset_thresholds->critical->end, 754 true, offset_thresholds->critical->end,
754 FALSE, 0, FALSE, 0); 755 false, 0, false, 0);
755} 756}
756 757
757char *perfd_jitter (double jitter) 758char *perfd_jitter (double jitter)
@@ -759,7 +760,7 @@ char *perfd_jitter (double jitter)
759 return fperfdata ("jitter", jitter, "s", 760 return fperfdata ("jitter", jitter, "s",
760 do_jitter, jitter_thresholds->warning->end, 761 do_jitter, jitter_thresholds->warning->end,
761 do_jitter, jitter_thresholds->critical->end, 762 do_jitter, jitter_thresholds->critical->end,
762 TRUE, 0, FALSE, 0); 763 true, 0, false, 0);
763} 764}
764 765
765int main(int argc, char *argv[]){ 766int main(int argc, char *argv[]){