فهرست منبع

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

zhongwencool 4 سال پیش
والد
کامیت
e2dec09b0d
4فایلهای تغییر یافته به همراه9 افزوده شده و 9 حذف شده
  1. 2 2
      apps/emqx_auth_mnesia/src/emqx_auth_mnesia.erl
  2. 3 3
      apps/emqx_auth_mnesia/src/emqx_auth_mnesia_cli.erl
  3. 3 3
      src/emqx_os_mon.erl
  4. 1 1
      src/emqx_vm_mon.erl

+ 2 - 2
apps/emqx_auth_mnesia/src/emqx_auth_mnesia.erl

@@ -42,11 +42,11 @@ init(#{clientid_list := ClientidList, username_list := UsernameList}) ->
             {attributes, record_info(fields, emqx_user)},
             {attributes, record_info(fields, emqx_user)},
             {storage_properties, [{ets, [{read_concurrency, true}]}]}]),
             {storage_properties, [{ets, [{read_concurrency, true}]}]}]),
     lists:foreach(fun({Clientid, Password}) ->
     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),
     end, ClientidList),
 
 
     lists:foreach(fun({Username, Password}) ->
     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),
     end, UsernameList),
 
 
     ok = ekka_mnesia:copy_table(?TABLE, disc_copies).
     ok = ekka_mnesia:copy_table(?TABLE, disc_copies).

+ 3 - 3
apps/emqx_auth_mnesia/src/emqx_auth_mnesia_cli.erl

@@ -78,14 +78,14 @@ add_default_user(Type, Key, Password) ->
                             username -> user
                             username -> user
                         end,
                         end,
                     ?LOG(warning,
                     ?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"
                         "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"
                         "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"
                         "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"
                         "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.",
                         "the new password in emqx_auth_mnesia.conf can take effect after reboot.",
-                        [Type, Key, TypeCtl, Key]),
+                        [Type, Key, Type, Key, TypeCtl, Key]),
                     ok
                     ok
             end;
             end;
         Error -> Error
         Error -> Error

+ 3 - 3
src/emqx_os_mon.erl

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

+ 1 - 1
src/emqx_vm_mon.erl

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