summaryrefslogtreecommitdiffstats
path: root/plugins/check_dbi.d/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_dbi.d/config.h')
-rw-r--r--plugins/check_dbi.d/config.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/plugins/check_dbi.d/config.h b/plugins/check_dbi.d/config.h
new file mode 100644
index 00000000..25d74a12
--- /dev/null
+++ b/plugins/check_dbi.d/config.h
@@ -0,0 +1,66 @@
1#pragma once
2
3#include "../../config.h"
4#include <stddef.h>
5#include "../../lib/monitoringplug.h"
6#include "thresholds.h"
7
8typedef enum {
9 METRIC_CONN_TIME,
10 METRIC_SERVER_VERSION,
11 METRIC_QUERY_RESULT,
12 METRIC_QUERY_TIME,
13} check_dbi_metric;
14
15typedef enum {
16 TYPE_NUMERIC,
17 TYPE_STRING,
18} check_dbi_type;
19
20typedef struct {
21 char *key;
22 char *value;
23} driver_option_t;
24
25typedef struct {
26 char *dbi_driver;
27 char *host;
28
29 driver_option_t *dbi_options;
30 size_t dbi_options_num;
31
32 char *database;
33 char *query;
34
35 char *expect;
36 char *expect_re_str;
37 int expect_re_cflags;
38 check_dbi_metric metric;
39 check_dbi_type type;
40 mp_thresholds thresholds;
41
42 bool output_format_is_set;
43 mp_output_format output_format;
44} check_dbi_config;
45
46check_dbi_config check_dbi_config_init() {
47 check_dbi_config tmp = {
48 .dbi_driver = NULL,
49 .host = NULL,
50 .dbi_options = NULL,
51 .dbi_options_num = 0,
52 .database = NULL,
53 .query = NULL,
54
55 .expect = NULL,
56 .expect_re_str = NULL,
57 .expect_re_cflags = 0,
58 .metric = METRIC_QUERY_RESULT,
59 .type = TYPE_NUMERIC,
60
61 .thresholds = mp_thresholds_init(),
62
63 .output_format_is_set = false,
64 };
65 return tmp;
66}