6 Verify that 'ctdb disablemonitor' works correctly.
10 * An active CTDB cluster with at least 2 active nodes.
11 * 00_ctdb_install_eventscript.sh successfully installed its event
16 1. Verify that the status on all of the ctdb nodes is 'OK'.
17 2. Create a file called /tmp/ctdb-test-unhealthy-trigger.<node> on a
18 node and verify that the status of the node changes to unhealthy
19 within the interval indicated by the MonitorInterval variable.
20 3. Check that the file /tmp/ctdb-test-unhealthy-detected.<node> is
21 created, indicating that the event script is the reason the node
22 has been marked as unhealthy.
23 4. Now disable monitoring on the node using 'ctdb disablemonitor -n <node>.
24 5. Verify that the message 'Monitoring mode:DISABLED' is printed.
25 6. Remove /tmp/ctdb-test-unhealthy-detected.<node> and ensure that it
26 is not recreated within the interval indicated by the
27 MonitorInterval variable.
28 7. Remove /tmp/ctdb-test-unhealthy-trigger.<node>.
29 8. Verify that the status of the node continues to be 'UNHEALTHY',
30 since monitoring has been disabled.
34 * When monitoring is disabled, event scripts are not executed and the
35 state of nodes is not monitored.
39 . ctdb_test_functions.bash
45 onnode 0 $CTDB_TEST_WRAPPER cluster_is_healthy
49 # We need this for later, so we know how long to sleep.
50 try_command_on_node -v 0 ctdb getvar MonitorInterval -n $test_node
51 monitor_interval="${out#*= }"
52 echo "Monitor interval on node $test_node is $monitor_interval seconds."
54 trigger="/tmp/ctdb-test-unhealthy-trigger.${test_node}"
55 detected="/tmp/ctdb-test-unhealthy-detected.${test_node}"
57 recovered_flag="/tmp/ctdb-test-flag.recovered.${test_node}"
58 try_command_on_node $test_node touch "$recovered_flag"
60 ctdb_test_exit_hook="onnode $test_node rm -vf $trigger"
62 echo "Creating trigger file on node $test_node to make it unhealthy..."
63 try_command_on_node $test_node touch "$trigger"
65 onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status $test_node unhealthy $monitor_interval
67 try_command_on_node -v $test_node ls -l "$detected"
69 # Wait until recovery is complete before disabling monitoring,
70 # otherwise completion of the recover can turn monitoring back on!
71 echo "Waiting until recovery is complete..."
72 wait_until 30 onnode $test_node ! test -e "$recovered_flag"
74 try_command_on_node -v 0 ctdb disablemonitor -n $test_node
78 '^Monitoring mode:DISABLED$' \
81 onnode 0 $CTDB_TEST_WRAPPER wait_until_node_has_status $test_node monoff
83 try_command_on_node -v $test_node rm -v "$detected"
85 sleep_for $monitor_interval
87 try_command_on_node $test_node test ! -e "$detected"
89 echo "OK: flag file was not recreated so monitoring must be disabled."
91 echo "Removing trigger file. Monitoring is disabled so node will stay unhealthy."
93 try_command_on_node -v $test_node rm -v "$trigger"
95 sleep_for $monitor_interval
97 onnode 0 $CTDB_TEST_WRAPPER node_has_status $test_node unhealthy
99 echo "OK, that all worked. Expect a restart..."