summaryrefslogtreecommitdiffstats
path: root/plugins/check_pgsql.d/config.h
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2025-11-05 14:17:37 +0100
committerGitHub <noreply@github.com>2025-11-05 14:17:37 +0100
commit7240eae6ef5b66f26967ab6e236ae3ebe7448efc (patch)
tree9c291501740090ac3ca1dd7c0a7047cbefb0aa3b /plugins/check_pgsql.d/config.h
parentad7acf4618f1ac8a49277a482fb4ca391a26f584 (diff)
parent36ac312e07f6b0ff214b21783f42131b90aa553f (diff)
downloadmonitoring-plugins-7240eae6ef5b66f26967ab6e236ae3ebe7448efc.tar.gz
Merge pull request #2173 from RincewindsHat/modern_output/check_pgsqlHEADmaster
Modern output/check pgsql
Diffstat (limited to 'plugins/check_pgsql.d/config.h')
-rw-r--r--plugins/check_pgsql.d/config.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/plugins/check_pgsql.d/config.h b/plugins/check_pgsql.d/config.h
index 2d4b8b89..7cf0637b 100644
--- a/plugins/check_pgsql.d/config.h
+++ b/plugins/check_pgsql.d/config.h
@@ -1,6 +1,8 @@
1#pragma once 1#pragma once
2 2
3#include "../../config.h" 3#include "../../config.h"
4#include "output.h"
5#include "perfdata.h"
4#include "thresholds.h" 6#include "thresholds.h"
5#include <stddef.h> 7#include <stddef.h>
6#include <pg_config_manual.h> 8#include <pg_config_manual.h>
@@ -24,11 +26,11 @@ typedef struct {
24 char *pgquery; 26 char *pgquery;
25 char *pgqueryname; 27 char *pgqueryname;
26 28
27 double twarn; 29 mp_thresholds time_thresholds;
28 double tcrit; 30 mp_thresholds qthresholds;
29 thresholds *qthresholds; 31
30 char *query_warning; 32 bool output_format_is_set;
31 char *query_critical; 33 mp_output_format output_format;
32} check_pgsql_config; 34} check_pgsql_config;
33 35
34/* begin, by setting the parameters for a backend connection if the 36/* begin, by setting the parameters for a backend connection if the
@@ -51,11 +53,18 @@ check_pgsql_config check_pgsql_config_init() {
51 .pgquery = NULL, 53 .pgquery = NULL,
52 .pgqueryname = NULL, 54 .pgqueryname = NULL,
53 55
54 .twarn = (double)DEFAULT_WARN, 56 .time_thresholds = mp_thresholds_init(),
55 .tcrit = (double)DEFAULT_CRIT, 57 .qthresholds = mp_thresholds_init(),
56 .qthresholds = NULL, 58
57 .query_warning = NULL, 59 .output_format_is_set = false,
58 .query_critical = NULL,
59 }; 60 };
61
62 mp_range tmp_range = mp_range_init();
63 tmp_range = mp_range_set_end(tmp_range, mp_create_pd_value(DEFAULT_WARN));
64 tmp.time_thresholds = mp_thresholds_set_warn(tmp.time_thresholds, tmp_range);
65
66 tmp_range = mp_range_set_end(tmp_range, mp_create_pd_value(DEFAULT_CRIT));
67 tmp.time_thresholds = mp_thresholds_set_crit(tmp.time_thresholds, tmp_range);
68
60 return tmp; 69 return tmp;
61} 70}