From f699de97731da1bb994a5fb7f517fa1c8f5a97d5 Mon Sep 17 00:00:00 2001 From: k32 <10274441+k32@users.noreply.github.com> Date: Sun, 6 Feb 2022 16:15:20 +0100 Subject: [PATCH] feat(system_monitor): Bump version to 3.0.0 --- apps/emqx/src/emqx_schema.erl | 2 +- apps/emqx_machine/src/emqx_machine.erl | 14 ++++++++++++++ mix.exs | 2 +- rebar.config | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index 9609f4edc..ceb84532b 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/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" }) diff --git a/apps/emqx_machine/src/emqx_machine.erl b/apps/emqx_machine/src/emqx_machine.erl index 8cc5797c4..9946a4195 100644 --- a/apps/emqx_machine/src/emqx_machine.erl +++ b/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()). diff --git a/mix.exs b/mix.exs index c0cb780a7..dba14223d 100644 --- a/mix.exs +++ b/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}, diff --git a/rebar.config b/rebar.config index 2c89e443d..28c9707fb 100644 --- a/rebar.config +++ b/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"}}}