diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-30 22:36:55 +0200 |
|---|---|---|
| committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-30 22:36:55 +0200 |
| commit | 0bca1d1aa36b13723e77672eae162352e9be99c9 (patch) | |
| tree | bc44475583f484f1b9e3d3aa030013d077e479de /lib | |
| parent | 0205694ce977af97a71c58e0ae3c431299ceb7bb (diff) | |
| download | monitoring-plugins-0bca1d1aa36b13723e77672eae162352e9be99c9.tar.gz | |
Implement some helper functions for thresholds
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/thresholds.c | 12 | ||||
| -rw-r--r-- | lib/thresholds.h | 3 |
2 files changed, 15 insertions, 0 deletions
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) { | |||
| 57 | 57 | ||
| 58 | return STATE_OK; | 58 | return STATE_OK; |
| 59 | } | 59 | } |
| 60 | |||
| 61 | mp_thresholds mp_thresholds_set_warn(mp_thresholds thlds, mp_range warn) { | ||
| 62 | thlds.warning = warn; | ||
| 63 | thlds.warning_is_set = true; | ||
| 64 | return thlds; | ||
| 65 | } | ||
| 66 | |||
| 67 | mp_thresholds mp_thresholds_set_crit(mp_thresholds thlds, mp_range crit) { | ||
| 68 | thlds.critical = crit; | ||
| 69 | thlds.critical_is_set = true; | ||
| 70 | return thlds; | ||
| 71 | } | ||
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 */); | |||
| 24 | 24 | ||
| 25 | mp_state_enum mp_get_pd_status(mp_perfdata /* pd */); | 25 | mp_state_enum mp_get_pd_status(mp_perfdata /* pd */); |
| 26 | 26 | ||
| 27 | mp_thresholds mp_thresholds_set_warn(mp_thresholds thlds, mp_range warn); | ||
| 28 | mp_thresholds mp_thresholds_set_crit(mp_thresholds thlds, mp_range crit); | ||
| 29 | |||
| 27 | char *fmt_threshold_warning(thresholds th); | 30 | char *fmt_threshold_warning(thresholds th); |
| 28 | char *fmt_threshold_critical(thresholds th); | 31 | char *fmt_threshold_critical(thresholds th); |
