mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-08 18:36:45 -04:00
Merge pull request #1642 from mdavranche/master
check_swap: Handle cached swap
This commit is contained in:
commit
9899bc736f
1 changed files with 6 additions and 2 deletions
|
|
@ -145,11 +145,12 @@ main (int argc, char **argv)
|
|||
xasprintf (&status, "%s [%lu (%d%%)]", status, dskfree_mb, 100 - percent);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The following sscanf call looks for lines looking like: "SwapTotal: 123" and "SwapFree: 123"
|
||||
* This format exists at least on Debian Linux with a 5.* kernel
|
||||
*/
|
||||
else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %lu %*[k]%*[B]", str, &tmp_KB)) {
|
||||
else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %f %*[k]%*[B]", str, &tmp_KB)) {
|
||||
if (verbose >= 3) {
|
||||
printf("Got %s with %lu\n", str, tmp_KB);
|
||||
}
|
||||
|
|
@ -158,7 +159,10 @@ main (int argc, char **argv)
|
|||
dsktotal_mb = tmp_KB / 1024;
|
||||
}
|
||||
else if (strcmp ("Free", str) == 0) {
|
||||
dskfree_mb = tmp_KB / 1024;
|
||||
dskfree_mb = dskfree_mb + tmp_KB / 1024;
|
||||
}
|
||||
else if (strcmp ("Cached", str) == 0) {
|
||||
dskfree_mb = dskfree_mb + tmp_KB / 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue