summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_ntp_peer.c16
-rw-r--r--plugins/check_ntp_peer.d/config.h5
2 files changed, 17 insertions, 4 deletions
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c
index 68b2fa9c..032f8ea4 100644
--- a/plugins/check_ntp_peer.c
+++ b/plugins/check_ntp_peer.c
@@ -689,6 +689,7 @@ int main(int argc, char *argv[]) {
689 /* if there's no sync peer (this overrides ntp_request output): */ 689 /* if there's no sync peer (this overrides ntp_request output): */
690 sc_offset = 690 sc_offset =
691 mp_set_subcheck_state(sc_offset, (config.quiet ? STATE_UNKNOWN : STATE_CRITICAL)); 691 mp_set_subcheck_state(sc_offset, (config.quiet ? STATE_UNKNOWN : STATE_CRITICAL));
692 xasprintf(&sc_offset.output, "%s unknown", sc_offset.output);
692 } else { 693 } else {
693 /* Be quiet if there's no candidates either */ 694 /* Be quiet if there's no candidates either */
694 mp_state_enum tmp = STATE_OK; 695 mp_state_enum tmp = STATE_OK;
@@ -696,9 +697,14 @@ int main(int argc, char *argv[]) {
696 tmp = STATE_UNKNOWN; 697 tmp = STATE_UNKNOWN;
697 } 698 }
698 699
700 xasprintf(&sc_offset.output, "%s: %.6fs", sc_offset.output, ntp_res.offset);
701
699 mp_perfdata pd_offset = perfdata_init(); 702 mp_perfdata pd_offset = perfdata_init();
700 pd_offset.value = mp_create_pd_value(fabs(ntp_res.offset)); 703 pd_offset.value = mp_create_pd_value(fabs(ntp_res.offset));
701 pd_offset = mp_pd_set_thresholds(pd_offset, config.offset_thresholds); 704 pd_offset = mp_pd_set_thresholds(pd_offset, config.offset_thresholds);
705 pd_offset.label = "offset";
706 pd_offset.uom = "s";
707 mp_add_perfdata_to_subcheck(&sc_offset, pd_offset);
702 708
703 tmp = max_state_alt(tmp, mp_get_pd_status(pd_offset)); 709 tmp = max_state_alt(tmp, mp_get_pd_status(pd_offset));
704 sc_offset = mp_set_subcheck_state(sc_offset, tmp); 710 sc_offset = mp_set_subcheck_state(sc_offset, tmp);
@@ -708,12 +714,14 @@ int main(int argc, char *argv[]) {
708 714
709 // truechimers 715 // truechimers
710 if (config.do_truechimers) { 716 if (config.do_truechimers) {
711 mp_subcheck sc_truechimers; 717 mp_subcheck sc_truechimers = mp_subcheck_init();
712 xasprintf(&sc_truechimers.output, "truechimers: %i", ntp_res.num_truechimers); 718 xasprintf(&sc_truechimers.output, "truechimers: %i", ntp_res.num_truechimers);
713 719
714 mp_perfdata pd_truechimers = perfdata_init(); 720 mp_perfdata pd_truechimers = perfdata_init();
715 pd_truechimers.value = mp_create_pd_value(ntp_res.num_truechimers); 721 pd_truechimers.value = mp_create_pd_value(ntp_res.num_truechimers);
716 mp_pd_set_thresholds(pd_truechimers, config.truechimer_thresholds); 722 pd_truechimers.label = "truechimers";
723 pd_truechimers = mp_pd_set_thresholds(pd_truechimers, config.truechimer_thresholds);
724
717 mp_add_perfdata_to_subcheck(&sc_truechimers, pd_truechimers); 725 mp_add_perfdata_to_subcheck(&sc_truechimers, pd_truechimers);
718 726
719 sc_truechimers = mp_set_subcheck_state(sc_truechimers, mp_get_pd_status(pd_truechimers)); 727 sc_truechimers = mp_set_subcheck_state(sc_truechimers, mp_get_pd_status(pd_truechimers));
@@ -728,6 +736,8 @@ int main(int argc, char *argv[]) {
728 mp_perfdata pd_stratum = perfdata_init(); 736 mp_perfdata pd_stratum = perfdata_init();
729 pd_stratum.value = mp_create_pd_value(ntp_res.stratum); 737 pd_stratum.value = mp_create_pd_value(ntp_res.stratum);
730 pd_stratum = mp_pd_set_thresholds(pd_stratum, config.stratum_thresholds); 738 pd_stratum = mp_pd_set_thresholds(pd_stratum, config.stratum_thresholds);
739 pd_stratum.label = "stratum";
740
731 mp_add_perfdata_to_subcheck(&sc_stratum, pd_stratum); 741 mp_add_perfdata_to_subcheck(&sc_stratum, pd_stratum);
732 742
733 sc_stratum = mp_set_subcheck_state(sc_stratum, mp_get_pd_status(pd_stratum)); 743 sc_stratum = mp_set_subcheck_state(sc_stratum, mp_get_pd_status(pd_stratum));
@@ -742,6 +752,8 @@ int main(int argc, char *argv[]) {
742 mp_perfdata pd_jitter = perfdata_init(); 752 mp_perfdata pd_jitter = perfdata_init();
743 pd_jitter.value = mp_create_pd_value(ntp_res.jitter); 753 pd_jitter.value = mp_create_pd_value(ntp_res.jitter);
744 pd_jitter = mp_pd_set_thresholds(pd_jitter, config.jitter_thresholds); 754 pd_jitter = mp_pd_set_thresholds(pd_jitter, config.jitter_thresholds);
755 pd_jitter.label = "jitter";
756
745 mp_add_perfdata_to_subcheck(&sc_jitter, pd_jitter); 757 mp_add_perfdata_to_subcheck(&sc_jitter, pd_jitter);
746 758
747 sc_jitter = mp_set_subcheck_state(sc_jitter, mp_get_pd_status(pd_jitter)); 759 sc_jitter = mp_set_subcheck_state(sc_jitter, mp_get_pd_status(pd_jitter));
diff --git a/plugins/check_ntp_peer.d/config.h b/plugins/check_ntp_peer.d/config.h
index 396edea6..a6dd5c4c 100644
--- a/plugins/check_ntp_peer.d/config.h
+++ b/plugins/check_ntp_peer.d/config.h
@@ -66,10 +66,11 @@ check_ntp_peer_config check_ntp_peer_config_init() {
66 tmp.jitter_thresholds = mp_thresholds_set_crit(tmp.jitter_thresholds, jitter_c_default); 66 tmp.jitter_thresholds = mp_thresholds_set_crit(tmp.jitter_thresholds, jitter_c_default);
67 67
68 mp_range offset_w_default = mp_range_init(); 68 mp_range offset_w_default = mp_range_init();
69 offset_w_default = mp_range_set_start(offset_w_default, mp_create_pd_value(60)); 69 offset_w_default = mp_range_set_end(offset_w_default, mp_create_pd_value(60));
70 tmp.offset_thresholds = mp_thresholds_set_warn(tmp.offset_thresholds, offset_w_default); 70 tmp.offset_thresholds = mp_thresholds_set_warn(tmp.offset_thresholds, offset_w_default);
71
71 mp_range offset_c_default = mp_range_init(); 72 mp_range offset_c_default = mp_range_init();
72 offset_c_default = mp_range_set_start(offset_c_default, mp_create_pd_value(120)); 73 offset_c_default = mp_range_set_end(offset_c_default, mp_create_pd_value(120));
73 tmp.offset_thresholds = mp_thresholds_set_crit(tmp.offset_thresholds, offset_c_default); 74 tmp.offset_thresholds = mp_thresholds_set_crit(tmp.offset_thresholds, offset_c_default);
74 return tmp; 75 return tmp;
75} 76}