summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_peer.d/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ntp_peer.d/config.h')
-rw-r--r--plugins/check_ntp_peer.d/config.h58
1 files changed, 33 insertions, 25 deletions
diff --git a/plugins/check_ntp_peer.d/config.h b/plugins/check_ntp_peer.d/config.h
index 00e6b05d..396edea6 100644
--- a/plugins/check_ntp_peer.d/config.h
+++ b/plugins/check_ntp_peer.d/config.h
@@ -1,6 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "../../config.h" 3#include "../../config.h"
4#include "perfdata.h"
4#include "thresholds.h" 5#include "thresholds.h"
5#include <stddef.h> 6#include <stddef.h>
6 7
@@ -16,26 +17,18 @@ typedef struct {
16 17
17 // truechimer stuff 18 // truechimer stuff
18 bool do_truechimers; 19 bool do_truechimers;
19 char *twarn; 20 mp_thresholds truechimer_thresholds;
20 char *tcrit;
21 thresholds *truechimer_thresholds;
22 21
23 char *owarn; 22 // offset thresholds
24 char *ocrit; 23 mp_thresholds offset_thresholds;
25 thresholds *offset_thresholds;
26 24
27 // stratum stuff 25 // stratum stuff
28 bool do_stratum; 26 bool do_stratum;
29 char *swarn; 27 mp_thresholds stratum_thresholds;
30 char *scrit;
31 thresholds *stratum_thresholds;
32 28
33 // jitter stuff 29 // jitter stuff
34 bool do_jitter; 30 bool do_jitter;
35 char *jwarn; 31 mp_thresholds jitter_thresholds;
36 char *jcrit;
37 thresholds *jitter_thresholds;
38
39} check_ntp_peer_config; 32} check_ntp_peer_config;
40 33
41check_ntp_peer_config check_ntp_peer_config_init() { 34check_ntp_peer_config check_ntp_peer_config_init() {
@@ -45,23 +38,38 @@ check_ntp_peer_config check_ntp_peer_config_init() {
45 38
46 .quiet = false, 39 .quiet = false,
47 .do_truechimers = false, 40 .do_truechimers = false,
48 .twarn = "0:", 41 .truechimer_thresholds = mp_thresholds_init(),
49 .tcrit = "0:",
50 .truechimer_thresholds = NULL,
51 42
52 .owarn = "60", 43 .offset_thresholds = mp_thresholds_init(),
53 .ocrit = "120",
54 .offset_thresholds = NULL,
55 44
56 .do_stratum = false, 45 .do_stratum = false,
57 .swarn = "-1:16", 46 .stratum_thresholds = mp_thresholds_init(),
58 .scrit = "-1:16",
59 .stratum_thresholds = NULL,
60 47
61 .do_jitter = false, 48 .do_jitter = false,
62 .jwarn = "-1:5000", 49 .jitter_thresholds = mp_thresholds_init(),
63 .jcrit = "-1:10000",
64 .jitter_thresholds = NULL,
65 }; 50 };
51
52 mp_range stratum_default = mp_range_init();
53 stratum_default = mp_range_set_start(stratum_default, mp_create_pd_value(-1));
54 stratum_default = mp_range_set_end(stratum_default, mp_create_pd_value(16));
55 tmp.stratum_thresholds = mp_thresholds_set_warn(tmp.stratum_thresholds, stratum_default);
56 tmp.stratum_thresholds = mp_thresholds_set_crit(tmp.stratum_thresholds, stratum_default);
57
58 mp_range jitter_w_default = mp_range_init();
59 jitter_w_default = mp_range_set_start(jitter_w_default, mp_create_pd_value(-1));
60 jitter_w_default = mp_range_set_end(jitter_w_default, mp_create_pd_value(5000));
61 tmp.jitter_thresholds = mp_thresholds_set_warn(tmp.jitter_thresholds, jitter_w_default);
62
63 mp_range jitter_c_default = mp_range_init();
64 jitter_c_default = mp_range_set_start(jitter_c_default, mp_create_pd_value(-1));
65 jitter_c_default = mp_range_set_end(jitter_c_default, mp_create_pd_value(10000));
66 tmp.jitter_thresholds = mp_thresholds_set_crit(tmp.jitter_thresholds, jitter_c_default);
67
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));
70 tmp.offset_thresholds = mp_thresholds_set_warn(tmp.offset_thresholds, offset_w_default);
71 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 tmp.offset_thresholds = mp_thresholds_set_crit(tmp.offset_thresholds, offset_c_default);
66 return tmp; 74 return tmp;
67} 75}