From ba6f90373333246bce196dbba494fa4af0bd9253 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Tue, 4 Nov 2025 14:17:16 +0100 Subject: check_pgsql: implement modern output --- plugins/check_pgsql.d/config.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'plugins/check_pgsql.d/config.h') 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 @@ #pragma once #include "../../config.h" +#include "perfdata.h" #include "thresholds.h" #include #include @@ -24,11 +25,8 @@ typedef struct { char *pgquery; char *pgqueryname; - double twarn; - double tcrit; - thresholds *qthresholds; - char *query_warning; - char *query_critical; + mp_thresholds time_thresholds; + mp_thresholds qthresholds; } check_pgsql_config; /* begin, by setting the parameters for a backend connection if the @@ -51,11 +49,16 @@ check_pgsql_config check_pgsql_config_init() { .pgquery = NULL, .pgqueryname = NULL, - .twarn = (double)DEFAULT_WARN, - .tcrit = (double)DEFAULT_CRIT, - .qthresholds = NULL, - .query_warning = NULL, - .query_critical = NULL, + .time_thresholds = mp_thresholds_init(), + .qthresholds = mp_thresholds_init(), }; + + mp_range tmp_range = mp_range_init(); + tmp_range = mp_range_set_end(tmp_range, mp_create_pd_value(DEFAULT_WARN)); + tmp.time_thresholds = mp_thresholds_set_warn(tmp.time_thresholds, tmp_range); + + tmp_range = mp_range_set_end(tmp_range, mp_create_pd_value(DEFAULT_CRIT)); + tmp.time_thresholds = mp_thresholds_set_crit(tmp.time_thresholds, tmp_range); + return tmp; } -- cgit v1.2.3-74-g34f1