mod_statsdx: Call table_name/1 with 'server' atom
This commit is contained in:
parent
bc7bff10bd
commit
94c690661b
|
@ -110,7 +110,7 @@ loop(Hosts) ->
|
||||||
%% Si no existe una tabla de stats del server, crearla.
|
%% Si no existe una tabla de stats del server, crearla.
|
||||||
%% Deberia ser creada por un proceso que solo muera cuando se detenga el ultimo mod_statsdx del servidor
|
%% Deberia ser creada por un proceso que solo muera cuando se detenga el ultimo mod_statsdx del servidor
|
||||||
prepare_stats_server(CD) ->
|
prepare_stats_server(CD) ->
|
||||||
Table = table_name("server"),
|
Table = table_name(server),
|
||||||
ets:new(Table, [named_table, public]),
|
ets:new(Table, [named_table, public]),
|
||||||
ets:insert(Table, {{user_login, server}, CD}),
|
ets:insert(Table, {{user_login, server}, CD}),
|
||||||
ets:insert(Table, {{user_logout, server}, CD}),
|
ets:insert(Table, {{user_logout, server}, CD}),
|
||||||
|
@ -191,7 +191,7 @@ finish_stats() ->
|
||||||
ejabberd_hooks:delete(webadmin_menu_node, ?MODULE, web_menu_node, 50),
|
ejabberd_hooks:delete(webadmin_menu_node, ?MODULE, web_menu_node, 50),
|
||||||
ejabberd_hooks:delete(webadmin_page_main, ?MODULE, web_page_main, 50),
|
ejabberd_hooks:delete(webadmin_page_main, ?MODULE, web_page_main, 50),
|
||||||
ejabberd_hooks:delete(webadmin_page_node, ?MODULE, web_page_node, 50),
|
ejabberd_hooks:delete(webadmin_page_node, ?MODULE, web_page_node, 50),
|
||||||
Table = table_name("server"),
|
Table = table_name(server),
|
||||||
catch ets:delete(Table).
|
catch ets:delete(Table).
|
||||||
|
|
||||||
finish_stats(Host) ->
|
finish_stats(Host) ->
|
||||||
|
@ -214,13 +214,13 @@ finish_stats(Host) ->
|
||||||
|
|
||||||
register_user(_User, Host) ->
|
register_user(_User, Host) ->
|
||||||
TableHost = table_name(Host),
|
TableHost = table_name(Host),
|
||||||
TableServer = table_name("server"),
|
TableServer = table_name(server),
|
||||||
ets:update_counter(TableHost, {register_user, Host}, 1),
|
ets:update_counter(TableHost, {register_user, Host}, 1),
|
||||||
ets:update_counter(TableServer, {register_user, server}, 1).
|
ets:update_counter(TableServer, {register_user, server}, 1).
|
||||||
|
|
||||||
remove_user(_User, Host) ->
|
remove_user(_User, Host) ->
|
||||||
TableHost = table_name(Host),
|
TableHost = table_name(Host),
|
||||||
TableServer = table_name("server"),
|
TableServer = table_name(server),
|
||||||
ets:update_counter(TableHost, {remove_user, Host}, 1),
|
ets:update_counter(TableHost, {remove_user, Host}, 1),
|
||||||
ets:update_counter(TableServer, {remove_user, server}, 1).
|
ets:update_counter(TableServer, {remove_user, server}, 1).
|
||||||
|
|
||||||
|
@ -731,7 +731,7 @@ user_login(U) ->
|
||||||
User = U#jid.luser,
|
User = U#jid.luser,
|
||||||
Host = U#jid.lserver,
|
Host = U#jid.lserver,
|
||||||
Resource = U#jid.lresource,
|
Resource = U#jid.lresource,
|
||||||
ets:update_counter(table_name("server"), {user_login, server}, 1),
|
ets:update_counter(table_name(server), {user_login, server}, 1),
|
||||||
ets:update_counter(table_name(Host), {user_login, Host}, 1),
|
ets:update_counter(table_name(Host), {user_login, Host}, 1),
|
||||||
request_iqversion(User, Host, Resource).
|
request_iqversion(User, Host, Resource).
|
||||||
|
|
||||||
|
@ -742,7 +742,7 @@ user_logout_sm(_, JID, _Data) ->
|
||||||
%% cuando un usuario desconecta, buscar en la tabla su JID/USR y quitarlo
|
%% cuando un usuario desconecta, buscar en la tabla su JID/USR y quitarlo
|
||||||
user_logout(User, Host, Resource, _Status) ->
|
user_logout(User, Host, Resource, _Status) ->
|
||||||
TableHost = table_name(Host),
|
TableHost = table_name(Host),
|
||||||
TableServer = table_name("server"),
|
TableServer = table_name(server),
|
||||||
ets:update_counter(TableServer, {user_logout, server}, 1),
|
ets:update_counter(TableServer, {user_logout, server}, 1),
|
||||||
ets:update_counter(TableHost, {user_logout, Host}, 1),
|
ets:update_counter(TableHost, {user_logout, Host}, 1),
|
||||||
|
|
||||||
|
@ -796,7 +796,7 @@ received_response(From, {xmlel, <<"iq">>, Attrs, Elc}) ->
|
||||||
L -> binary_to_list(L)
|
L -> binary_to_list(L)
|
||||||
end,
|
end,
|
||||||
TableHost = table_name(Host),
|
TableHost = table_name(Host),
|
||||||
TableServer = table_name("server"),
|
TableServer = table_name(server),
|
||||||
update_counter_create(TableHost, {lang, Host, Lang}, 1),
|
update_counter_create(TableHost, {lang, Host, Lang}, 1),
|
||||||
update_counter_create(TableServer, {lang, server, Lang}, 1),
|
update_counter_create(TableServer, {lang, server, Lang}, 1),
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ received_response(From, {xmlel, <<"iq">>, Attrs, Elc}) ->
|
||||||
ConnType = get_connection_type(User, Host, Resource),
|
ConnType = get_connection_type(User, Host, Resource),
|
||||||
|
|
||||||
TableHost = table_name(Host),
|
TableHost = table_name(Host),
|
||||||
TableServer = table_name("server"),
|
TableServer = table_name(server),
|
||||||
ets:update_counter(TableHost, {client, Host, Client_id}, 1),
|
ets:update_counter(TableHost, {client, Host, Client_id}, 1),
|
||||||
ets:update_counter(TableServer, {client, server, Client_id}, 1),
|
ets:update_counter(TableServer, {client, server, Client_id}, 1),
|
||||||
ets:update_counter(TableHost, {os, Host, OS_id}, 1),
|
ets:update_counter(TableHost, {os, Host, OS_id}, 1),
|
||||||
|
|
Loading…
Reference in New Issue