diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_swap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index dfa2180..02b043e 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -42,8 +42,8 @@ void print_help (void); | |||
42 | 42 | ||
43 | int warn_percent = 0; | 43 | int warn_percent = 0; |
44 | int crit_percent = 0; | 44 | int crit_percent = 0; |
45 | long unsigned int warn_size = 0; | 45 | unsigned long long warn_size = 0; |
46 | long unsigned int crit_size = 0; | 46 | unsigned long long crit_size = 0; |
47 | int verbose; | 47 | int verbose; |
48 | int allswaps; | 48 | int allswaps; |
49 | 49 | ||
@@ -51,8 +51,8 @@ int | |||
51 | main (int argc, char **argv) | 51 | main (int argc, char **argv) |
52 | { | 52 | { |
53 | int percent_used, percent; | 53 | int percent_used, percent; |
54 | long unsigned int total_swap = 0, used_swap = 0, free_swap = 0; | 54 | unsigned long long total_swap = 0, used_swap = 0, free_swap = 0; |
55 | long unsigned int dsktotal, dskused, dskfree; | 55 | unsigned long long dsktotal, dskused, dskfree; |
56 | int result = STATE_OK; | 56 | int result = STATE_OK; |
57 | char input_buffer[MAX_INPUT_BUFFER]; | 57 | char input_buffer[MAX_INPUT_BUFFER]; |
58 | char *perf; | 58 | char *perf; |
@@ -82,7 +82,7 @@ main (int argc, char **argv) | |||
82 | #ifdef HAVE_PROC_MEMINFO | 82 | #ifdef HAVE_PROC_MEMINFO |
83 | fp = fopen (PROC_MEMINFO, "r"); | 83 | fp = fopen (PROC_MEMINFO, "r"); |
84 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { | 84 | while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) { |
85 | if (sscanf (input_buffer, " %s %lu %lu %lu", str, &dsktotal, &dskused, &dskfree) == 4 && | 85 | if (sscanf (input_buffer, " %s %llu %llu %llu", str, &dsktotal, &dskused, &dskfree) == 4 && |
86 | strstr (str, "Swap")) { | 86 | strstr (str, "Swap")) { |
87 | dsktotal = dsktotal / 1048576; | 87 | dsktotal = dsktotal / 1048576; |
88 | dskused = dskused / 1048576; | 88 | dskused = dskused / 1048576; |
@@ -94,7 +94,7 @@ main (int argc, char **argv) | |||
94 | percent = 100 * (((double) dskused) / ((double) dsktotal)); | 94 | percent = 100 * (((double) dskused) / ((double) dsktotal)); |
95 | result = max_state (result, check_swap (percent, dskfree)); | 95 | result = max_state (result, check_swap (percent, dskfree)); |
96 | if (verbose) | 96 | if (verbose) |
97 | asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent); | 97 | asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | } | 100 | } |
@@ -195,7 +195,7 @@ main (int argc, char **argv) | |||
195 | percent = 100 * (((double) dskused) / ((double) dsktotal)); | 195 | percent = 100 * (((double) dskused) / ((double) dsktotal)); |
196 | result = max_state (result, check_swap (percent, dskfree)); | 196 | result = max_state (result, check_swap (percent, dskfree)); |
197 | if (verbose) | 197 | if (verbose) |
198 | asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent); | 198 | asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent); |
199 | } | 199 | } |
200 | } | 200 | } |
201 | # ifdef _AIX | 201 | # ifdef _AIX |
@@ -221,7 +221,7 @@ main (int argc, char **argv) | |||
221 | 221 | ||
222 | percent_used = 100 * ((double) used_swap) / ((double) total_swap); | 222 | percent_used = 100 * ((double) used_swap) / ((double) total_swap); |
223 | result = max_state (result, check_swap (percent_used, free_swap)); | 223 | result = max_state (result, check_swap (percent_used, free_swap)); |
224 | asprintf (&status, _(" %d%% free (%lu MB out of %lu MB)%s"), | 224 | asprintf (&status, _(" %d%% free (%llu MB out of %llu MB)%s"), |
225 | (100 - percent_used), free_swap, total_swap, status); | 225 | (100 - percent_used), free_swap, total_swap, status); |
226 | 226 | ||
227 | asprintf (&perf, "%s", perfdata ("swap", (long) free_swap, "MB", | 227 | asprintf (&perf, "%s", perfdata ("swap", (long) free_swap, "MB", |
@@ -289,7 +289,7 @@ process_arguments (int argc, char **argv) | |||
289 | } | 289 | } |
290 | else if (strstr (optarg, ",") && | 290 | else if (strstr (optarg, ",") && |
291 | strstr (optarg, "%") && | 291 | strstr (optarg, "%") && |
292 | sscanf (optarg, "%lu,%d%%", &warn_size, &warn_percent) == 2) { | 292 | sscanf (optarg, "%llu,%d%%", &warn_size, &warn_percent) == 2) { |
293 | break; | 293 | break; |
294 | } | 294 | } |
295 | else if (strstr (optarg, "%") && | 295 | else if (strstr (optarg, "%") && |
@@ -306,7 +306,7 @@ process_arguments (int argc, char **argv) | |||
306 | } | 306 | } |
307 | else if (strstr (optarg, ",") && | 307 | else if (strstr (optarg, ",") && |
308 | strstr (optarg, "%") && | 308 | strstr (optarg, "%") && |
309 | sscanf (optarg, "%lu,%d%%", &crit_size, &crit_percent) == 2) { | 309 | sscanf (optarg, "%llu,%d%%", &crit_size, &crit_percent) == 2) { |
310 | break; | 310 | break; |
311 | } | 311 | } |
312 | else if (strstr (optarg, "%") && | 312 | else if (strstr (optarg, "%") && |