summaryrefslogtreecommitdiffstats
path: root/ctdb/config/events.d
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-02-09 12:46:35 +1030
committerRusty Russell <rusty@rustcorp.com.au>2010-02-09 12:46:35 +1030
commit34b8b98078b9d956bb6560f0004b9f4b64af59d7 (patch)
treee56e7b511b18542ff2be5ec5c12e00e722ca5721 /ctdb/config/events.d
parent2406733ed2490fa2b1b2c57c155fae975c6e243e (diff)
downloadsamba-34b8b98078b9d956bb6560f0004b9f4b64af59d7.tar.gz
samba-34b8b98078b9d956bb6560f0004b9f4b64af59d7.tar.xz
samba-34b8b98078b9d956bb6560f0004b9f4b64af59d7.zip
event scripts: add logging for low memory conditions
We should never enter swap; if we do, show the memory state of the machine and the process list. This will help us diagnose what caused the condition before it's too late and the box starts OOM-killing processes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 627a6d67a0e9e61f8713e62695b3518c51909230)
Diffstat (limited to 'ctdb/config/events.d')
-rwxr-xr-xctdb/config/events.d/00.ctdb10
1 files changed, 10 insertions, 0 deletions
diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb
index 1d4c1459a8..ed8f9f2126 100755
--- a/ctdb/config/events.d/00.ctdb
+++ b/ctdb/config/events.d/00.ctdb
@@ -29,11 +29,21 @@ case "$1" in
;;
monitor)
+ # We should never enter swap, so SwapTotal == SwapFree.
+ if [ -n "`grep '^Swap\(Total\|Free\)' /proc/meminfo | uniq -s 10 -u`" ]; then
+ echo We are swapping:
+ cat /proc/meminfo
+ ps auxfww
+ fi
+
# monitor that we are not running out of memory
[ -z "$CTDB_MONITOR_FREE_MEMORY" ] || {
FREE_MEM=`free -m | grep "buffers/cache" | while read A B C D ;do /bin/echo -n $D ; done`
[ `expr "$FREE_MEM" "<" "$CTDB_MONITOR_FREE_MEMORY"` != "0" ] && {
echo "OOM. Free:$FREE_MEM while CTDB treshold is $CTDB_MONITOR_FREE_MEMORY"
+ cat /proc/meminfo
+ ps auxfww
+ echo m > /proc/sysrq-trigger
ctdb disable
sleep 3
ctdb shutdown