summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ntp_peer.c')
-rw-r--r--plugins/check_ntp_peer.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c
index 62ac9ae..f0dd2d8 100644
--- a/plugins/check_ntp_peer.c
+++ b/plugins/check_ntp_peer.c
@@ -295,7 +295,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
295 /* If there's no sync.peer, query all candidates and use the best one */ 295 /* If there's no sync.peer, query all candidates and use the best one */
296 if (PEER_SEL(peers[i].status) >= min_peer_sel){ 296 if (PEER_SEL(peers[i].status) >= min_peer_sel){
297 if(verbose) printf("Getting offset, jitter and stratum for peer %.2x\n", ntohs(peers[i].assoc)); 297 if(verbose) printf("Getting offset, jitter and stratum for peer %.2x\n", ntohs(peers[i].assoc));
298 asprintf(&data, ""); 298 xasprintf(&data, "");
299 do{ 299 do{
300 setup_control_request(&req, OP_READVAR, 2); 300 setup_control_request(&req, OP_READVAR, 2);
301 req.assoc = peers[i].assoc; 301 req.assoc = peers[i].assoc;
@@ -318,7 +318,7 @@ int ntp_request(const char *host, double *offset, int *offset_result, double *ji
318 DBG(print_ntp_control_message(&req)); 318 DBG(print_ntp_control_message(&req));
319 319
320 if(!(req.op&REM_ERROR)) 320 if(!(req.op&REM_ERROR))
321 asprintf(&data, "%s%s", data, req.data); 321 xasprintf(&data, "%s%s", data, req.data);
322 } while(req.op&REM_MORE); 322 } while(req.op&REM_MORE);
323 323
324 if(req.op&REM_ERROR) { 324 if(req.op&REM_ERROR) {
@@ -603,41 +603,41 @@ int main(int argc, char *argv[]){
603 603
604 switch (result) { 604 switch (result) {
605 case STATE_CRITICAL : 605 case STATE_CRITICAL :
606 asprintf(&result_line, _("NTP CRITICAL:")); 606 xasprintf(&result_line, _("NTP CRITICAL:"));
607 break; 607 break;
608 case STATE_WARNING : 608 case STATE_WARNING :
609 asprintf(&result_line, _("NTP WARNING:")); 609 xasprintf(&result_line, _("NTP WARNING:"));
610 break; 610 break;
611 case STATE_OK : 611 case STATE_OK :
612 asprintf(&result_line, _("NTP OK:")); 612 xasprintf(&result_line, _("NTP OK:"));
613 break; 613 break;
614 default : 614 default :
615 asprintf(&result_line, _("NTP UNKNOWN:")); 615 xasprintf(&result_line, _("NTP UNKNOWN:"));
616 break; 616 break;
617 } 617 }
618 if(!syncsource_found) 618 if(!syncsource_found)
619 asprintf(&result_line, "%s %s,", result_line, _("Server not synchronized")); 619 xasprintf(&result_line, "%s %s,", result_line, _("Server not synchronized"));
620 else if(li_alarm) 620 else if(li_alarm)
621 asprintf(&result_line, "%s %s,", result_line, _("Server has the LI_ALARM bit set")); 621 xasprintf(&result_line, "%s %s,", result_line, _("Server has the LI_ALARM bit set"));
622 622
623 if(offset_result == STATE_UNKNOWN){ 623 if(offset_result == STATE_UNKNOWN){
624 asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); 624 xasprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
625 asprintf(&perfdata_line, ""); 625 xasprintf(&perfdata_line, "");
626 } else { 626 } else {
627 asprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset); 627 xasprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset);
628 asprintf(&perfdata_line, "%s", perfd_offset(offset)); 628 xasprintf(&perfdata_line, "%s", perfd_offset(offset));
629 } 629 }
630 if (do_jitter) { 630 if (do_jitter) {
631 asprintf(&result_line, "%s, jitter=%f", result_line, jitter); 631 xasprintf(&result_line, "%s, jitter=%f", result_line, jitter);
632 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter)); 632 xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter));
633 } 633 }
634 if (do_stratum) { 634 if (do_stratum) {
635 asprintf(&result_line, "%s, stratum=%i", result_line, stratum); 635 xasprintf(&result_line, "%s, stratum=%i", result_line, stratum);
636 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_stratum(stratum)); 636 xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_stratum(stratum));
637 } 637 }
638 if (do_truechimers) { 638 if (do_truechimers) {
639 asprintf(&result_line, "%s, truechimers=%i", result_line, num_truechimers); 639 xasprintf(&result_line, "%s, truechimers=%i", result_line, num_truechimers);
640 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_truechimers(num_truechimers)); 640 xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_truechimers(num_truechimers));
641 } 641 }
642 printf("%s|%s\n", result_line, perfdata_line); 642 printf("%s|%s\n", result_line, perfdata_line);
643 643