[monitoring-plugins] fix parsing swap values (#1780)

GitHub git at monitoring-plugins.org
Mon Jul 25 10:10:11 CEST 2022


    Module: monitoring-plugins
    Branch: master
    Commit: a01de7b33dee837e7a474d9e00131942d7f177f0
    Author: Sven Nierlein <sven at nierlein.de>
 Committer: GitHub <noreply at github.com>
      Date: Mon Jul 25 10:00:18 2022 +0200
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=a01de7b

fix parsing swap values (#1780)

tmp_KB changed from float to uint64, so change the sscanf format accordingly.

---

 plugins/check_swap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index bb854be..6c9418f 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -150,7 +150,7 @@ main (int argc, char **argv)
 		 * 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]%[TotalFreCchd]%*[:] %f %*[k]%*[B]", str, &tmp_KB)) {
+		else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %lu %*[k]%*[B]", str, &tmp_KB)) {
 			if (verbose >= 3) {
 				printf("Got %s with %lu\n", str, tmp_KB);
 			}



More information about the Commits mailing list