From 2727f32f194233e9fdc333afa26a23d8759362ac Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:42:22 +0100 Subject: Refactor check_dbi --- plugins/check_dbi.d/config.h | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 plugins/check_dbi.d/config.h (limited to 'plugins/check_dbi.d') 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 @@ +#pragma once + +#include "../../config.h" +#include +#include "../../lib/monitoringplug.h" + +typedef enum { + METRIC_CONN_TIME, + METRIC_SERVER_VERSION, + METRIC_QUERY_RESULT, + METRIC_QUERY_TIME, +} mp_dbi_metric; + +typedef enum { + TYPE_NUMERIC, + TYPE_STRING, +} mp_dbi_type; + +typedef struct { + char *key; + char *value; +} driver_option_t; + +typedef struct { + char *dbi_driver; + char *host; + driver_option_t *dbi_options; + size_t dbi_options_num; + char *dbi_database; + char *dbi_query; + + char *expect; + char *expect_re_str; + int expect_re_cflags; + mp_dbi_metric metric; + mp_dbi_type type; + char *warning_range; + char *critical_range; + thresholds *dbi_thresholds; + +} check_dbi_config; + +check_dbi_config check_dbi_config_init() { + check_dbi_config tmp = { + .dbi_driver = NULL, + .host = NULL, + .dbi_options = NULL, + .dbi_options_num = 0, + .dbi_database = NULL, + .dbi_query = NULL, + + .expect = NULL, + .expect_re_str = NULL, + .expect_re_cflags = 0, + .metric = METRIC_QUERY_RESULT, + .type = TYPE_NUMERIC, + + .warning_range = NULL, + .critical_range = NULL, + .dbi_thresholds = NULL, + }; + return tmp; +} -- cgit v1.2.3-74-g34f1