fix(alarm): watermark replace >= =< with > <

This commit is contained in:
zhongwencool 2022-01-27 11:59:48 +08:00
parent 4cdd529b5a
commit e2dec09b0d
4 changed files with 9 additions and 9 deletions

View File

@ -42,11 +42,11 @@ init(#{clientid_list := ClientidList, username_list := UsernameList}) ->
{attributes, record_info(fields, emqx_user)},
{storage_properties, [{ets, [{read_concurrency, true}]}]}]),
lists:foreach(fun({Clientid, Password}) ->
emqx_auth_mnesia_cli:add_default_user(clientid, iolist_to_binary(Clientid), iolist_to_binary(Password))
emqx_auth_mnesia_cli:add_default_user(clientid, iolist_to_binary(Clientid), iolist_to_binary(Password))
end, ClientidList),
lists:foreach(fun({Username, Password}) ->
emqx_auth_mnesia_cli:add_default_user(username, iolist_to_binary(Username), iolist_to_binary(Password))
emqx_auth_mnesia_cli:add_default_user(username, iolist_to_binary(Username), iolist_to_binary(Password))
end, UsernameList),
ok = ekka_mnesia:copy_table(?TABLE, disc_copies).

View File

@ -78,14 +78,14 @@ add_default_user(Type, Key, Password) ->
username -> user
end,
?LOG(warning,
"[Auth Mnesia] auth.client.x.~p=~s's password in the emqx_auth_mnesia.conf\n"
"[Auth Mnesia] auth.client.x.~p=~s password in the emqx_auth_mnesia.conf\n"
"does not match the password in the database(mnesia).\n"
"1. If you have already changed the password via the HTTP API, this warning has no effect.\n"
"You can remove the warning from emqx_auth_mnesia.conf to resolve the warning.\n"
"You can remove the `auth.client.x.~p=~s` from emqx_auth_mnesia.conf to resolve this warning.\n"
"2. If you just want to update the password by manually changing the configuration file,\n"
"you need to delete the old user and password using `emqx_ctl ~p delete ~s` first\n"
"the new password in emqx_auth_mnesia.conf can take effect after reboot.",
[Type, Key, TypeCtl, Key]),
[Type, Key, Type, Key, TypeCtl, Key]),
ok
end;
Error -> Error

View File

@ -147,12 +147,12 @@ handle_info({timeout, Timer, check}, State = #{timer := Timer,
case emqx_vm:cpu_util() of %% TODO: should be improved?
0 ->
State#{timer := undefined};
Busy when Busy >= CPUHighWatermark ->
Busy when Busy > CPUHighWatermark ->
emqx_alarm:activate(high_cpu_usage, #{usage => Busy,
high_watermark => CPUHighWatermark,
low_watermark => CPULowWatermark}),
ensure_check_timer(State);
Busy when Busy =< CPULowWatermark ->
Busy when Busy < CPULowWatermark ->
emqx_alarm:deactivate(high_cpu_usage),
ensure_check_timer(State);
_Busy ->
@ -191,7 +191,7 @@ ensure_system_memory_alarm(HW) ->
undefined -> ok;
_Pid ->
{Allocated, Total, _Worst} = memsup:get_memory_data(),
case Total =/= 0 andalso Allocated/Total * 100 >= HW of
case Total =/= 0 andalso Allocated/Total * 100 > HW of
true -> emqx_alarm:activate(high_system_memory_usage, #{high_watermark => HW});
false -> ok
end

View File

@ -112,7 +112,7 @@ handle_info({timeout, Timer, check},
process_low_watermark := ProcLowWatermark}) ->
ProcessCount = erlang:system_info(process_count),
case ProcessCount / erlang:system_info(process_limit) * 100 of
Percent when Percent >= ProcHighWatermark ->
Percent when Percent > ProcHighWatermark ->
emqx_alarm:activate(too_many_processes, #{usage => Percent,
high_watermark => ProcHighWatermark,
low_watermark => ProcLowWatermark});