3 .
"${TEST_SCRIPTS_DIR}/unit.sh"
5 define_test
"Check throttling of warnings"
7 CTDB_MONITOR_MEMORY_USAGE
="70:80"
8 CTDB_MONITOR_SWAP_USAGE
=""
10 # Below threshold, nothing logged
16 ok
"WARNING: System memory utilization 71% >= threshold 70%"
19 # 2nd time at same level, nothing logged
25 ok
"WARNING: System memory utilization 73% >= threshold 70%"
28 # 2nd time at same level, nothing logged
34 ok
"WARNING: System memory utilization 79% >= threshold 70%"
38 required_result
1 <<EOF
39 ERROR: System memory utilization 80% >= threshold 80%
47 Active(anon): 1917580 kB
48 Inactive(anon): 523080 kB
49 Active(file): 504524 kB
50 Inactive(file): 496848 kB
56 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
57 root 2 0.0 0.0 0 0 ? S Aug28 0:00 [kthreadd]
58 root 3 0.0 0.0 0 0 ? S Aug28 0:43 \_ [ksoftirqd/0]
60 root 1 0.0 0.0 2976 624 ? Ss Aug28 0:07 init [2]
61 root 495 0.0 0.0 3888 1640 ? Ss Aug28 0:00 udevd --daemon
67 # Fall back into warning at same level as last warning... should log
69 ok
"WARNING: System memory utilization 79% >= threshold 70%"
72 # Below threshold, notice
75 NOTICE: System memory utilization 69% < threshold 70%
79 # Further reduction, nothing logged
84 # Back up into warning at same level as last warning... should log
86 ok
"WARNING: System memory utilization 79% >= threshold 70%"
89 # Back up above critical threshold... unhealthy
91 required_result
1 <<EOF
92 ERROR: System memory utilization 81% >= threshold 80%
100 Active(anon): 1917580 kB
101 Inactive(anon): 523080 kB
102 Active(file): 504524 kB
103 Inactive(file): 496848 kB
106 SwapTotal: 5857276 kB
109 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
110 root 2 0.0 0.0 0 0 ? S Aug28 0:00 [kthreadd]
111 root 3 0.0 0.0 0 0 ? S Aug28 0:43 \_ [ksoftirqd/0]
113 root 1 0.0 0.0 2976 624 ? Ss Aug28 0:07 init [2]
114 root 495 0.0 0.0 3888 1640 ? Ss Aug28 0:00 udevd --daemon
116 [MORE FAKE ps OUTPUT]
120 # Straight back down to a good level... notice
122 ok
"NOTICE: System memory utilization 65% < threshold 70%"