1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Add a setting where CTDB will monitor and warn for low memory conditions.

CTDB_MONITOR_FREE_MEMORY_WARN

BZ 59747

(This used to be ctdb commit 83446b2e7e28e3ed6627c1950053018b8799984a)
This commit is contained in:
Ronnie Sahlberg 2010-04-23 08:52:09 +10:00
parent 8ef5db522a
commit 2d9fee4f85
2 changed files with 18 additions and 5 deletions

View File

@ -112,14 +112,19 @@ CTDB_RECOVERY_LOCK="/some/place/on/shared/storage"
# defaults to tcp
# CTDB_TRANSPORT="tcp"
# When set, this variable makes ctdb monitor the amount of free memory
# in the system (the second number in the buffers/cache output from free -m).
# If the amount of free memory drops below this treshold the node will become
# unhealthy and ctdb and all managed services will be shutdown.
# These setting allow monitoring for low/out-out of memory conditions.
#
# If set, once available memory drops below CTDB_MONITOR_FREE_MEMORY_WARN
# ctdb will start logging messages that memory is low, but will not
# take any further action.
#
# If the amount of free memory drops below CTDB_MONITOR_FREE_MEMORY
# ctdb will fail all service over to a different node and finally shutdown.
# Once this occurs, the administrator needs to find the reason for the OOM
# situation, rectify it and restart ctdb with "service ctdb start"
# The unit is MByte
# CTDB_MONITOR_FREE_MEMORY=100
# CTDB_MONITOR_FREE_MEMORY_WARN=100
# CTDB_MONITOR_FREE_MEMORY=10
# When set to yes, the CTDB node will start in DISABLED mode and not host
# any public ip addresses. The administrator needs to explicitely enable

View File

@ -44,6 +44,14 @@ case "$1" in
fi
}
# warn when we get low on memory
[ -z "$CTDB_MONITOR_FREE_MEMORY_WARN" ] || {
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_WARN"` != "0" ] && {
echo "Running low on memory. Free:$FREE_MEM while CTDB treshold is $CTDB_MONITOR_FREE_MEMORY_WARN"
}
}
# 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`