From bd2845d7ebe9e2970d4d5546e51c79c9b40ce9cb Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 24 Jul 2015 19:57:42 +1000 Subject: ctdb-scripts: Use MemAvailable if it is in /proc/meminfo Otherwise calculate, as before. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/config/events.d/05.system | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ctdb/config/events.d') diff --git a/ctdb/config/events.d/05.system b/ctdb/config/events.d/05.system index a089b18597f..4e5551e786a 100644 --- a/ctdb/config/events.d/05.system +++ b/ctdb/config/events.d/05.system @@ -72,6 +72,7 @@ monitor_memory_usage () _meminfo=$(get_proc "meminfo") set -- $(echo "$_meminfo" | awk ' +$1 == "MemAvailable:" { memavail += $2 / 1024 } $1 == "MemFree:" { memfree += $2 / 1024 } $1 == "Cached:" { memfree += $2 / 1024 } $1 == "Buffers:" { memfree += $2 / 1024 } @@ -79,6 +80,7 @@ $1 == "MemTotal:" { memtotal = $2 / 1024 } $1 == "SwapFree:" { swapfree = $2 / 1024 } $1 == "SwapTotal:" { swaptotal = $2 / 1024 } END { + if (memavail != 0) { memfree = memavail ; } print int(memfree), int(memtotal), int(swapfree) , int(swaptotal) }') _mem_free="$1" -- cgit v1.2.1