From f55ea7632f4284a0b8858361270337bd9fde9a60 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 26 Sep 2021 01:34:45 +0200 Subject: Fix comparing logic --- plugins/check_swap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 25bcb3d5..6dec9b28 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -400,8 +400,8 @@ check_swap(float free_swap_mb, float total_swap_mb) uint64_t free_swap = free_swap_mb * (1024 * 1024); /* Convert back to bytes as warn and crit specified in bytes */ - if (!crit.is_percentage && crit.value <= free_swap) return STATE_CRITICAL; - if (!warn.is_percentage && warn.value <= free_swap) return STATE_WARNING; + if (!crit.is_percentage && crit.value >= free_swap) return STATE_CRITICAL; + if (!warn.is_percentage && warn.value >= free_swap) return STATE_WARNING; uint64_t usage_percentage = ((total_swap_mb - free_swap_mb) / total_swap_mb) * 100; -- cgit v1.2.3-74-g34f1