From 14342ac87a26e3593b00dcb8482a280544b1667e Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 10 Nov 2024 00:19:03 +0100 Subject: check_swap: Small improvements --- plugins/check_swap.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'plugins/check_swap.c') diff --git a/plugins/check_swap.c b/plugins/check_swap.c index c3199ab7..ef60ce1b 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -27,11 +27,6 @@ * *****************************************************************************/ -#include -const char *progname = "check_swap"; -const char *copyright = "2000-2024"; -const char *email = "devel@monitoring-plugins.org"; - #ifdef HAVE_DECL_SWAPCTL # ifdef HAVE_SYS_PARAM_H # include @@ -44,6 +39,7 @@ const char *email = "devel@monitoring-plugins.org"; # endif #endif +#include #include "./check_swap.d/check_swap.h" #include "./utils.h" @@ -63,13 +59,16 @@ int verbose; #define BYTES_TO_KiB(number) (number / 1024) #define BYTES_TO_MiB(number) (BYTES_TO_KiB(number) / 1024) +const char *progname = "check_swap"; +const char *copyright = "2000-2024"; +const char *email = "devel@monitoring-plugins.org"; + int main(int argc, char **argv) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - char *status; - status = strdup(""); + char *status = strdup(""); /* Parse extra opts if any */ argv = np_extra_opts(&argc, argv, progname); @@ -85,7 +84,6 @@ int main(int argc, char **argv) { swap_result data = get_swap_data(config); double percent_used; - /* if total_swap_mb == 0, let's not divide by 0 */ if (data.metrics.total != 0) { percent_used = HUNDRED_PERCENT * ((double)data.metrics.used) / ((double)data.metrics.total); -- cgit v1.2.3-74-g34f1