summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_time.d/config.h
blob: a62e4cebe75f9d485412d2934eeb78d72aca0431 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "../../config.h"
#include "thresholds.h"
#include <stddef.h>

typedef struct {
	char *server_address;
	char *port;

	bool quiet;
	int time_offset;

	mp_thresholds offset_thresholds;
} check_ntp_time_config;

check_ntp_time_config check_ntp_time_config_init() {
	check_ntp_time_config tmp = {
		.server_address = NULL,
		.port = "123",

		.quiet = false,
		.time_offset = 0,

		.offset_thresholds = mp_thresholds_init(),
	};

	mp_range warning = mp_range_init();
	warning = mp_range_set_end(warning, mp_create_pd_value(60));
	tmp.offset_thresholds = mp_thresholds_set_warn(tmp.offset_thresholds, warning);

	mp_range critical = mp_range_init();
	critical = mp_range_set_end(warning, mp_create_pd_value(120));
	tmp.offset_thresholds = mp_thresholds_set_crit(tmp.offset_thresholds, critical);

	return tmp;
}