diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_swap.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index ef1b9500..fe9254d2 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -79,14 +79,13 @@ main (int argc, char **argv) | |||
79 | # endif | 79 | # endif |
80 | #endif | 80 | #endif |
81 | char str[32]; | 81 | char str[32]; |
82 | char *status, *tmp_status; | 82 | char *status; |
83 | 83 | ||
84 | setlocale (LC_ALL, ""); | 84 | setlocale (LC_ALL, ""); |
85 | bindtextdomain (PACKAGE, LOCALEDIR); | 85 | bindtextdomain (PACKAGE, LOCALEDIR); |
86 | textdomain (PACKAGE); | 86 | textdomain (PACKAGE); |
87 | 87 | ||
88 | status = strdup (""); | 88 | status = strdup (""); |
89 | tmp_status = strdup (""); | ||
90 | perf = strdup (""); | 89 | perf = strdup (""); |
91 | 90 | ||
92 | if (process_arguments (argc, argv) == ERROR) | 91 | if (process_arguments (argc, argv) == ERROR) |
@@ -313,17 +312,16 @@ main (int argc, char **argv) | |||
313 | 312 | ||
314 | percent_used = 100 * ((double) used_swap) / ((double) total_swap); | 313 | percent_used = 100 * ((double) used_swap) / ((double) total_swap); |
315 | result = max_state (result, check_swap (percent_used, free_swap)); | 314 | result = max_state (result, check_swap (percent_used, free_swap)); |
316 | /* broken into two steps because of funkiness with builtin asprintf */ | 315 | printf (_("SWAP %s - %d%% free (%.0f MB out of %.0f MB) %s|"), |
317 | asprintf (&tmp_status, _(" %d%% free (%.0f MB out of %.0f MB)"), | 316 | state_text (result), |
318 | (100 - percent_used), free_swap, total_swap); | 317 | (100 - percent_used), free_swap, total_swap, status); |
319 | asprintf (&status, "%s%s", tmp_status, status); | 318 | |
320 | 319 | puts (perfdata ("swap", (long) free_swap, "MB", | |
321 | asprintf (&perf, "%s", perfdata ("swap", (long) free_swap, "MB", | 320 | TRUE, (long) max (warn_size/1024, warn_percent/100.0*total_swap), |
322 | TRUE, (long) max (warn_size/1024, warn_percent/100.0*total_swap), | 321 | TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap), |
323 | TRUE, (long) max (crit_size/1024, crit_percent/100.0*total_swap), | 322 | TRUE, 0, |
324 | TRUE, 0, | 323 | TRUE, (long) total_swap)); |
325 | TRUE, (long) total_swap)); | 324 | |
326 | printf ("SWAP %s:%s |%s\n", state_text (result), status, perf); | ||
327 | return result; | 325 | return result; |
328 | } | 326 | } |
329 | 327 | ||