fix(system_monitor): Unify configuration with sysmon

This commit is contained in:
k32 2022-01-03 12:01:59 +01:00
parent 3fc8d4049f
commit 377ed03a20
2 changed files with 63 additions and 62 deletions

View File

@ -868,6 +868,10 @@ fields("sysmon") ->
sc(ref("sysmon_os"), sc(ref("sysmon_os"),
#{}) #{})
} }
, {"top",
sc(ref("sysmon_top"),
#{})
}
]; ];
fields("sysmon_vm") -> 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") -> fields("alarm") ->
[ {"actions", [ {"actions",
sc(hoconsc:array(atom()), sc(hoconsc:array(atom()),

View File

@ -98,10 +98,6 @@ roots() ->
sc(ref("db"), sc(ref("db"),
#{ desc => "Settings of the embedded database." #{ 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(medium) ++
emqx_schema:roots(low) ++ 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") -> fields("db") ->
[ {"backend", [ {"backend",
sc(hoconsc:enum([mnesia, rlog]), sc(hoconsc:enum([mnesia, rlog]),