From 81243b43e8812cdef0041daacf93bbf7875d6120 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Fri, 25 Mar 2022 19:21:03 +0800 Subject: [PATCH] fix(os_mon): fix wrongly high mem alarm --- apps/emqx/src/emqx_os_mon.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/emqx/src/emqx_os_mon.erl b/apps/emqx/src/emqx_os_mon.erl index 4ceb0ad64..ad303d3e8 100644 --- a/apps/emqx/src/emqx_os_mon.erl +++ b/apps/emqx/src/emqx_os_mon.erl @@ -162,13 +162,14 @@ start_check_timer() -> %%The internal memsup will no longer trigger events that have been alerted, %% and there is no exported function to remove the alerted flag, %% so it can only be checked again at startup. + ensure_system_memory_alarm(HW) -> case erlang:whereis(memsup) of undefined -> ok; _Pid -> {Total, Allocated, _Worst} = memsup:get_memory_data(), - case Total =/= 0 andalso Allocated / Total * 100 > HW of + case Total =/= 0 andalso Allocated / Total > HW of true -> emqx_alarm:activate(high_system_memory_usage, #{high_watermark => HW}); false -> ok end