diff options
author | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-09-26 01:34:45 +0200 |
---|---|---|
committer | RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> | 2021-09-26 01:34:45 +0200 |
commit | f55ea7632f4284a0b8858361270337bd9fde9a60 (patch) | |
tree | eeddbe73c2f4661bfed95ecd5247c5c1e33a675d /plugins/check_swap.c | |
parent | 280ae58ed8e340f8096cf37f60c84f99d6723537 (diff) | |
download | monitoring-plugins-f55ea7632f4284a0b8858361270337bd9fde9a60.tar.gz |
Fix comparing logic
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r-- | plugins/check_swap.c | 4 |
1 files 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) | |||
400 | 400 | ||
401 | uint64_t free_swap = free_swap_mb * (1024 * 1024); /* Convert back to bytes as warn and crit specified in bytes */ | 401 | uint64_t free_swap = free_swap_mb * (1024 * 1024); /* Convert back to bytes as warn and crit specified in bytes */ |
402 | 402 | ||
403 | if (!crit.is_percentage && crit.value <= free_swap) return STATE_CRITICAL; | 403 | if (!crit.is_percentage && crit.value >= free_swap) return STATE_CRITICAL; |
404 | if (!warn.is_percentage && warn.value <= free_swap) return STATE_WARNING; | 404 | if (!warn.is_percentage && warn.value >= free_swap) return STATE_WARNING; |
405 | 405 | ||
406 | 406 | ||
407 | uint64_t usage_percentage = ((total_swap_mb - free_swap_mb) / total_swap_mb) * 100; | 407 | uint64_t usage_percentage = ((total_swap_mb - free_swap_mb) / total_swap_mb) * 100; |