summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_swap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 7da26cf..2b8013b 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -145,11 +145,12 @@ main (int argc, char **argv)
145 xasprintf (&status, "%s [%lu (%d%%)]", status, dskfree_mb, 100 - percent); 145 xasprintf (&status, "%s [%lu (%d%%)]", status, dskfree_mb, 100 - percent);
146 } 146 }
147 } 147 }
148
148 /* 149 /*
149 * The following sscanf call looks for lines looking like: "SwapTotal: 123" and "SwapFree: 123" 150 * The following sscanf call looks for lines looking like: "SwapTotal: 123" and "SwapFree: 123"
150 * This format exists at least on Debian Linux with a 5.* kernel 151 * This format exists at least on Debian Linux with a 5.* kernel
151 */ 152 */
152 else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %lu %*[k]%*[B]", str, &tmp_KB)) { 153 else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %f %*[k]%*[B]", str, &tmp_mb)) {
153 if (verbose >= 3) { 154 if (verbose >= 3) {
154 printf("Got %s with %lu\n", str, tmp_KB); 155 printf("Got %s with %lu\n", str, tmp_KB);
155 } 156 }
@@ -158,7 +159,10 @@ main (int argc, char **argv)
158 dsktotal_mb = tmp_KB / 1024; 159 dsktotal_mb = tmp_KB / 1024;
159 } 160 }
160 else if (strcmp ("Free", str) == 0) { 161 else if (strcmp ("Free", str) == 0) {
161 dskfree_mb = tmp_KB / 1024; 162 dskfree_mb = dskfree_mb + tmp_mb / 1024;
163 }
164 else if (strcmp ("Cached", str) == 0) {
165 dskfree_mb = dskfree_mb + tmp_mb / 1024;
162 } 166 }
163 } 167 }
164 } 168 }