Some updates to work a little more with ejaberd 13 binaryzation
This commit is contained in:
parent
f7c243ab4f
commit
09775d41db
|
@ -29,9 +29,12 @@
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("ejabberd_commands.hrl").
|
-include("ejabberd_commands.hrl").
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
|
-include("logger.hrl").
|
||||||
-include("mod_roster.hrl").
|
-include("mod_roster.hrl").
|
||||||
-include("web/ejabberd_http.hrl").
|
-include("ejabberd_http.hrl").
|
||||||
-include("web/ejabberd_web_admin.hrl").
|
-include("ejabberd_web_admin.hrl").
|
||||||
|
|
||||||
|
-define(XCTB(Name, Text), ?XCT(list_to_binary(Name), list_to_binary(Text))).
|
||||||
|
|
||||||
-define(PROCNAME, ejabberd_mod_statsdx).
|
-define(PROCNAME, ejabberd_mod_statsdx).
|
||||||
|
|
||||||
|
@ -42,7 +45,7 @@
|
||||||
%%%% Module control
|
%%%% Module control
|
||||||
|
|
||||||
start(Host, Opts) ->
|
start(Host, Opts) ->
|
||||||
Hooks = gen_mod:get_opt(hooks, Opts, false),
|
Hooks = gen_mod:get_opt(hooks, Opts, fun(O) -> is_atom(O) end, false),
|
||||||
%% Default value for the counters
|
%% Default value for the counters
|
||||||
CD = case Hooks of
|
CD = case Hooks of
|
||||||
true -> 0;
|
true -> 0;
|
||||||
|
@ -75,7 +78,9 @@ stop(Host) ->
|
||||||
%%%==================================
|
%%%==================================
|
||||||
%%%% Stats Server
|
%%%% Stats Server
|
||||||
|
|
||||||
table_name(server) -> gen_mod:get_module_proc("server", mod_statsdx);
|
%%% +++ TODO: why server and "server"
|
||||||
|
table_name(server) -> gen_mod:get_module_proc(<<"server">>, mod_statsdx);
|
||||||
|
table_name("server") -> gen_mod:get_module_proc(<<"server">>, mod_statsdx);
|
||||||
table_name(Host) -> gen_mod:get_module_proc(Host, mod_statsdx).
|
table_name(Host) -> gen_mod:get_module_proc(Host, mod_statsdx).
|
||||||
|
|
||||||
initialize_stats_server() ->
|
initialize_stats_server() ->
|
||||||
|
@ -831,7 +836,7 @@ update_counter_create(Table, Element, C) ->
|
||||||
get_tag_cdata_subtag(E, T) ->
|
get_tag_cdata_subtag(E, T) ->
|
||||||
E2 = xml:get_subtag(E, T),
|
E2 = xml:get_subtag(E, T),
|
||||||
case E2 of
|
case E2 of
|
||||||
false -> "unknown";
|
false -> <<"unknown">>;
|
||||||
_ -> xml:get_tag_cdata(E2)
|
_ -> xml:get_tag_cdata(E2)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -908,7 +913,7 @@ get_client_os(Server) ->
|
||||||
CO1 = ets:match(table_name(Server), {{client_os, Server, '$1', '$2'}, '$3'}),
|
CO1 = ets:match(table_name(Server), {{client_os, Server, '$1', '$2'}, '$3'}),
|
||||||
CO2 = lists:map(
|
CO2 = lists:map(
|
||||||
fun([Cl, Os, A3]) ->
|
fun([Cl, Os, A3]) ->
|
||||||
{lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)]), A3}
|
{list_to_binary(lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)])), A3}
|
||||||
end,
|
end,
|
||||||
CO1
|
CO1
|
||||||
),
|
),
|
||||||
|
@ -918,7 +923,7 @@ get_client_conntype(Server) ->
|
||||||
CO1 = ets:match(table_name(Server), {{client_conntype, Server, '$1', '$2'}, '$3'}),
|
CO1 = ets:match(table_name(Server), {{client_conntype, Server, '$1', '$2'}, '$3'}),
|
||||||
CO2 = lists:map(
|
CO2 = lists:map(
|
||||||
fun([Cl, Os, A3]) ->
|
fun([Cl, Os, A3]) ->
|
||||||
{lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)]), A3}
|
{list_to_binary(lists:flatten([atom_to_list(Cl), "/", atom_to_list(Os)])), A3}
|
||||||
end,
|
end,
|
||||||
CO1
|
CO1
|
||||||
),
|
),
|
||||||
|
@ -958,73 +963,73 @@ localtime_to_string({{Y, Mo, D},{H, Mi, S}}) ->
|
||||||
%%%% Web Admin Menu
|
%%%% Web Admin Menu
|
||||||
|
|
||||||
web_menu_main(Acc, Lang) ->
|
web_menu_main(Acc, Lang) ->
|
||||||
Acc ++ [{"statsdx", ?T("Statistics Dx")}].
|
Acc ++ [{<<"statsdx">>, ?T(<<"Statistics Dx">>)}].
|
||||||
|
|
||||||
web_menu_node(Acc, _Node, Lang) ->
|
web_menu_node(Acc, _Node, Lang) ->
|
||||||
Acc ++ [{"statsdx", ?T("Statistics Dx")}].
|
Acc ++ [{<<"statsdx">>, ?T(<<"Statistics Dx">>)}].
|
||||||
|
|
||||||
web_menu_host(Acc, _Host, Lang) ->
|
web_menu_host(Acc, _Host, Lang) ->
|
||||||
Acc ++ [{"statsdx", ?T("Statistics Dx")}].
|
Acc ++ [{<<"statsdx">>, ?T(<<"Statistics Dx">>)}].
|
||||||
|
|
||||||
%%%==================================
|
%%%==================================
|
||||||
%%%% Web Admin Page
|
%%%% Web Admin Page
|
||||||
|
|
||||||
web_page_main(_, #request{path=["statsdx"], lang = Lang} = _Request) ->
|
web_page_main(_, #request{path=[<<"statsdx">>], lang = Lang} = _Request) ->
|
||||||
Res = [?XC("h1", ?T("Statistics")++" Dx"),
|
Res = [?XC(<<"h1">>, <<(?T(<<"Statistics">>))/binary, " Dx">>),
|
||||||
?XC("h3", "Accounts"),
|
?XC(<<"h3">>, <<"Accounts">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "registeredusers")
|
do_stat(global, Lang, "registeredusers")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Roster"),
|
?XC(<<"h3">>, <<"Roster">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "totalrosteritems"),
|
do_stat(global, Lang, "totalrosteritems"),
|
||||||
do_stat(global, Lang, "meanitemsinroster"),
|
do_stat(global, Lang, "meanitemsinroster"),
|
||||||
?XE("tr",
|
?XE(<<"tr">>,
|
||||||
[?XE("td", [?CT("Top rosters")]),
|
[?XE(<<"td">>, [?CT(<<"Top rosters">>)]),
|
||||||
?XE("td", [
|
?XE(<<"td">>, [
|
||||||
?ACT("top/roster/30", "30"), ?C(", "),
|
?ACT(<<"top/roster/30">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT("top/roster/100", "100"), ?C(", "),
|
?ACT(<<"top/roster/100">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT("top/roster/500", "500") ])]
|
?ACT(<<"top/roster/500">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Users"),
|
?XC(<<"h3">>, <<"Users">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "onlineusers"),
|
do_stat(global, Lang, "onlineusers"),
|
||||||
do_stat(global, Lang, "offlinemsg"),
|
do_stat(global, Lang, "offlinemsg"),
|
||||||
?XE("tr",
|
?XE(<<"tr">>,
|
||||||
[?XE("td", [?CT("Top offline message queues") ]),
|
[?XE(<<"td">>, [?CT(<<"Top offline message queues">>) ]),
|
||||||
?XE("td", [
|
?XE(<<"td">>, [
|
||||||
?ACT("top/offlinemsg/30", "30"), ?C(", "),
|
?ACT(<<"top/offlinemsg/30">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT("top/offlinemsg/100", "100"), ?C(", "),
|
?ACT(<<"top/offlinemsg/100">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT("top/offlinemsg/500", "500") ])]
|
?ACT(<<"top/offlinemsg/500">>, <<"500">>) ])]
|
||||||
),
|
),
|
||||||
do_stat(global, Lang, "vcards"),
|
do_stat(global, Lang, "vcards"),
|
||||||
?XE("tr",
|
?XE(<<"tr">>,
|
||||||
[?XE("td", [?CT("Top vCard sizes") ]),
|
[?XE(<<"td">>, [?CT(<<"Top vCard sizes">>) ]),
|
||||||
?XE("td", [
|
?XE(<<"td">>, [
|
||||||
?ACT("top/vcard/5", "5"), ?C(", "),
|
?ACT(<<"top/vcard/5">>, <<"5">>), ?C(<<", ">>),
|
||||||
?ACT("top/vcard/30", "30"), ?C(", "),
|
?ACT(<<"top/vcard/30">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT("top/vcard/100", "100"), ?C(", "),
|
?ACT(<<"top/vcard/100">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT("top/vcard/500", "500") ])]
|
?ACT(<<"top/vcard/500">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "MUC"),
|
?XC(<<"h3">>, <<"MUC">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "totalmucrooms"),
|
do_stat(global, Lang, "totalmucrooms"),
|
||||||
do_stat(global, Lang, "permmucrooms"),
|
do_stat(global, Lang, "permmucrooms"),
|
||||||
do_stat(global, Lang, "regmucrooms")
|
do_stat(global, Lang, "regmucrooms")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Pub/Sub"),
|
?XC(<<"h3">>, <<"Pub/Sub">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "regpubsubnodes")
|
do_stat(global, Lang, "regpubsubnodes")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
|
@ -1039,87 +1044,90 @@ web_page_main(_, #request{path=["statsdx"], lang = Lang} = _Request) ->
|
||||||
%% [?XE("tbody", [
|
%% [?XE("tbody", [
|
||||||
%% ])
|
%% ])
|
||||||
%% ]),
|
%% ]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("client")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("client"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "client", server)
|
do_stat_table(global, Lang, "client", server)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("os")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("os"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "os", server)
|
do_stat_table(global, Lang, "os", server)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("client") ++ "/" ++ get_stat_n("os")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("client"))/binary, "/", (get_stat_n("os"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "client_os", server)
|
do_stat_table(global, Lang, "client_os", server)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("conntype")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("conntype"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "conntype", server)
|
do_stat_table(global, Lang, "conntype", server)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("client") ++ "/" ++ get_stat_n("conntype")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("client"))/binary, "/", (get_stat_n("conntype"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "client_conntype", server)
|
do_stat_table(global, Lang, "client_conntype", server)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("languages")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("languages"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "languages", server)
|
do_stat_table(global, Lang, "languages", server)
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
web_page_main(_, #request{path=["statsdx", "top", Topic, Topnumber], q = _Q, lang = Lang} = _Request) ->
|
web_page_main(_, #request{path=[<<"statsdx">>, <<"top">>, Topic, Topnumber], q = _Q, lang = Lang} = _Request) ->
|
||||||
Res = [?XC("h1", ?T("Statistics")++" Dx"),
|
Res = [?XC(<<"h1">>, <<(?T(<<"Statistics">>))/binary, " Dx">>),
|
||||||
case Topic of
|
case Topic of
|
||||||
"offlinemsg" -> ?XCT("h2", "Top offline message queues");
|
<<"offlinemsg">> -> ?XCT(<<"h2">>, <<"Top offline message queues">>);
|
||||||
"vcard" -> ?XCT("h2", "Top vCard sizes");
|
<<"vcard">> -> ?XCT(<<"h2">>, <<"Top vCard sizes">>);
|
||||||
"roster" -> ?XCT("h2", "Top rosters")
|
<<"roster">> -> ?XCT(<<"h2">>, <<"Top rosters">>)
|
||||||
end,
|
end,
|
||||||
?XE("table",
|
?XE(<<"table">>,
|
||||||
[?XE("thead", [?XE("tr",
|
[?XE(<<"thead">>, [?XE(<<"tr">>,
|
||||||
[?XE("td", [?CT("#")]),
|
[?XE(<<"td">>, [?CT(<<"#">>)]),
|
||||||
?XE("td", [?CT("Jabber ID")]),
|
?XE(<<"td">>, [?CT(<<"Jabber ID">>)]),
|
||||||
?XE("td", [?CT("Value")])]
|
?XE(<<"td">>, [?CT(<<"Value">>)])]
|
||||||
)]),
|
)]),
|
||||||
?XE("tbody", do_top_table(global, Lang, Topic, Topnumber, server))
|
?XE(<<"tbody">>, do_top_table(global, Lang, Topic, Topnumber, server))
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
web_page_main(_, #request{path=["statsdx" | FilterURL], q = Q, lang = Lang} = _Request) ->
|
web_page_main(_, #request{path=[<<"statsdx">> | FilterURL], q = Q, lang = Lang} = _Request) ->
|
||||||
Filter = parse_url_filter(FilterURL),
|
Filter = parse_url_filter(FilterURL),
|
||||||
Sort_query = get_sort_query(Q),
|
Sort_query = get_sort_query(Q),
|
||||||
Res = [?XC("h1", ?T("Statistics")++" Dx"),
|
FilterS = io_lib:format("~p", [Filter]),
|
||||||
?XC("h2", "Sessions with: "++ io_lib:format("~p", [Filter])),
|
Res = [?XC(<<"h1">>, list_to_binary(?T("Statistics") ++ " Dx222")),
|
||||||
?XE("table",
|
?XC(<<"h2">>, list_to_binary("Sessions with: " ++ FilterS)),
|
||||||
|
?XE(<<"table">>,
|
||||||
[
|
[
|
||||||
?XE("thead", [?XE("tr", make_sessions_table_tr(Lang) )]),
|
?XE(<<"thead">>, [?XE(<<"tr">>, make_sessions_table_tr(Lang) )]),
|
||||||
?XE("tbody", do_sessions_table(global, Lang, Filter, Sort_query, server))
|
?XE(<<"tbody">>, do_sessions_table(global, Lang, Filter, Sort_query, server))
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
web_page_main(Acc, _) -> Acc.
|
web_page_main(Acc, _) -> Acc.
|
||||||
|
|
||||||
do_top_table(_Node, Lang, Topic, TopnumberString, Host) ->
|
do_top_table(_Node, Lang, Topic, TopnumberBin, Host) ->
|
||||||
List = get_top_users(Host, list_to_integer(TopnumberString), Topic),
|
List = get_top_users(Host, list_to_integer(binary_to_list(TopnumberBin)), Topic),
|
||||||
%% get_top_users(Topnumber, "roster")
|
%% get_top_users(Topnumber, "roster")
|
||||||
{List2, _} = lists:mapfoldl(
|
{List2, _} = lists:mapfoldl(
|
||||||
fun({Value, User, Server}, Counter) ->
|
fun({Value, UserB, ServerB}, Counter) ->
|
||||||
|
User = binary_to_list(UserB),
|
||||||
|
Server = binary_to_list(ServerB),
|
||||||
UserJID = User++"@"++Server,
|
UserJID = User++"@"++Server,
|
||||||
UserJIDUrl = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
UserJIDUrl = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
||||||
ValueString = integer_to_list(Value),
|
ValueString = integer_to_list(Value),
|
||||||
ValueEl = case Topic of
|
ValueEl = case Topic of
|
||||||
"offlinemsg" -> {url, UserJIDUrl++"queue/", ValueString};
|
<<"offlinemsg">> -> {url, UserJIDUrl++"queue/", ValueString};
|
||||||
"vcard" -> {url, UserJIDUrl++"vcard/", ValueString};
|
<<"vcard">> -> {url, UserJIDUrl++"vcard/", ValueString};
|
||||||
"roster" -> {url, UserJIDUrl++"roster/", ValueString};
|
<<"roster">> -> {url, UserJIDUrl++"roster/", ValueString};
|
||||||
_ -> ValueString
|
_ -> ValueString
|
||||||
end,
|
end,
|
||||||
{do_table_element(Counter, Lang, UserJID, {fixed_url, UserJIDUrl}, ValueEl),
|
{do_table_element(Counter, Lang, UserJID, {fixed_url, UserJIDUrl}, ValueEl),
|
||||||
|
@ -1145,23 +1153,23 @@ get_sort_query2(Q) ->
|
||||||
false -> {ok, {reverse, abs(Integer)}}
|
false -> {ok, {reverse, abs(Integer)}}
|
||||||
end.
|
end.
|
||||||
make_sessions_table_tr(Lang) ->
|
make_sessions_table_tr(Lang) ->
|
||||||
Titles = ["Jabber ID",
|
Titles = [<<"Jabber ID">>,
|
||||||
"Client ID",
|
<<"Client ID">>,
|
||||||
"OS ID",
|
<<"OS ID">>,
|
||||||
"Lang",
|
<<"Lang">>,
|
||||||
"Connection",
|
<<"Connection">>,
|
||||||
"Client",
|
<<"Client">>,
|
||||||
"Version",
|
<<"Version">>,
|
||||||
"OS"],
|
<<"OS">>],
|
||||||
{Titles_TR, _} =
|
{Titles_TR, _} =
|
||||||
lists:mapfoldl(
|
lists:mapfoldl(
|
||||||
fun(Title, Num_column) ->
|
fun(Title, Num_column) ->
|
||||||
NCS = integer_to_list(Num_column),
|
NCS = list_to_binary(integer_to_list(Num_column)),
|
||||||
TD = ?XE("td", [?CT(Title),
|
TD = ?XE(<<"td">>, [?CT(Title),
|
||||||
?BR,
|
?BR,
|
||||||
?ACT("?sort="++NCS, "<"),
|
?ACT(<<"?sort=", NCS/binary>>, <<"<">>),
|
||||||
?C(" "),
|
?C(<<" ">>),
|
||||||
?ACT("?sort=-"++NCS, ">")]),
|
?ACT(<<"?sort=-", NCS/binary>>, <<">">>)]),
|
||||||
{TD, Num_column+1}
|
{TD, Num_column+1}
|
||||||
end,
|
end,
|
||||||
1,
|
1,
|
||||||
|
@ -1178,7 +1186,7 @@ parse_url_filter(_, Res) ->
|
||||||
Res.
|
Res.
|
||||||
|
|
||||||
|
|
||||||
web_page_node(_, Node, ["statsdx"], _Query, Lang) ->
|
web_page_node(_, Node, [<<"statsdx">>], _Query, Lang) ->
|
||||||
TransactionsCommited =
|
TransactionsCommited =
|
||||||
rpc:call(Node, mnesia, system_info, [transaction_commits]),
|
rpc:call(Node, mnesia, system_info, [transaction_commits]),
|
||||||
TransactionsAborted =
|
TransactionsAborted =
|
||||||
|
@ -1189,10 +1197,10 @@ web_page_node(_, Node, ["statsdx"], _Query, Lang) ->
|
||||||
rpc:call(Node, mnesia, system_info, [transaction_log_writes]),
|
rpc:call(Node, mnesia, system_info, [transaction_log_writes]),
|
||||||
|
|
||||||
Res =
|
Res =
|
||||||
[?XC("h1", io_lib:format(?T("~p statistics"), [Node])),
|
[?XC(<<"h1">>, list_to_binary(io_lib:format(?T("~p statistics"), [Node]))),
|
||||||
?XC("h3", "Connections"),
|
?XC(<<"h3">>, <<"Connections">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "onlineusers"),
|
do_stat(global, Lang, "onlineusers"),
|
||||||
do_stat(Node, Lang, "httppollusers"),
|
do_stat(Node, Lang, "httppollusers"),
|
||||||
do_stat(Node, Lang, "httpbindusers"),
|
do_stat(Node, Lang, "httpbindusers"),
|
||||||
|
@ -1200,15 +1208,15 @@ web_page_node(_, Node, ["statsdx"], _Query, Lang) ->
|
||||||
do_stat(Node, Lang, "s2sservers")
|
do_stat(Node, Lang, "s2sservers")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "ejabberd"),
|
?XC(<<"h3">>, <<"ejabberd">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(Node, Lang, "ejabberdversion")
|
do_stat(Node, Lang, "ejabberdversion")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Erlang"),
|
?XC(<<"h3">>, <<"Erlang">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(Node, Lang, "operatingsystem"),
|
do_stat(Node, Lang, "operatingsystem"),
|
||||||
do_stat(Node, Lang, "erlangmachine"),
|
do_stat(Node, Lang, "erlangmachine"),
|
||||||
do_stat(Node, Lang, "erlangmachinetarget"),
|
do_stat(Node, Lang, "erlangmachinetarget"),
|
||||||
|
@ -1217,18 +1225,18 @@ web_page_node(_, Node, ["statsdx"], _Query, Lang) ->
|
||||||
do_stat(Node, Lang, "totalerlproc")
|
do_stat(Node, Lang, "totalerlproc")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Times"),
|
?XC(<<"h3">>, <<"Times">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(Node, Lang, "uptime"),
|
do_stat(Node, Lang, "uptime"),
|
||||||
do_stat(Node, Lang, "uptimehuman"),
|
do_stat(Node, Lang, "uptimehuman"),
|
||||||
do_stat(Node, Lang, "lastrestart"),
|
do_stat(Node, Lang, "lastrestart"),
|
||||||
do_stat(Node, Lang, "cputime")
|
do_stat(Node, Lang, "cputime")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "CPU"),
|
?XC(<<"h3">>, <<"CPU">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(Node, Lang, "cpu_avg1"),
|
do_stat(Node, Lang, "cpu_avg1"),
|
||||||
do_stat(Node, Lang, "cpu_avg5"),
|
do_stat(Node, Lang, "cpu_avg5"),
|
||||||
do_stat(Node, Lang, "cpu_avg15"),
|
do_stat(Node, Lang, "cpu_avg15"),
|
||||||
|
@ -1248,9 +1256,9 @@ web_page_node(_, Node, ["statsdx"], _Query, Lang) ->
|
||||||
%% do_stat(Node, Lang, "reductions")
|
%% do_stat(Node, Lang, "reductions")
|
||||||
%%])
|
%%])
|
||||||
%%]),
|
%%]),
|
||||||
?XC("h3", "Memory (bytes)"),
|
?XC(<<"h3">>, <<"Memory (bytes)">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(Node, Lang, "memory_total"),
|
do_stat(Node, Lang, "memory_total"),
|
||||||
do_stat(Node, Lang, "memory_processes"),
|
do_stat(Node, Lang, "memory_processes"),
|
||||||
do_stat(Node, Lang, "memory_processes_used"),
|
do_stat(Node, Lang, "memory_processes_used"),
|
||||||
|
@ -1262,84 +1270,84 @@ web_page_node(_, Node, ["statsdx"], _Query, Lang) ->
|
||||||
do_stat(Node, Lang, "memory_ets")
|
do_stat(Node, Lang, "memory_ets")
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Database"),
|
?XC(<<"h3">>, <<"Database">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
[
|
[
|
||||||
?XE("tr", [?XCT("td", "Transactions commited"),
|
?XE(<<"tr">>, [?XCT(<<"td">>, <<"Transactions commited">>),
|
||||||
?XAC("td", [{"class", "alignright"}],
|
?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}],
|
||||||
integer_to_list(TransactionsCommited))]),
|
list_to_binary(integer_to_list(TransactionsCommited)))]),
|
||||||
?XE("tr", [?XCT("td", "Transactions aborted"),
|
?XE(<<"tr">>, [?XCT(<<"td">>, <<"Transactions aborted">>),
|
||||||
?XAC("td", [{"class", "alignright"}],
|
?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}],
|
||||||
integer_to_list(TransactionsAborted))]),
|
list_to_binary(integer_to_list(TransactionsAborted)))]),
|
||||||
?XE("tr", [?XCT("td", "Transactions restarted"),
|
?XE(<<"tr">>, [?XCT(<<"td">>, <<"Transactions restarted">>),
|
||||||
?XAC("td", [{"class", "alignright"}],
|
?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}],
|
||||||
integer_to_list(TransactionsRestarted))]),
|
list_to_binary(integer_to_list(TransactionsRestarted)))]),
|
||||||
?XE("tr", [?XCT("td", "Transactions logged"),
|
?XE(<<"tr">>, [?XCT(<<"td">>, <<"Transactions logged">>),
|
||||||
?XAC("td", [{"class", "alignright"}],
|
?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}],
|
||||||
integer_to_list(TransactionsLogged))])
|
list_to_binary(integer_to_list(TransactionsLogged)))])
|
||||||
])
|
])
|
||||||
])],
|
])],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
web_page_node(Acc, _, _, _, _) -> Acc.
|
web_page_node(Acc, _, _, _, _) -> Acc.
|
||||||
|
|
||||||
web_page_host(_, Host,
|
web_page_host(_, Host,
|
||||||
#request{path = ["statsdx"],
|
#request{path = [<<"statsdx">>],
|
||||||
lang = Lang} = _Request) ->
|
lang = Lang} = _Request) ->
|
||||||
Res = [?XC("h1", ?T("Statistics")++" Dx"),
|
Res = [?XC(<<"h1">>, <<(?T(<<"Statistics">>))/binary, " Dx">>),
|
||||||
?XC("h2", Host),
|
?XC(<<"h2">>, Host),
|
||||||
?XC("h3", "Accounts"),
|
?XC(<<"h3">>, <<"Accounts">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "registeredusers", Host)
|
do_stat(global, Lang, "registeredusers", Host)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Roster"),
|
?XC(<<"h3">>, <<"Roster">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "totalrosteritems", Host),
|
do_stat(global, Lang, "totalrosteritems", Host),
|
||||||
%%get_meanitemsinroster2(TotalRosterItems, RegisteredUsers)
|
%%get_meanitemsinroster2(TotalRosterItems, RegisteredUsers)
|
||||||
?XE("tr",
|
?XE(<<"tr">>,
|
||||||
[?XE("td", [?C("Top rosters") ]),
|
[?XE(<<"td">>, [?C(<<"Top rosters">>) ]),
|
||||||
?XE("td", [
|
?XE(<<"td">>, [
|
||||||
?ACT("top/roster/30", "30"), ?C(", "),
|
?ACT(<<"top/roster/30">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT("top/roster/100", "100"), ?C(", "),
|
?ACT(<<"top/roster/100">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT("top/roster/500", "500") ])]
|
?ACT(<<"top/roster/500">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Users"),
|
?XC(<<"h3">>, <<"Users">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "onlineusers", Host),
|
do_stat(global, Lang, "onlineusers", Host),
|
||||||
%%do_stat(global, Lang, "offlinemsg", Host), %% This make take a lot of time
|
%%do_stat(global, Lang, "offlinemsg", Host), %% This make take a lot of time
|
||||||
%%do_stat(global, Lang, "vcards", Host) %% This make take a lot of time
|
%%do_stat(global, Lang, "vcards", Host) %% This make take a lot of time
|
||||||
?XE("tr",
|
?XE(<<"tr">>,
|
||||||
[?XE("td", [?C("Top offline message queues")]),
|
[?XE(<<"td">>, [?C(<<"Top offline message queues">>)]),
|
||||||
?XE("td", [
|
?XE(<<"td">>, [
|
||||||
?ACT("top/offlinemsg/30", "30"), ?C(", "),
|
?ACT(<<"top/offlinemsg/30">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT("top/offlinemsg/100", "100"), ?C(", "),
|
?ACT(<<"top/offlinemsg/100">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT("top/offlinemsg/500", "500") ])]
|
?ACT(<<"top/offlinemsg/500">>, <<"500">>) ])]
|
||||||
),
|
),
|
||||||
?XE("tr",
|
?XE(<<"tr">>,
|
||||||
[?XE("td", [?C("Top vCard sizes") ]),
|
[?XE(<<"td">>, [?C(<<"Top vCard sizes">>) ]),
|
||||||
?XE("td", [
|
?XE(<<"td">>, [
|
||||||
?ACT("top/vcard/5", "5"), ?C(", "),
|
?ACT(<<"top/vcard/5">>, <<"5">>), ?C(<<", ">>),
|
||||||
?ACT("top/vcard/30", "30"), ?C(", "),
|
?ACT(<<"top/vcard/30">>, <<"30">>), ?C(<<", ">>),
|
||||||
?ACT("top/vcard/100", "100"), ?C(", "),
|
?ACT(<<"top/vcard/100">>, <<"100">>), ?C(<<", ">>),
|
||||||
?ACT("top/vcard/500", "500") ])]
|
?ACT(<<"top/vcard/500">>, <<"500">>) ])]
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Connections"),
|
?XC(<<"h3">>, <<"Connections">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "s2sconnections", Host)
|
do_stat(global, Lang, "s2sconnections", Host)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
?XC("h3", "MUC"),
|
?XC(<<"h3">>, <<"MUC">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "totalmucrooms", Host),
|
do_stat(global, Lang, "totalmucrooms", Host),
|
||||||
do_stat(global, Lang, "permmucrooms", Host),
|
do_stat(global, Lang, "permmucrooms", Host),
|
||||||
do_stat(global, Lang, "regmucrooms", Host)
|
do_stat(global, Lang, "regmucrooms", Host)
|
||||||
|
@ -1357,45 +1365,45 @@ web_page_host(_, Host,
|
||||||
%% do_stat(global, Lang, "regpubsubnodes", Host)
|
%% do_stat(global, Lang, "regpubsubnodes", Host)
|
||||||
%% ])
|
%% ])
|
||||||
%%]),
|
%%]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("client")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("client"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "client", Host)
|
do_stat_table(global, Lang, "client", Host)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("os")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("os"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "os", Host)
|
do_stat_table(global, Lang, "os", Host)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("client") ++ "/" ++ get_stat_n("os")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("client"))/binary, "/", (get_stat_n("os"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "client_os", Host)
|
do_stat_table(global, Lang, "client_os", Host)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("conntype")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("conntype"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "conntype", Host)
|
do_stat_table(global, Lang, "conntype", Host)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("client") ++ "/" ++ get_stat_n("conntype")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("client"))/binary, "/", (get_stat_n("conntype"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "client_conntype", Host)
|
do_stat_table(global, Lang, "client_conntype", Host)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Sessions: " ++ get_stat_n("languages")),
|
?XC(<<"h3">>, <<"Sessions: ", (get_stat_n("languages"))/binary>>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody",
|
[?XE(<<"tbody">>,
|
||||||
do_stat_table(global, Lang, "languages", Host)
|
do_stat_table(global, Lang, "languages", Host)
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
?XC("h3", "Ratios"),
|
?XC(<<"h3">>, <<"Ratios">>),
|
||||||
?XAE("table", [],
|
?XAE(<<"table">>, [],
|
||||||
[?XE("tbody", [
|
[?XE(<<"tbody">>, [
|
||||||
do_stat(global, Lang, "user_login", Host),
|
do_stat(global, Lang, "user_login", Host),
|
||||||
do_stat(global, Lang, "user_logout", Host),
|
do_stat(global, Lang, "user_logout", Host),
|
||||||
do_stat(global, Lang, "register_user", Host),
|
do_stat(global, Lang, "register_user", Host),
|
||||||
|
@ -1416,24 +1424,24 @@ web_page_host(_, Host,
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
web_page_host(_, Host, #request{path=["statsdx", "top", Topic, Topnumber], q = _Q, lang = Lang} = _Request) ->
|
web_page_host(_, Host, #request{path=[<<"statsdx">>, <<"top">>, Topic, Topnumber], q = _Q, lang = Lang} = _Request) ->
|
||||||
Res = [?XC("h1", ?T("Statistics")++" Dx"),
|
Res = [?XC("h1", ?T("Statistics")++" Dx"),
|
||||||
case Topic of
|
case Topic of
|
||||||
"offlinemsg" -> ?XCT("h2", "Top offline message queues");
|
<<"offlinemsg">> -> ?XCT(<<"h2">>, <<"Top offline message queues">>);
|
||||||
"vcard" -> ?XCT("h2", "Top vCard sizes");
|
<<"vcard">> -> ?XCT(<<"h2">>, <<"Top vCard sizes">>);
|
||||||
"roster" -> ?XCT("h2", "Top rosters")
|
<<"roster">> -> ?XCT(<<"h2">>, <<"Top rosters">>)
|
||||||
end,
|
end,
|
||||||
?XE("table",
|
?XE(<<"table">>,
|
||||||
[?XE("thead", [?XE("tr",
|
[?XE(<<"thead">>, [?XE(<<"tr">>,
|
||||||
[?XE("td", [?CT("#")]),
|
[?XE(<<"td">>, [?CT(<<"#">>)]),
|
||||||
?XE("td", [?CT("Jabber ID")]),
|
?XE(<<"td">>, [?CT(<<"Jabber ID">>)]),
|
||||||
?XE("td", [?CT("Value")])]
|
?XE(<<"td">>, [?CT(<<"Value">>)])]
|
||||||
)]),
|
)]),
|
||||||
?XE("tbody", do_top_table(global, Lang, Topic, Topnumber, Host))
|
?XE(<<"tbody">>, do_top_table(global, Lang, Topic, Topnumber, Host))
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
{stop, Res};
|
{stop, Res};
|
||||||
web_page_host(_, Host, #request{path=["statsdx" | FilterURL], q = Q,
|
web_page_host(_, Host, #request{path=[<<"statsdx">> | FilterURL], q = Q,
|
||||||
lang = Lang} = _Request) ->
|
lang = Lang} = _Request) ->
|
||||||
Filter = parse_url_filter(FilterURL),
|
Filter = parse_url_filter(FilterURL),
|
||||||
Sort_query = get_sort_query(Q),
|
Sort_query = get_sort_query(Q),
|
||||||
|
@ -1455,19 +1463,20 @@ web_page_host(Acc, _, _) -> Acc.
|
||||||
do_table_element(Lang, L, StatLink, N) ->
|
do_table_element(Lang, L, StatLink, N) ->
|
||||||
do_table_element(no_counter, Lang, L, StatLink, N).
|
do_table_element(no_counter, Lang, L, StatLink, N).
|
||||||
do_table_element(Counter, Lang, L, StatLink, N) ->
|
do_table_element(Counter, Lang, L, StatLink, N) ->
|
||||||
?XE("tr", [
|
?XE(<<"tr">>, [
|
||||||
case Counter of
|
case Counter of
|
||||||
no_counter -> ?C("");
|
no_counter -> ?C(<<"">>);
|
||||||
_ -> ?XE("td", [?C(integer_to_list(Counter))])
|
_ -> ?XE(<<"td">>, [?C(integer_to_list(Counter))])
|
||||||
end,
|
end,
|
||||||
case StatLink of
|
case StatLink of
|
||||||
no_link -> ?XCT("td", L);
|
no_link -> ?XCT(<<"td">>, L);
|
||||||
{fixed_url, Fixedurl} -> ?XE("td", [?AC(Fixedurl, L)]);
|
{fixed_url, Fixedurl} -> ?XE(<<"td">>, [?AC(Fixedurl, L)]);
|
||||||
_ -> ?XE("td", [?AC(make_url(StatLink, L), L)])
|
_ -> ?XE(<<"td">>, [?AC(list_to_binary(make_url(StatLink, L)), list_to_binary(L))])
|
||||||
end,
|
end,
|
||||||
case N of
|
case N of
|
||||||
{url, NUrl, NName} -> ?XAE("td", [{"class", "alignright"}], [?AC(NUrl, NName)]);
|
{url, NUrl, NName} -> ?XAE(<<"td">>, [{<<"class">>, <<"alignright">>}], [?AC(NUrl, NName)]);
|
||||||
_ -> ?XAC("td", [{"class", "alignright"}], N)
|
N when is_list(N) -> ?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}], list_to_binary(N));
|
||||||
|
_ -> ?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}], N)
|
||||||
end
|
end
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
@ -1499,14 +1508,14 @@ do_sessions_table(_Node, _Lang, Filter, {Sort_direction, Sort_column}, Host) ->
|
||||||
Server = JID#jid.lserver,
|
Server = JID#jid.lserver,
|
||||||
UserURL = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
UserURL = "/admin/server/" ++ Server ++ "/user/" ++ User ++ "/",
|
||||||
?XE("tr", [
|
?XE("tr", [
|
||||||
?XE("td", [?AC(UserURL, jlib:jid_to_string(JID))]),
|
?XE(<<"td">>, [?AC(UserURL, jlib:jid_to_string(JID))]),
|
||||||
?XCT("td", atom_to_list(Client_id)),
|
?XCTB("td", atom_to_list(Client_id)),
|
||||||
?XCT("td", atom_to_list(OS_id)),
|
?XCTB("td", atom_to_list(OS_id)),
|
||||||
?XCT("td", Lang),
|
?XCTB("td", Lang),
|
||||||
?XCT("td", atom_to_list(ConnType)),
|
?XCTB("td", atom_to_list(ConnType)),
|
||||||
?XCT("td", Client),
|
?XCTB("td", Client),
|
||||||
?XCT("td", Version),
|
?XCTB("td", Version),
|
||||||
?XCT("td", OS)
|
?XCTB("td", OS)
|
||||||
])
|
])
|
||||||
end,
|
end,
|
||||||
SessionsSorted
|
SessionsSorted
|
||||||
|
@ -1544,9 +1553,9 @@ get_sessions_filtered(Filter, Host) ->
|
||||||
ets:match_object(table_name(Host), Match).
|
ets:match_object(table_name(Host), Match).
|
||||||
|
|
||||||
do_stat(Node, Lang, Stat) ->
|
do_stat(Node, Lang, Stat) ->
|
||||||
?XE("tr", [
|
?XE(<<"tr">>, [
|
||||||
?XCT("td", get_stat_n(Stat)),
|
?XCT(<<"td">>, get_stat_n(Stat)),
|
||||||
?XAC("td", [{"class", "alignright"}],
|
?XAC(<<"td">>, [{<<"class">>, <<"alignright">>}],
|
||||||
get_stat_v(Node, [Stat]))]).
|
get_stat_v(Node, [Stat]))]).
|
||||||
|
|
||||||
do_stat(Node, Lang, Stat, Host) ->
|
do_stat(Node, Lang, Stat, Host) ->
|
||||||
|
@ -1556,9 +1565,9 @@ do_stat(Node, Lang, Stat, Host) ->
|
||||||
|
|
||||||
%% Get a stat name
|
%% Get a stat name
|
||||||
get_stat_n(Stat) ->
|
get_stat_n(Stat) ->
|
||||||
mod_statsdx:get_statistic(foo, [Stat, title]).
|
list_to_binary(mod_statsdx:get_statistic(foo, [Stat, title])).
|
||||||
%% Get a stat value
|
%% Get a stat value
|
||||||
get_stat_v(Node, Stat) -> get_stat_v2(mod_statsdx:get_statistic(Node, Stat)).
|
get_stat_v(Node, Stat) -> list_to_binary(get_stat_v2(mod_statsdx:get_statistic(Node, Stat))).
|
||||||
get_stat_v2(Value) when is_list(Value) -> Value;
|
get_stat_v2(Value) when is_list(Value) -> Value;
|
||||||
get_stat_v2(Value) when is_float(Value) -> io_lib:format("~.4f", [Value]);
|
get_stat_v2(Value) when is_float(Value) -> io_lib:format("~.4f", [Value]);
|
||||||
get_stat_v2(Value) when is_integer(Value) ->
|
get_stat_v2(Value) when is_integer(Value) ->
|
||||||
|
@ -1616,11 +1625,11 @@ get_top_users(Number, Topic) ->
|
||||||
get_top_users(server, Number, Topic).
|
get_top_users(server, Number, Topic).
|
||||||
|
|
||||||
%% Returns: [{Integer, User, Server}]
|
%% Returns: [{Integer, User, Server}]
|
||||||
get_top_users(Host, Number, "vcard") ->
|
get_top_users(Host, Number, <<"vcard">>) ->
|
||||||
get_top_users_vcard(Host, Number);
|
get_top_users_vcard(Host, Number);
|
||||||
get_top_users(Host, Number, "offlinemsg") ->
|
get_top_users(Host, Number, <<"offlinemsg">>) ->
|
||||||
get_top_users(Host, Number, offline_msg, #offline_msg.us);
|
get_top_users(Host, Number, offline_msg, #offline_msg.us);
|
||||||
get_top_users(Host, Number, "roster") ->
|
get_top_users(Host, Number, <<"roster">>) ->
|
||||||
get_top_users(Host, Number, roster, #roster.us).
|
get_top_users(Host, Number, roster, #roster.us).
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue