diff options
Diffstat (limited to 'plugins/check_ntp_peer.c')
| -rw-r--r-- | plugins/check_ntp_peer.c | 16 |
1 files changed, 14 insertions, 2 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)); |
