Add a variable CTDB_CHECK_SWAP_IS_NOT_USED="yes"
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 11 Feb 2010 00:32:22 +0000 (11:32 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 11 Feb 2010 00:32:22 +0000 (11:32 +1100)
to control whether or not to check if we are swapping, and produce
useful output into the logfile if we are.

For production systems with dedicated nas-heads we should never swap.
But for developer/test systems we often use smaller nondedicated systems where
we can no longer guarantee that we will not be using swap.

config/events.d/00.ctdb

index a576ce499c48bfee43ce3caf06c1a93d951db2bf..9a9f3ef6be8761805039209c4873276fbea2ee9f 100755 (executable)
@@ -30,11 +30,13 @@ 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
+       [ "$CTDB_CHECK_SWAP_IS_NOT_USED" = "yes" ] && {
+           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" ] || {