Просмотр исходного кода

Merge pull request #6923 from k32/sysmon3

feat(system_monitor): Bump version to 3.0.0
k32 4 лет назад
Родитель
Сommit
342eed9702
4 измененных файлов с 17 добавлено и 3 удалено
  1. 1 1
      apps/emqx/src/emqx_schema.erl
  2. 14 0
      apps/emqx_machine/src/emqx_machine.erl
  3. 1 1
      mix.exs
  4. 1 1
      rebar.config

+ 1 - 1
apps/emqx/src/emqx_schema.erl

@@ -1024,7 +1024,7 @@ fields("sysmon_top") ->
     , {"max_procs",
        sc(non_neg_integer(),
          #{ mapping => "system_monitor.top_max_procs"
-          , default => 3000000
+          , default => 1_000_000
           , desc => "Stop collecting data when the number of processes
 in the VM exceeds this value"
           })

+ 14 - 0
apps/emqx_machine/src/emqx_machine.erl

@@ -19,6 +19,9 @@
 -export([ start/0
         , graceful_shutdown/0
         , is_ready/0
+
+        , node_status/0
+        , update_vips/0
         ]).
 
 -include_lib("emqx/include/logger.hrl").
@@ -57,6 +60,9 @@ print_otp_version_warning() ->
 -endif. % OTP_RELEASE > 22
 
 start_sysmon() ->
+    _ = application:load(system_monitor),
+    application:set_env(system_monitor, node_status_fun, {?MODULE, node_status}),
+    application:set_env(system_monitor, status_checks, [{?MODULE, update_vips, false, 10}]),
     case application:get_env(system_monitor, db_hostname) of
         undefined ->
             %% If there is no sink for the events, there is no reason
@@ -67,3 +73,11 @@ start_sysmon() ->
             _ = application:ensure_all_started(system_monitor, temporary),
             ok
     end.
+
+node_status() ->
+    emqx_json:encode(#{ backend => mria_rlog:backend()
+                      , role    => mria_rlog:role()
+                      }).
+
+update_vips() ->
+    system_monitor:add_vip(mria_status:shards_up()).

+ 1 - 1
mix.exs

@@ -64,7 +64,7 @@ defmodule EMQXUmbrella.MixProject do
       {:emqtt, github: "emqx/emqtt", tag: "1.4.3", override: true},
       {:rulesql, github: "emqx/rulesql", tag: "0.1.4"},
       {:observer_cli, "1.7.1"},
-      {:system_monitor, github: "k32/system_monitor", tag: "2.2.1"},
+      {:system_monitor, github: "k32/system_monitor", tag: "3.0.0"},
       # in conflict by emqtt and hocon
       {:getopt, "1.0.2", override: true},
       {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.16.0", override: true},

+ 1 - 1
rebar.config

@@ -63,7 +63,7 @@
     , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.3"}}}
     , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.4"}}}
     , {observer_cli, "1.7.1"} % NOTE: depends on recon 2.5.x
-    , {system_monitor, {git, "https://github.com/k32/system_monitor", {tag, "2.2.1"}}}
+    , {system_monitor, {git, "https://github.com/k32/system_monitor", {tag, "3.0.0"}}}
     , {getopt, "1.0.2"}
     , {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.16.0"}}}
     , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.24.0"}}}