summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8809bae)
raw | patch | inline | side by side (parent: 8809bae)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 25 Feb 2004 08:12:56 +0000 (08:12 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 25 Feb 2004 08:12:56 +0000 (08:12 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@825 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_swap.c | patch | blob | history |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index dfa21808e4ed3569e77e099188b086b8a894cd6e..02b043e5156e9ee7034dc1f576c0afcafddff357 100644 (file)
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
int warn_percent = 0;
int crit_percent = 0;
-long unsigned int warn_size = 0;
-long unsigned int crit_size = 0;
+unsigned long long warn_size = 0;
+unsigned long long crit_size = 0;
int verbose;
int allswaps;
main (int argc, char **argv)
{
int percent_used, percent;
- long unsigned int total_swap = 0, used_swap = 0, free_swap = 0;
- long unsigned int dsktotal, dskused, dskfree;
+ unsigned long long total_swap = 0, used_swap = 0, free_swap = 0;
+ unsigned long long dsktotal, dskused, dskfree;
int result = STATE_OK;
char input_buffer[MAX_INPUT_BUFFER];
char *perf;
#ifdef HAVE_PROC_MEMINFO
fp = fopen (PROC_MEMINFO, "r");
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
- if (sscanf (input_buffer, " %s %lu %lu %lu", str, &dsktotal, &dskused, &dskfree) == 4 &&
+ if (sscanf (input_buffer, " %s %llu %llu %llu", str, &dsktotal, &dskused, &dskfree) == 4 &&
strstr (str, "Swap")) {
dsktotal = dsktotal / 1048576;
dskused = dskused / 1048576;
percent = 100 * (((double) dskused) / ((double) dsktotal));
result = max_state (result, check_swap (percent, dskfree));
if (verbose)
- asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent);
+ asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent);
}
}
}
percent = 100 * (((double) dskused) / ((double) dsktotal));
result = max_state (result, check_swap (percent, dskfree));
if (verbose)
- asprintf (&status, "%s [%lu (%d%%)]", status, dskfree, 100 - percent);
+ asprintf (&status, "%s [%llu (%d%%)]", status, dskfree, 100 - percent);
}
}
# ifdef _AIX
percent_used = 100 * ((double) used_swap) / ((double) total_swap);
result = max_state (result, check_swap (percent_used, free_swap));
- asprintf (&status, _(" %d%% free (%lu MB out of %lu MB)%s"),
+ asprintf (&status, _(" %d%% free (%llu MB out of %llu MB)%s"),
(100 - percent_used), free_swap, total_swap, status);
asprintf (&perf, "%s", perfdata ("swap", (long) free_swap, "MB",
}
else if (strstr (optarg, ",") &&
strstr (optarg, "%") &&
- sscanf (optarg, "%lu,%d%%", &warn_size, &warn_percent) == 2) {
+ sscanf (optarg, "%llu,%d%%", &warn_size, &warn_percent) == 2) {
break;
}
else if (strstr (optarg, "%") &&
}
else if (strstr (optarg, ",") &&
strstr (optarg, "%") &&
- sscanf (optarg, "%lu,%d%%", &crit_size, &crit_percent) == 2) {
+ sscanf (optarg, "%llu,%d%%", &crit_size, &crit_percent) == 2) {
break;
}
else if (strstr (optarg, "%") &&