Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 99439 Details for
Bug 137724
mod_proxy and mod_statsdx patches for ejabberd 1.1.2
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
ejabberd-1.1.2-statsdx-web.patch
ejabberd-1.1.2-statsdx-web.patch (text/plain), 9.07 KB, created by
Nikolaus Polak
on 2006-10-12 07:21:33 UTC
(
hide
)
Description:
ejabberd-1.1.2-statsdx-web.patch
Filename:
MIME Type:
Creator:
Nikolaus Polak
Created:
2006-10-12 07:21:33 UTC
Size:
9.07 KB
patch
obsolete
>--- ejabberd-1.1.2/src/web/ejabberd_web_admin.erl 2006-04-03 16:14:35.000000000 +0200 >+++ ejabberd-1.1.2-r1/src/web/ejabberd_web_admin.erl 2006-06-23 09:32:54.000000000 +0200 >@@ -905,7 +905,10 @@ > path = ["stats"], > q = Query, > lang = Lang} = Request) -> >- Res = get_stats(Host, Lang), >+ Res = case whereis(ejabberd_mod_statsdx) of >+ undefined -> get_stats(Host, Lang); >+ _ -> get_statsdx(Host, Lang) >+ end, > make_xhtml([?XCT("h1", "Statistics")] ++ Res, Host, Lang); > > process_admin(Host, >@@ -1397,6 +1400,165 @@ > ])]. > > >+get_statsdx(global, Lang) -> >+ [ >+ ?XC("h3", "Accounts"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "registeredusers") >+ ]) >+ ]), >+ ?XC("h3", "Roster"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "totalrosteritems"), >+ do_stat(global, Lang, "meanitemsinroster") >+ ]) >+ ]), >+ ?XC("h3", "Users"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "authusers"), >+ do_stat(global, Lang, "onlineusers"), >+ do_stat(global, Lang, "offlinemsg"), >+ do_stat(global, Lang, "vcards") >+ ]) >+ ]), >+ ?XC("h3", "MUC"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "totalmucrooms"), >+ do_stat(global, Lang, "permmucrooms"), >+ do_stat(global, Lang, "regmucrooms") >+ ]) >+ ]), >+ ?XC("h3", "Pub/Sub"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "regpubsubnodes") >+ ]) >+ ]), >+ ?XC("h3", "IRC"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "ircconns") >+ ]) >+ ]), >+ ?XC("h3", "Ratios"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ ]) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("client")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "client", server) >+ ) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("os")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "os", server) >+ ) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("client") ++ "/" ++ get_stat_n("os")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "client_os", server) >+ ) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("languages")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "languages", server) >+ ) >+ ]) >+ ]; >+ >+get_statsdx(Host, Lang) -> >+ [ >+ ?XC("h2", Host), >+ ?XC("h3", "Accounts"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "registeredusers", Host) >+ ]) >+ ]), >+ ?XC("h3", "Roster"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "totalrosteritems", Host), >+ do_stat(global, Lang, "meanitemsinroster", Host) >+ ]) >+ ]), >+ ?XC("h3", "Users"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "authusers", Host), >+ do_stat(global, Lang, "onlineusers", Host), >+ do_stat(global, Lang, "offlinemsg", Host), >+ do_stat(global, Lang, "vcards", Host) >+ ]) >+ ]), >+ ?XC("h3", "Connections"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "s2sconnections", Host) >+ ]) >+ ]), >+ ?XC("h3", "MUC"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "totalmucrooms", Host), >+ do_stat(global, Lang, "permmucrooms", Host), >+ do_stat(global, Lang, "regmucrooms", Host) >+ ]) >+ ]), >+ ?XC("h3", "IRC"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "ircconns", Host) >+ ]) >+ ]), >+ %?XC("h3", "Pub/Sub"), >+ %?XAE("table", [], >+ % [?XE("tbody", [ >+ % do_stat(global, Lang, "regpubsubnodes", Host) >+ % ]) >+ %]), >+ ?XC("h3", "Ratios"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ ]) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("client")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "client", Host) >+ ) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("os")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "os", Host) >+ ) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("client") ++ "/" ++ get_stat_n("os")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "client_os", Host) >+ ) >+ ]), >+ ?XC("h3", "Sessions: " ++ get_stat_n("languages")), >+ ?XAE("table", [], >+ [?XE("tbody", >+ do_stat_table(global, Lang, "languages", Host) >+ ) >+ ]) >+ ]. >+ >+ >+ > list_online_users(Host, _Lang) -> > Users = [{S, U} || {U, S, R} <- ejabberd_sm:get_vh_session_list(Host)], > SUsers = lists:usort(Users), >@@ -2015,6 +2177,12 @@ > ]; > > get_node(global, Node, ["stats"], Query, Lang) -> >+ Res = case whereis(ejabberd_mod_statsdx) of >+ undefined -> get_node(global, Node, ["statslight"], Query, Lang); >+ _ -> get_node(global, Node, ["statsdx"], Query, Lang) >+ end; >+ >+get_node(global, Node, ["statslight"], Query, Lang) -> > UpTime = rpc:call(Node, erlang, statistics, [wall_clock]), > UpTimeS = io_lib:format("~.3f", [element(1, UpTime)/1000]), > CPUTime = rpc:call(Node, erlang, statistics, [runtime]), >@@ -2089,9 +2257,124 @@ > ?XCT("h3", "Script check"), ?C(atom_to_list(Check))]) > ]; > >+get_node(global, Node, ["statsdx"], Query, Lang) -> >+ TransactionsCommited = >+ rpc:call(Node, mnesia, system_info, [transaction_commits]), >+ TransactionsAborted = >+ rpc:call(Node, mnesia, system_info, [transaction_failures]), >+ TransactionsRestarted = >+ rpc:call(Node, mnesia, system_info, [transaction_restarts]), >+ TransactionsLogged = >+ rpc:call(Node, mnesia, system_info, [transaction_log_writes]), >+ >+ [?XC("h1", io_lib:format(?T("~p statistics"), [Node])), >+ ?XC("h3", "Connections"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(global, Lang, "authusers"), >+ do_stat(Node, Lang, "httppollusers"), >+ do_stat(Node, Lang, "s2sconnections"), >+ do_stat(Node, Lang, "s2sservers") >+ ]) >+ ]), >+ ?XC("h3", "Erlang"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(Node, Lang, "operatingsystem"), >+ do_stat(Node, Lang, "erlangmachine"), >+ do_stat(Node, Lang, "erlangmachinetarget"), >+ do_stat(Node, Lang, "maxprocallowed"), >+ do_stat(Node, Lang, "procqueue"), >+ do_stat(Node, Lang, "totalerlproc") >+ ]) >+ ]), >+ ?XC("h3", "Times"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(Node, Lang, "uptime"), >+ do_stat(Node, Lang, "uptimehuman"), >+ do_stat(Node, Lang, "lastrestart"), >+ do_stat(Node, Lang, "cputime") >+ ]) >+ ]), >+ ?XC("h3", "CPU"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ do_stat(Node, Lang, "cpu_avg1"), >+ do_stat(Node, Lang, "cpu_avg5"), >+ do_stat(Node, Lang, "cpu_avg15"), >+ do_stat(Node, Lang, "cpu_nprocs")%, >+ %do_stat(Node, Lang, "cpu_util_user"), >+ %do_stat(Node, Lang, "cpu_nice_user"), >+ %do_stat(Node, Lang, "cpu_kernel"), >+ %do_stat(Node, Lang, "cpu_idle"), >+ %do_stat(Node, Lang, "cpu_wait") >+ ]) >+ ]), >+ %?XC("h3", "RAM"), >+ %?XAE("table", [], >+ % [?XE("tbody", [ >+ %do_stat(Node, Lang, "memsup_system"), >+ %do_stat(Node, Lang, "memsup_free"), >+ %do_stat(Node, Lang, "reductions") >+ % ]) >+ % ]), >+ ?XC("h3", "Database"), >+ ?XAE("table", [], >+ [?XE("tbody", [ >+ ?XE("tr", [?XCT("td", "Transactions commited"), >+ ?XAC("td", [{"class", "alignright"}], >+ integer_to_list(TransactionsCommited))]), >+ ?XE("tr", [?XCT("td", "Transactions aborted"), >+ ?XAC("td", [{"class", "alignright"}], >+ integer_to_list(TransactionsAborted))]), >+ ?XE("tr", [?XCT("td", "Transactions restarted"), >+ ?XAC("td", [{"class", "alignright"}], >+ integer_to_list(TransactionsRestarted))]), >+ ?XE("tr", [?XCT("td", "Transactions logged"), >+ ?XAC("td", [{"class", "alignright"}], >+ integer_to_list(TransactionsLogged))]) >+ ]) >+ ])]; >+ > get_node(Host, Node, NPath, Query, Lang) -> > [?XCT("h1", "Not Found")]. > >+do_table_element(Lang, L, N) -> >+ ?XE("tr", [ >+ ?XCT("td", L), >+ ?XAC("td", [{"class", "alignright"}], >+ N) >+ ]). >+ >+do_stat_table(global, Lang, Stat, Host) -> >+ Os = mod_statsdx:get(global, [Stat, Host]), >+ lists:map( >+ fun({L, N}) -> >+ do_table_element(Lang, L, io_lib:format("~p", [N])) >+ end, >+ Os >+ ). >+ >+do_stat(Node, Lang, Stat) -> >+ ?XE("tr", [ >+ ?XCT("td", get_stat_n(Stat)), >+ ?XAC("td", [{"class", "alignright"}], >+ get_stat_v(Node, [Stat]))]). >+ >+do_stat(Node, Lang, Stat, Host) -> >+ %[Res] = get_stat_v(Node, [Stat, Host]), >+ %do_table_element(Lang, get_stat_n(Stat), Res). >+ do_table_element(Lang, get_stat_n(Stat), get_stat_v(Node, [Stat, Host])). >+ >+% Get a stat name >+get_stat_n(Stat) -> >+ mod_statsdx:get(foo, [Stat, title]). >+% Get a stat value >+get_stat_v(Node, Stat) -> get_stat_v2(mod_statsdx:get(Node, Stat)). >+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) -> io_lib:format("~p", [Value]). > > node_parse_query(Node, Query) -> > case lists:keysearch("restart", 1, Query) of
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 137724
:
89901
|
89902
|
89903
|
90512
|
98839
|
99435
|
99436
|
99437
|
99438
| 99439