summaryrefslogtreecommitdiffstats
path: root/plugins/check_dbi.d
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-10-30 23:58:38 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-10-30 23:58:38 +0100
commit0c70af5fef8bd7cbbad107224fd283f69ae0416a (patch)
tree957a3b9f2677989d6f1ef0f027d19183ca680e9f /plugins/check_dbi.d
parent408783f53d0baaf7341c7c584ca64a9073d66ee2 (diff)
downloadmonitoring-plugins-0c70af5fef8bd7cbbad107224fd283f69ae0416a.tar.gz
check_dbi: more refactoring for coherence and simplification
Diffstat (limited to 'plugins/check_dbi.d')
-rw-r--r--plugins/check_dbi.d/config.h27
1 files changed, 13 insertions, 14 deletions
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 @@
3#include "../../config.h" 3#include "../../config.h"
4#include <stddef.h> 4#include <stddef.h>
5#include "../../lib/monitoringplug.h" 5#include "../../lib/monitoringplug.h"
6#include "thresholds.h"
6 7
7typedef enum { 8typedef enum {
8 METRIC_CONN_TIME, 9 METRIC_CONN_TIME,
9 METRIC_SERVER_VERSION, 10 METRIC_SERVER_VERSION,
10 METRIC_QUERY_RESULT, 11 METRIC_QUERY_RESULT,
11 METRIC_QUERY_TIME, 12 METRIC_QUERY_TIME,
12} mp_dbi_metric; 13} check_dbi_metric;
13 14
14typedef enum { 15typedef enum {
15 TYPE_NUMERIC, 16 TYPE_NUMERIC,
16 TYPE_STRING, 17 TYPE_STRING,
17} mp_dbi_type; 18} check_dbi_type;
18 19
19typedef struct { 20typedef struct {
20 char *key; 21 char *key;
@@ -24,19 +25,19 @@ typedef struct {
24typedef struct { 25typedef struct {
25 char *dbi_driver; 26 char *dbi_driver;
26 char *host; 27 char *host;
28
27 driver_option_t *dbi_options; 29 driver_option_t *dbi_options;
28 size_t dbi_options_num; 30 size_t dbi_options_num;
29 char *dbi_database; 31
30 char *dbi_query; 32 char *database;
33 char *query;
31 34
32 char *expect; 35 char *expect;
33 char *expect_re_str; 36 char *expect_re_str;
34 int expect_re_cflags; 37 int expect_re_cflags;
35 mp_dbi_metric metric; 38 check_dbi_metric metric;
36 mp_dbi_type type; 39 check_dbi_type type;
37 char *warning_range; 40 mp_thresholds thresholds;
38 char *critical_range;
39 thresholds *dbi_thresholds;
40 41
41 bool output_format_is_set; 42 bool output_format_is_set;
42 mp_output_format output_format; 43 mp_output_format output_format;
@@ -48,8 +49,8 @@ check_dbi_config check_dbi_config_init() {
48 .host = NULL, 49 .host = NULL,
49 .dbi_options = NULL, 50 .dbi_options = NULL,
50 .dbi_options_num = 0, 51 .dbi_options_num = 0,
51 .dbi_database = NULL, 52 .database = NULL,
52 .dbi_query = NULL, 53 .query = NULL,
53 54
54 .expect = NULL, 55 .expect = NULL,
55 .expect_re_str = NULL, 56 .expect_re_str = NULL,
@@ -57,9 +58,7 @@ check_dbi_config check_dbi_config_init() {
57 .metric = METRIC_QUERY_RESULT, 58 .metric = METRIC_QUERY_RESULT,
58 .type = TYPE_NUMERIC, 59 .type = TYPE_NUMERIC,
59 60
60 .warning_range = NULL, 61 .thresholds = mp_thresholds_init(),
61 .critical_range = NULL,
62 .dbi_thresholds = NULL,
63 62
64 .output_format_is_set = false, 63 .output_format_is_set = false,
65 }; 64 };