From 0bca1d1aa36b13723e77672eae162352e9be99c9 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 30 Mar 2025 22:36:55 +0200 Subject: Implement some helper functions for thresholds --- lib/thresholds.c | 12 ++++++++++++ lib/thresholds.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/thresholds.c b/lib/thresholds.c index 171f5093..de2b9315 100644 --- a/lib/thresholds.c +++ b/lib/thresholds.c @@ -57,3 +57,15 @@ mp_state_enum mp_get_pd_status(mp_perfdata perfdata) { return STATE_OK; } + +mp_thresholds mp_thresholds_set_warn(mp_thresholds thlds, mp_range warn) { + thlds.warning = warn; + thlds.warning_is_set = true; + return thlds; +} + +mp_thresholds mp_thresholds_set_crit(mp_thresholds thlds, mp_range crit) { + thlds.critical = crit; + thlds.critical_is_set = true; + return thlds; +} diff --git a/lib/thresholds.h b/lib/thresholds.h index 4e7defee..5f9f9247 100644 --- a/lib/thresholds.h +++ b/lib/thresholds.h @@ -24,5 +24,8 @@ mp_perfdata mp_pd_set_thresholds(mp_perfdata /* pd */, mp_thresholds /* th */); mp_state_enum mp_get_pd_status(mp_perfdata /* pd */); +mp_thresholds mp_thresholds_set_warn(mp_thresholds thlds, mp_range warn); +mp_thresholds mp_thresholds_set_crit(mp_thresholds thlds, mp_range crit); + char *fmt_threshold_warning(thresholds th); char *fmt_threshold_critical(thresholds th); -- cgit v1.2.3-74-g34f1