diff options
Diffstat (limited to 'plugins/check_dbi.d')
| -rw-r--r-- | plugins/check_dbi.d/config.h | 63 |
1 files changed, 63 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..f6f0d7b3 --- /dev/null +++ b/plugins/check_dbi.d/config.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../../config.h" | ||
| 4 | #include <stddef.h> | ||
| 5 | #include "../../lib/monitoringplug.h" | ||
| 6 | |||
| 7 | typedef enum { | ||
| 8 | METRIC_CONN_TIME, | ||
| 9 | METRIC_SERVER_VERSION, | ||
| 10 | METRIC_QUERY_RESULT, | ||
| 11 | METRIC_QUERY_TIME, | ||
| 12 | } mp_dbi_metric; | ||
| 13 | |||
| 14 | typedef enum { | ||
| 15 | TYPE_NUMERIC, | ||
| 16 | TYPE_STRING, | ||
| 17 | } mp_dbi_type; | ||
| 18 | |||
| 19 | typedef struct { | ||
| 20 | char *key; | ||
| 21 | char *value; | ||
| 22 | } driver_option_t; | ||
| 23 | |||
| 24 | typedef struct { | ||
| 25 | char *dbi_driver; | ||
| 26 | char *host; | ||
| 27 | driver_option_t *dbi_options; | ||
| 28 | size_t dbi_options_num; | ||
| 29 | char *dbi_database; | ||
| 30 | char *dbi_query; | ||
| 31 | |||
| 32 | char *expect; | ||
| 33 | char *expect_re_str; | ||
| 34 | int expect_re_cflags; | ||
| 35 | mp_dbi_metric metric; | ||
| 36 | mp_dbi_type type; | ||
| 37 | char *warning_range; | ||
| 38 | char *critical_range; | ||
| 39 | thresholds *dbi_thresholds; | ||
| 40 | |||
| 41 | } check_dbi_config; | ||
| 42 | |||
| 43 | check_dbi_config check_dbi_config_init() { | ||
| 44 | check_dbi_config tmp = { | ||
| 45 | .dbi_driver = NULL, | ||
| 46 | .host = NULL, | ||
| 47 | .dbi_options = NULL, | ||
| 48 | .dbi_options_num = 0, | ||
| 49 | .dbi_database = NULL, | ||
| 50 | .dbi_query = NULL, | ||
| 51 | |||
| 52 | .expect = NULL, | ||
| 53 | .expect_re_str = NULL, | ||
| 54 | .expect_re_cflags = 0, | ||
| 55 | .metric = METRIC_QUERY_RESULT, | ||
| 56 | .type = TYPE_NUMERIC, | ||
| 57 | |||
| 58 | .warning_range = NULL, | ||
| 59 | .critical_range = NULL, | ||
| 60 | .dbi_thresholds = NULL, | ||
| 61 | }; | ||
| 62 | return tmp; | ||
| 63 | } | ||
