From 377ed03a207e55d49c4944d5434038d2f42892c3 Mon Sep 17 00:00:00 2001 From: k32 <10274441+k32@users.noreply.github.com> Date: Mon, 3 Jan 2022 12:01:59 +0100 Subject: [PATCH] fix(system_monitor): Unify configuration with sysmon --- apps/emqx/src/emqx_schema.erl | 63 +++++++++++++++++++++++++ apps/emqx_conf/src/emqx_conf_schema.erl | 62 ------------------------ 2 files changed, 63 insertions(+), 62 deletions(-) diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index ee1457eef..52b2af9a9 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -868,6 +868,10 @@ fields("sysmon") -> sc(ref("sysmon_os"), #{}) } + , {"top", + sc(ref("sysmon_top"), + #{}) + } ]; fields("sysmon_vm") -> @@ -941,6 +945,65 @@ fields("sysmon_os") -> } ]; +fields("sysmon_top") -> + [ {"num_items", + sc(non_neg_integer(), + #{ mapping => "system_monitor.top_num_items" + , default => 10 + , desc => "The number of top processes per monitoring group" + }) + } + , {"sample_interval", + sc(emqx_schema:duration(), + #{ mapping => "system_monitor.top_sample_interval" + , default => "2s" + , desc => "Specifies how often process top should be collected" + }) + } + , {"max_procs", + sc(non_neg_integer(), + #{ mapping => "system_monitor.top_max_procs" + , default => 3000000 + , desc => "Stop collecting data when the number of processes +in the VM exceeds this value" + }) + } + , {"db_hostname", + sc(string(), + #{ mapping => "system_monitor.db_hostname" + , desc => "Hostname of the postgres database that collects the data points" + }) + } + , {"db_port", + sc(integer(), + #{ mapping => "system_monitor.db_port" + , default => 5432 + , desc => "Port of the postgres database that collects the data points" + }) + } + , {"db_username", + sc(string(), + #{ mapping => "system_monitor.db_username" + , default => "system_monitor" + , desc => "EMQX user name in the postgres database" + }) + } + , {"db_password", + sc(binary(), + #{ mapping => "system_monitor.db_password" + , default => "system_monitor_password" + , desc => "EMQX user password in the postgres database" + }) + } + , {"db_name", + sc(string(), + #{ mapping => "system_monitor.db_name" + , default => "postgres" + , desc => "Postgres database name" + }) + } + ]; + fields("alarm") -> [ {"actions", sc(hoconsc:array(atom()), diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index 1ea368826..b38834391 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -98,10 +98,6 @@ roots() -> sc(ref("db"), #{ desc => "Settings of the embedded database." })} - , {"system_monitor", - sc(ref("system_monitor"), - #{ desc => "Erlang process and application monitoring." - })} ] ++ emqx_schema:roots(medium) ++ emqx_schema:roots(low) ++ @@ -322,64 +318,6 @@ a crash dump )} ]; -fields("system_monitor") -> - [ {"top_num_items", - sc(non_neg_integer(), - #{ mapping => "system_monitor.top_num_items" - , default => 10 - , desc => "The number of top processes per monitoring group" - }) - } - , {"top_sample_interval", - sc(emqx_schema:duration(), - #{ mapping => "system_monitor.top_sample_interval" - , default => "2s" - , desc => "Specifies how often process top should be collected" - }) - } - , {"top_max_procs", - sc(non_neg_integer(), - #{ mapping => "system_monitor.top_max_procs" - , default => 200000 - , desc => "Stop collecting data when the number of processes exceeds this value" - }) - } - , {"db_hostname", - sc(string(), - #{ mapping => "system_monitor.db_hostname" - , desc => "Hostname of the postgres database that collects the data points" - }) - } - , {"db_port", - sc(integer(), - #{ mapping => "system_monitor.db_port" - , default => 5432 - , desc => "Port of the postgres database that collects the data points" - }) - } - , {"db_username", - sc(string(), - #{ mapping => "system_monitor.db_username" - , default => "system_monitor" - , desc => "EMQX user name in the postgres database" - }) - } - , {"db_password", - sc(binary(), - #{ mapping => "system_monitor.db_password" - , default => "system_monitor_password" - , desc => "EMQX user password in the postgres database" - }) - } - , {"db_name", - sc(string(), - #{ mapping => "system_monitor.db_name" - , default => "postgres" - , desc => "Postgres database name" - }) - } - ]; - fields("db") -> [ {"backend", sc(hoconsc:enum([mnesia, rlog]),