ejabberd - Comments for "Getting current users number for a specific cluster node." https://www.ejabberd.im/node/4611 en You can apply this patch to https://www.ejabberd.im/node/4611#comment-57192 <p>You can apply this patch to ejabberd:</p> <pre>--- a/src/ejabberd_sm.erl +++ b/src/ejabberd_sm.erl @@ -50,6 +50,7 @@ force_update_presence/1, connected_users/0, connected_users_number/0, + connected_users_number_mine/0, user_resources/2, get_session_pid/3, get_user_info/3, @@ -745,6 +746,12 @@ commands() -&gt; module = ?MODULE, function = connected_users_number, args = [], result = {num_sessions, integer}}, + #ejabberd_commands{name = connected_users_number_mine, + tags = [session, stats], + desc = "Get the number of established sessions in this node", + module = ?MODULE, function = connected_users_number_mine, + args = [], + result = {num_sessions, integer}}, #ejabberd_commands{name = user_resources, tags = [session], desc = "List user's connected resources", @@ -761,6 +768,9 @@ connected_users() -&gt; connected_users_number() -&gt; length(dirty_get_sessions_list()). +connected_users_number_mine() -&gt; + length(dirty_get_my_sessions_list()). + user_resources(User, Server) -&gt; Resources = get_user_resources(User, Server), lists:sort(Resources). </pre><p> and then you can run:</p> <pre>$ ejabberdctl connected_users_number_mine 1 </pre> Sun, 27 Mar 2011 19:03:37 +0000 mfoss comment 57192 at https://www.ejabberd.im