diff options
author | Emile Joubert <emile@rabbitmq.com> | 2011-05-27 12:46:39 +0100 |
---|---|---|
committer | Emile Joubert <emile@rabbitmq.com> | 2011-05-27 12:46:39 +0100 |
commit | 78665867a6d8e1b574bfc9d680f27022c18bdcc1 (patch) | |
tree | ec188fd78ad5a48ffb6f1dbf98dceb47449e0c5a /src/rabbit_control.erl | |
parent | 2ea7604c16e0da630bdae45aef8e102af80c0ce4 (diff) | |
download | rabbitmq-server-78665867a6d8e1b574bfc9d680f27022c18bdcc1.tar.gz |
rabbitmqctl report listing consumers more consistently
Diffstat (limited to 'src/rabbit_control.erl')
-rw-r--r-- | src/rabbit_control.erl | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl index ef5fd420..64343849 100644 --- a/src/rabbit_control.erl +++ b/src/rabbit_control.erl @@ -274,14 +274,8 @@ action(list_channels, Node, Args, _Opts, Inform) -> action(list_consumers, Node, _Args, Opts, Inform) -> Inform("Listing consumers", []), VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)), - InfoKeys = [queue_name, channel_pid, consumer_tag, ack_required], - case rpc_call(Node, rabbit_amqqueue, consumers_all, [VHostArg]) of - L when is_list(L) -> display_info_list( - [lists:zip(InfoKeys, tuple_to_list(X)) || - X <- L], - InfoKeys); - Other -> Other - end; + display_info_list(rpc_call(Node, rabbit_amqqueue, consumers_all, [VHostArg]), + rabbit_amqqueue:consumer_info_keys()); action(trace_on, Node, [], Opts, Inform) -> VHost = proplists:get_value(?VHOST_OPT, Opts), @@ -313,21 +307,34 @@ action(list_permissions, Node, [], Opts, Inform) -> action(report, Node, _Args, _Opts, Inform) -> io:format("Reporting server status on ~p~n", [erlang:universaltime()]), - [action(status, ClusteredNode, [], [], Inform) || - ClusteredNode <- rpc_call(Node, rabbit_mnesia, running_clustered_nodes, [])], - Report = fun (Module, VHostArg) -> - io:format("%% ~p~n", [[Module] ++ VHostArg]), - case Results = rpc_call(Node, Module, info_all, VHostArg) of - [Row|_] -> {InfoItems,_} = lists:unzip(Row), - display_info_list(Results, InfoItems); - _ -> ok + [action(status, ClusterNode, [], [], Inform) || + ClusterNode <- rpc_call(Node, rabbit_mnesia, running_clustered_nodes, [])], + Report = fun ({Descr, Module, InfoFun, KeysFun}, VHostArg) -> + io:format("%% ~p~n", [[Descr] ++ VHostArg]), + case Results = rpc_call(Node, Module, InfoFun, VHostArg) of + [_|_] -> InfoItems = rpc_call(Node, Module, KeysFun, []), + display_info_list(Results, InfoItems); + _ -> ok end end, - GlobalQueries = [rabbit_channel], - VHostQueries = [rabbit_amqqueue, rabbit_exchange, rabbit_binding], - [Report(M, []) || M <- GlobalQueries], - [Report(M, [V]) || V <- rpc_call(Node, rabbit_vhost, list, []), - M <- VHostQueries], + GlobalQueries = [{"connections", rabbit_networking, connection_info_all, + connection_info_keys}, + {"channels", rabbit_channel, connection_info_all, + info_keys}], + VHostQueries = [{"queues", rabbit_amqqueue, info_all, info_keys}, + {"exchanges", rabbit_exchange, info_all, info_keys}, + {"bindings", rabbit_binding, info_all, info_keys}, + {"consumers", rabbit_amqqueue, consumers_all, + consumer_info_keys}], + VHosts = rpc_call(Node, rabbit_vhost, list, []), + [Report(Q, []) || Q <- GlobalQueries], + [Report(Q, [V]) || V <- VHosts, Q <- VHostQueries], + [begin + io:format("%% ~p~n", [["permissions" | [VHost]]]), + display_list(call(Node, + {rabbit_auth_backend_internal, list_vhost_permissions, + [binary_to_list(VHost)]})) + end || VHost <- VHosts], ok. %%---------------------------------------------------------------------------- |