summaryrefslogtreecommitdiffstats
path: root/plugins/check_pgsql.d/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_pgsql.d/config.h')
-rw-r--r--plugins/check_pgsql.d/config.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/plugins/check_pgsql.d/config.h b/plugins/check_pgsql.d/config.h
index 2d4b8b89..7c1ff55a 100644
--- a/plugins/check_pgsql.d/config.h
+++ b/plugins/check_pgsql.d/config.h
@@ -1,6 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "../../config.h" 3#include "../../config.h"
4#include "perfdata.h"
4#include "thresholds.h" 5#include "thresholds.h"
5#include <stddef.h> 6#include <stddef.h>
6#include <pg_config_manual.h> 7#include <pg_config_manual.h>
@@ -24,11 +25,8 @@ typedef struct {
24 char *pgquery; 25 char *pgquery;
25 char *pgqueryname; 26 char *pgqueryname;
26 27
27 double twarn; 28 mp_thresholds time_thresholds;
28 double tcrit; 29 mp_thresholds qthresholds;
29 thresholds *qthresholds;
30 char *query_warning;
31 char *query_critical;
32} check_pgsql_config; 30} check_pgsql_config;
33 31
34/* begin, by setting the parameters for a backend connection if the 32/* begin, by setting the parameters for a backend connection if the
@@ -51,11 +49,16 @@ check_pgsql_config check_pgsql_config_init() {
51 .pgquery = NULL, 49 .pgquery = NULL,
52 .pgqueryname = NULL, 50 .pgqueryname = NULL,
53 51
54 .twarn = (double)DEFAULT_WARN, 52 .time_thresholds = mp_thresholds_init(),
55 .tcrit = (double)DEFAULT_CRIT, 53 .qthresholds = mp_thresholds_init(),
56 .qthresholds = NULL,
57 .query_warning = NULL,
58 .query_critical = NULL,
59 }; 54 };
55
56 mp_range tmp_range = mp_range_init();
57 tmp_range = mp_range_set_end(tmp_range, mp_create_pd_value(DEFAULT_WARN));
58 tmp.time_thresholds = mp_thresholds_set_warn(tmp.time_thresholds, tmp_range);
59
60 tmp_range = mp_range_set_end(tmp_range, mp_create_pd_value(DEFAULT_CRIT));
61 tmp.time_thresholds = mp_thresholds_set_crit(tmp.time_thresholds, tmp_range);
62
60 return tmp; 63 return tmp;
61} 64}