summaryrefslogtreecommitdiffstats
path: root/plugins/check_swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r--plugins/check_swap.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 4e3471b6..c3199ab7 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -56,10 +56,13 @@ static swap_config_wrapper process_arguments(int argc, char **argv);
56void print_usage(void); 56void print_usage(void);
57static void print_help(swap_config /*config*/); 57static void print_help(swap_config /*config*/);
58 58
59static int verbose; 59int verbose;
60 60
61#define HUNDRED_PERCENT 100 61#define HUNDRED_PERCENT 100
62 62
63#define BYTES_TO_KiB(number) (number / 1024)
64#define BYTES_TO_MiB(number) (BYTES_TO_KiB(number) / 1024)
65
63int main(int argc, char **argv) { 66int main(int argc, char **argv) {
64 setlocale(LC_ALL, ""); 67 setlocale(LC_ALL, "");
65 bindtextdomain(PACKAGE, LOCALEDIR); 68 bindtextdomain(PACKAGE, LOCALEDIR);
@@ -127,8 +130,8 @@ int main(int argc, char **argv) {
127 data.statusCode = max_state(data.statusCode, STATE_CRITICAL); 130 data.statusCode = max_state(data.statusCode, STATE_CRITICAL);
128 } 131 }
129 132
130 printf(_("SWAP %s - %g%% free (%lluMB out of %lluMB) %s|%s\n"), state_text(data.statusCode), (HUNDRED_PERCENT - percent_used), 133 printf(_("SWAP %s - %g%% free (%lluMiB out of %lluMiB) %s|%s\n"), state_text(data.statusCode), (HUNDRED_PERCENT - percent_used),
131 data.metrics.free, data.metrics.total, status, perfdata); 134 BYTES_TO_MiB(data.metrics.free), BYTES_TO_MiB(data.metrics.total), status, perfdata);
132 135
133 exit(data.statusCode); 136 exit(data.statusCode);
134} 137}