summaryrefslogtreecommitdiff
path: root/ctdb/config/events.d
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-07-24 19:57:42 +1000
committerAmitay Isaacs <amitay@samba.org>2015-08-29 17:06:25 +0200
commitbd2845d7ebe9e2970d4d5546e51c79c9b40ce9cb (patch)
treebe848db55c784a3140600065db99a9cc05d5d8fe /ctdb/config/events.d
parent99b8ef512162570504689b53adb14a52233f49b7 (diff)
downloadsamba-bd2845d7ebe9e2970d4d5546e51c79c9b40ce9cb.tar.gz
ctdb-scripts: Use MemAvailable if it is in /proc/meminfo
Otherwise calculate, as before. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/config/events.d')
-rw-r--r--ctdb/config/events.d/05.system2
1 files changed, 2 insertions, 0 deletions
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"