Procházet zdrojové kódy

fix(system_monitor): Unify configuration with sysmon

k32 před 4 roky
rodič
revize
377ed03a20

+ 63 - 0
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()),

+ 0 - 62
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]),