fix(emqx_os_mon): call load_ctl (lc) to get accurate memory stats
Prior to this commit, the RAM usage ratio reported by memsup is used to trigger EMQX alarm. This ratio counted system cache as 'used', so quite often a false alarm is triggered. With lc 0.3.0, the usage is caculated without cached RAM
This commit is contained in:
parent
eb592df275
commit
95f81126ca
|
@ -77,17 +77,11 @@ set_procmem_high_watermark(Float) ->
|
||||||
memsup:set_procmem_high_watermark(Float).
|
memsup:set_procmem_high_watermark(Float).
|
||||||
|
|
||||||
current_sysmem_percent() ->
|
current_sysmem_percent() ->
|
||||||
case erlang:whereis(memsup) of
|
case load_ctl:get_memory_usage() of
|
||||||
undefined ->
|
0 ->
|
||||||
undefined;
|
undefined;
|
||||||
_Pid ->
|
Ratio ->
|
||||||
{Total, Allocated, _Worst} = memsup:get_memory_data(),
|
erlang:floor(Ratio * 10000) / 100
|
||||||
case Total =/= 0 of
|
|
||||||
true ->
|
|
||||||
erlang:floor((Allocated / Total) * 10000) / 100;
|
|
||||||
false ->
|
|
||||||
undefined
|
|
||||||
end
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue