mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Make s2s stats commands more robust
This commit is contained in:
parent
19ad6e6145
commit
4bf8ce7681
@ -473,28 +473,34 @@ send_element(Pid, El) ->
|
|||||||
%%% ejabberd commands
|
%%% ejabberd commands
|
||||||
|
|
||||||
get_commands_spec() ->
|
get_commands_spec() ->
|
||||||
[#ejabberd_commands{name = incoming_s2s_number,
|
[#ejabberd_commands{
|
||||||
|
name = incoming_s2s_number,
|
||||||
tags = [stats, s2s],
|
tags = [stats, s2s],
|
||||||
desc =
|
desc = "Number of incoming s2s connections on the node",
|
||||||
"Number of incoming s2s connections on "
|
|
||||||
"the node",
|
|
||||||
policy = admin,
|
policy = admin,
|
||||||
module = ?MODULE, function = incoming_s2s_number,
|
module = ?MODULE, function = incoming_s2s_number,
|
||||||
args = [], result = {s2s_incoming, integer}},
|
args = [], result = {s2s_incoming, integer}},
|
||||||
#ejabberd_commands{name = outgoing_s2s_number,
|
#ejabberd_commands{
|
||||||
|
name = outgoing_s2s_number,
|
||||||
tags = [stats, s2s],
|
tags = [stats, s2s],
|
||||||
desc =
|
desc = "Number of outgoing s2s connections on the node",
|
||||||
"Number of outgoing s2s connections on "
|
|
||||||
"the node",
|
|
||||||
policy = admin,
|
policy = admin,
|
||||||
module = ?MODULE, function = outgoing_s2s_number,
|
module = ?MODULE, function = outgoing_s2s_number,
|
||||||
args = [], result = {s2s_outgoing, integer}}].
|
args = [], result = {s2s_outgoing, integer}}].
|
||||||
|
|
||||||
|
%% TODO Move those stats commands to ejabberd stats command ?
|
||||||
incoming_s2s_number() ->
|
incoming_s2s_number() ->
|
||||||
length(supervisor:which_children(ejabberd_s2s_in_sup)).
|
supervisor_count(ejabberd_s2s_in_sup).
|
||||||
|
|
||||||
outgoing_s2s_number() ->
|
outgoing_s2s_number() ->
|
||||||
length(supervisor:which_children(ejabberd_s2s_out_sup)).
|
supervisor_count(ejabberd_s2s_out_sup).
|
||||||
|
|
||||||
|
supervisor_count(Supervisor) ->
|
||||||
|
case catch supervisor:which_children(Supervisor) of
|
||||||
|
{'EXIT', _} -> 0;
|
||||||
|
Result ->
|
||||||
|
length(Result)
|
||||||
|
end.
|
||||||
|
|
||||||
%%%----------------------------------------------------------------------
|
%%%----------------------------------------------------------------------
|
||||||
%%% Update Mnesia tables
|
%%% Update Mnesia tables
|
||||||
|
Loading…
Reference in New Issue
Block a user