summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_peer.d
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-03-12 15:51:43 +0100
committerGitHub <noreply@github.com>2025-03-12 15:51:43 +0100
commitfd7b685f0fe43d39963f522bf40272543706729a (patch)
treefdb7bc9f6654f36f6395199d47f17bb540f35901 /plugins/check_ntp_peer.d
parent9f71e510af8aa1c6244e9e334910193ae1468486 (diff)
parent2765379e3b2b18f6ca108ea96617fe8582078650 (diff)
downloadmonitoring-plugins-fd7b685f0fe43d39963f522bf40272543706729a.tar.gz
Merge pull request #2095 from RincewindsHat/refactor/check_ntp_peer
Refactor/check ntp peer
Diffstat (limited to 'plugins/check_ntp_peer.d')
-rw-r--r--plugins/check_ntp_peer.d/config.h67
1 files changed, 67 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..00e6b05d
--- /dev/null
+++ b/plugins/check_ntp_peer.d/config.h
@@ -0,0 +1,67 @@
1#pragma once
2
3#include "../../config.h"
4#include "thresholds.h"
5#include <stddef.h>
6
7enum {
8 DEFAULT_NTP_PORT = 123,
9};
10
11typedef struct {
12 char *server_address;
13 int port;
14
15 bool quiet;
16
17 // truechimer stuff
18 bool do_truechimers;
19 char *twarn;
20 char *tcrit;
21 thresholds *truechimer_thresholds;
22
23 char *owarn;
24 char *ocrit;
25 thresholds *offset_thresholds;
26
27 // stratum stuff
28 bool do_stratum;
29 char *swarn;
30 char *scrit;
31 thresholds *stratum_thresholds;
32
33 // jitter stuff
34 bool do_jitter;
35 char *jwarn;
36 char *jcrit;
37 thresholds *jitter_thresholds;
38
39} check_ntp_peer_config;
40
41check_ntp_peer_config check_ntp_peer_config_init() {
42 check_ntp_peer_config tmp = {
43 .server_address = NULL,
44 .port = DEFAULT_NTP_PORT,
45
46 .quiet = false,
47 .do_truechimers = false,
48 .twarn = "0:",
49 .tcrit = "0:",
50 .truechimer_thresholds = NULL,
51
52 .owarn = "60",
53 .ocrit = "120",
54 .offset_thresholds = NULL,
55
56 .do_stratum = false,
57 .swarn = "-1:16",
58 .scrit = "-1:16",
59 .stratum_thresholds = NULL,
60
61 .do_jitter = false,
62 .jwarn = "-1:5000",
63 .jcrit = "-1:10000",
64 .jitter_thresholds = NULL,
65 };
66 return tmp;
67}