diff options
Diffstat (limited to 'plugins/check_ntp_peer.d/config.h')
| -rw-r--r-- | plugins/check_ntp_peer.d/config.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/plugins/check_ntp_peer.d/config.h b/plugins/check_ntp_peer.d/config.h new file mode 100644 index 00000000..488d936c --- /dev/null +++ b/plugins/check_ntp_peer.d/config.h | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../config.h" | ||
| 4 | #include "output.h" | ||
| 5 | #include "perfdata.h" | ||
| 6 | #include "thresholds.h" | ||
| 7 | #include <stddef.h> | ||
| 8 | |||
| 9 | enum { | ||
| 10 | DEFAULT_NTP_PORT = 123, | ||
| 11 | }; | ||
| 12 | |||
| 13 | typedef struct { | ||
| 14 | char *server_address; | ||
| 15 | int port; | ||
| 16 | |||
| 17 | bool quiet; | ||
| 18 | |||
| 19 | // truechimer stuff | ||
| 20 | bool do_truechimers; | ||
| 21 | mp_thresholds truechimer_thresholds; | ||
| 22 | |||
| 23 | // offset thresholds | ||
| 24 | mp_thresholds offset_thresholds; | ||
| 25 | |||
| 26 | // stratum stuff | ||
| 27 | bool do_stratum; | ||
| 28 | mp_thresholds stratum_thresholds; | ||
| 29 | |||
| 30 | // jitter stuff | ||
| 31 | bool do_jitter; | ||
| 32 | mp_thresholds jitter_thresholds; | ||
| 33 | |||
| 34 | bool output_format_is_set; | ||
| 35 | mp_output_format output_format; | ||
| 36 | } check_ntp_peer_config; | ||
| 37 | |||
| 38 | check_ntp_peer_config check_ntp_peer_config_init() { | ||
| 39 | check_ntp_peer_config tmp = { | ||
| 40 | .server_address = NULL, | ||
| 41 | .port = DEFAULT_NTP_PORT, | ||
| 42 | |||
| 43 | .quiet = false, | ||
| 44 | .do_truechimers = false, | ||
| 45 | .truechimer_thresholds = mp_thresholds_init(), | ||
| 46 | |||
| 47 | .offset_thresholds = mp_thresholds_init(), | ||
| 48 | |||
| 49 | .do_stratum = false, | ||
| 50 | .stratum_thresholds = mp_thresholds_init(), | ||
| 51 | |||
| 52 | .do_jitter = false, | ||
| 53 | .jitter_thresholds = mp_thresholds_init(), | ||
| 54 | |||
| 55 | .output_format_is_set = false, | ||
| 56 | }; | ||
| 57 | |||
| 58 | mp_range stratum_default = mp_range_init(); | ||
| 59 | stratum_default = mp_range_set_start(stratum_default, mp_create_pd_value(-1)); | ||
| 60 | stratum_default = mp_range_set_end(stratum_default, mp_create_pd_value(16)); | ||
| 61 | tmp.stratum_thresholds = mp_thresholds_set_warn(tmp.stratum_thresholds, stratum_default); | ||
| 62 | tmp.stratum_thresholds = mp_thresholds_set_crit(tmp.stratum_thresholds, stratum_default); | ||
| 63 | |||
| 64 | mp_range jitter_w_default = mp_range_init(); | ||
| 65 | jitter_w_default = mp_range_set_start(jitter_w_default, mp_create_pd_value(-1)); | ||
| 66 | jitter_w_default = mp_range_set_end(jitter_w_default, mp_create_pd_value(5000)); | ||
| 67 | tmp.jitter_thresholds = mp_thresholds_set_warn(tmp.jitter_thresholds, jitter_w_default); | ||
| 68 | |||
| 69 | mp_range jitter_c_default = mp_range_init(); | ||
| 70 | jitter_c_default = mp_range_set_start(jitter_c_default, mp_create_pd_value(-1)); | ||
| 71 | jitter_c_default = mp_range_set_end(jitter_c_default, mp_create_pd_value(10000)); | ||
| 72 | tmp.jitter_thresholds = mp_thresholds_set_crit(tmp.jitter_thresholds, jitter_c_default); | ||
| 73 | |||
| 74 | mp_range offset_w_default = mp_range_init(); | ||
| 75 | offset_w_default = mp_range_set_end(offset_w_default, mp_create_pd_value(60)); | ||
| 76 | tmp.offset_thresholds = mp_thresholds_set_warn(tmp.offset_thresholds, offset_w_default); | ||
| 77 | |||
| 78 | mp_range offset_c_default = mp_range_init(); | ||
| 79 | offset_c_default = mp_range_set_end(offset_c_default, mp_create_pd_value(120)); | ||
| 80 | tmp.offset_thresholds = mp_thresholds_set_crit(tmp.offset_thresholds, offset_c_default); | ||
| 81 | return tmp; | ||
| 82 | } | ||
