mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Merge pull request #906 from hamano/stats_processes
add stats processes command
This commit is contained in:
commit
6ac839dd76
@ -490,7 +490,7 @@ commands() ->
|
||||
result = {res, rescode}},
|
||||
|
||||
#ejabberd_commands{name = stats, tags = [stats],
|
||||
desc = "Get statistical value: registeredusers onlineusers onlineusersnode uptimeseconds",
|
||||
desc = "Get statistical value: registeredusers onlineusers onlineusersnode uptimeseconds processes",
|
||||
policy = admin,
|
||||
module = ?MODULE, function = stats,
|
||||
args = [{name, binary}],
|
||||
@ -1364,6 +1364,7 @@ privacy_set(Username, Host, QueryS) ->
|
||||
stats(Name) ->
|
||||
case Name of
|
||||
<<"uptimeseconds">> -> trunc(element(1, erlang:statistics(wall_clock))/1000);
|
||||
<<"processes">> -> length(erlang:processes());
|
||||
<<"registeredusers">> -> lists:foldl(fun(Host, Sum) -> ejabberd_auth:get_vh_registered_users_number(Host) + Sum end, 0, ?MYHOSTS);
|
||||
<<"onlineusersnode">> -> length(ejabberd_sm:dirty_get_my_sessions_list());
|
||||
<<"onlineusers">> -> length(ejabberd_sm:dirty_get_sessions_list())
|
||||
|
Loading…
Reference in New Issue
Block a user