Merge pull request #7421 from JimMoen/fix-high-mem-alarm

fix(os_mon): fix wrongly high mem alarm
This commit is contained in:
zhongwencool 2022-03-25 19:33:00 +08:00 committed by GitHub
commit e3ea6c3217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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