From ab17312ed805cb59a0967bbddf1258aa2bf21663 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sun, 23 Dec 2007 16:21:23 +1300 Subject: [PATCH] Support the output of top on Linux. --- src/lib/Spong/Client/plugins/check_memory | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/Spong/Client/plugins/check_memory b/src/lib/Spong/Client/plugins/check_memory index 97a43c8..050aedf 100755 --- a/src/lib/Spong/Client/plugins/check_memory +++ b/src/lib/Spong/Client/plugins/check_memory @@ -77,13 +77,13 @@ sub check_memory_top { $message .= $_; if (/^Mem/) { # top from the procps on Linux has this format: - if (/^Mem:$kmb av,$kmb used,$kmb free,$kmb shrd,$kmb buff/) { - ($memtotal,$memused,$memfree,$shared,$buffers) = ($1,$2,$3,$4,$5); + if (/^Mem:$kmb (av|total),$kmb used,$kmb free,($kmb shrd,)?$kmb buff/i) { + ($memtotal,$memused,$memfree,$shared,$buffers) = ($1,$3,$4,$7,$8); &to_KB($memtotal,$memused,$memfree,$shared,$buffers); $_ = ; $message .= $_; - if (/^Swap:$kmb av,$kmb used,$kmb free$kmb cached/) { - ($swaptotal, $swapused, $swapfree, $cached) = ($1,$2,$3,$4); + if (/^Swap:$kmb (av|total),$kmb used,$kmb free,*$kmb cached/i) { + ($swaptotal, $swapused, $swapfree, $cached) = ($1,$3,$4,$5); &to_KB($swaptotal, $swapused, $swapfree, $cached); } else { close CMD; -- 2.30.2