diff options
Diffstat (limited to 'plugins/check_ntp_time.d/config.h')
| -rw-r--r-- | plugins/check_ntp_time.d/config.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/check_ntp_time.d/config.h b/plugins/check_ntp_time.d/config.h new file mode 100644 index 00000000..9bbd82aa --- /dev/null +++ b/plugins/check_ntp_time.d/config.h | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../config.h" | ||
| 4 | #include "output.h" | ||
| 5 | #include "thresholds.h" | ||
| 6 | #include <stddef.h> | ||
| 7 | |||
| 8 | typedef struct { | ||
| 9 | char *server_address; | ||
| 10 | char *port; | ||
| 11 | |||
| 12 | bool quiet; | ||
| 13 | int time_offset; | ||
| 14 | |||
| 15 | mp_thresholds offset_thresholds; | ||
| 16 | |||
| 17 | bool output_format_is_set; | ||
| 18 | mp_output_format output_format; | ||
| 19 | } check_ntp_time_config; | ||
| 20 | |||
| 21 | check_ntp_time_config check_ntp_time_config_init() { | ||
| 22 | check_ntp_time_config tmp = { | ||
| 23 | .server_address = NULL, | ||
| 24 | .port = "123", | ||
| 25 | |||
| 26 | .quiet = false, | ||
| 27 | .time_offset = 0, | ||
| 28 | |||
| 29 | .offset_thresholds = mp_thresholds_init(), | ||
| 30 | |||
| 31 | .output_format_is_set = false, | ||
| 32 | }; | ||
| 33 | |||
| 34 | mp_range warning = mp_range_init(); | ||
| 35 | warning = mp_range_set_end(warning, mp_create_pd_value(60)); | ||
| 36 | tmp.offset_thresholds = mp_thresholds_set_warn(tmp.offset_thresholds, warning); | ||
| 37 | |||
| 38 | mp_range critical = mp_range_init(); | ||
| 39 | critical = mp_range_set_end(warning, mp_create_pd_value(120)); | ||
| 40 | tmp.offset_thresholds = mp_thresholds_set_crit(tmp.offset_thresholds, critical); | ||
| 41 | |||
| 42 | return tmp; | ||
| 43 | } | ||
