From 0c70af5fef8bd7cbbad107224fd283f69ae0416a Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 30 Oct 2025 23:58:38 +0100 Subject: check_dbi: more refactoring for coherence and simplification --- plugins/check_dbi.d/config.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'plugins/check_dbi.d/config.h') diff --git a/plugins/check_dbi.d/config.h b/plugins/check_dbi.d/config.h index 09aa67da..25d74a12 100644 --- a/plugins/check_dbi.d/config.h +++ b/plugins/check_dbi.d/config.h @@ -3,18 +3,19 @@ #include "../../config.h" #include #include "../../lib/monitoringplug.h" +#include "thresholds.h" typedef enum { METRIC_CONN_TIME, METRIC_SERVER_VERSION, METRIC_QUERY_RESULT, METRIC_QUERY_TIME, -} mp_dbi_metric; +} check_dbi_metric; typedef enum { TYPE_NUMERIC, TYPE_STRING, -} mp_dbi_type; +} check_dbi_type; typedef struct { char *key; @@ -24,19 +25,19 @@ typedef struct { typedef struct { char *dbi_driver; char *host; + driver_option_t *dbi_options; size_t dbi_options_num; - char *dbi_database; - char *dbi_query; + + char *database; + char *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_metric metric; + check_dbi_type type; + mp_thresholds thresholds; bool output_format_is_set; mp_output_format output_format; @@ -48,8 +49,8 @@ check_dbi_config check_dbi_config_init() { .host = NULL, .dbi_options = NULL, .dbi_options_num = 0, - .dbi_database = NULL, - .dbi_query = NULL, + .database = NULL, + .query = NULL, .expect = NULL, .expect_re_str = NULL, @@ -57,9 +58,7 @@ check_dbi_config check_dbi_config_init() { .metric = METRIC_QUERY_RESULT, .type = TYPE_NUMERIC, - .warning_range = NULL, - .critical_range = NULL, - .dbi_thresholds = NULL, + .thresholds = mp_thresholds_init(), .output_format_is_set = false, }; -- cgit v1.2.3-74-g34f1