summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@lshift.net>2008-12-07 23:54:39 +0000
committerEmile Joubert <emile@lshift.net>2008-12-07 23:54:39 +0000
commit35222f2a1db0204b4921c5e4971c80c3777a5385 (patch)
tree214538495bf3f3c3c8d14cefd73762aecee10b64
parent7b8705719243d514977e0e6306576b1d48dc5d16 (diff)
downloadrabbitmq-server-35222f2a1db0204b4921c5e4971c80c3777a5385.tar.gz
rabbitmqctl pod updates, R11B-5 safe string handling
-rw-r--r--docs/rabbitmqctl.pod148
-rw-r--r--src/rabbit_control.erl30
2 files changed, 165 insertions, 13 deletions
diff --git a/docs/rabbitmqctl.pod b/docs/rabbitmqctl.pod
index b34cbca7..50916afc 100644
--- a/docs/rabbitmqctl.pod
+++ b/docs/rabbitmqctl.pod
@@ -27,6 +27,9 @@ B<-n> I<node>
after the "@" sign. See rabbitmq-server(1) for details of configur-
ing the RabbitMQ broker.
+B<-q>
+ quiet output mode is selected with the B<-q> flag. Informational
+ messages are suppressed when quiet mode is in effect.
=head1 COMMANDS
@@ -120,6 +123,151 @@ list_user_vhost I<username>
list all the virtual hosts to which the user named I<username> has
been granted access.
+=head2 SERVER STATUS
+
+list_queues [-p I<vhostpath>] [I<queueinfoitem> ...]
+ list queue information by virtual host. If no I<queueinfoitem>s
+ are specified then then name and number of messages is displayed
+ for each queue.
+
+=head3 Queue information items
+
+=over 4
+
+name
+ URL-encoded name of the queue
+
+durable
+ whether the queue survives server restarts
+
+auto_delete
+ whether the queue will be deleted when no longer used
+
+arguments
+ queue arguments
+
+pid
+ Erlang process identifier associated with the queue
+
+messages_ready
+ number of ready messages
+
+messages_unacknowledged
+ number of unacknowledged messages
+
+messages_uncommitted
+ number of uncommitted messages
+
+messages
+ sum of ready, unacknowledged and uncommitted messages
+
+acks_uncommitted
+ number of uncommitted acknowledgements
+
+consumers
+ number of consumers
+
+transactions
+ number of transactions
+
+memory
+ bytes of memory consumed by the Erlang process for the queue,
+ including stack, heap and internal structures
+
+=back
+
+list_exchanges [-p I<vhostpath>] [I<exchangeinfoitem> ...]
+ list exchange information by virtual host. If no
+ I<exchangeinfoitem>s are specified then name and type is displayed
+ for each exchange.
+
+=head3 Exchange information items
+
+=over 4
+
+name
+ URL-encoded name of the exchange
+
+type
+ echange type (B<direct>, B<topic> or B<fanout>)
+
+durable
+ whether the exchange survives server restarts
+
+auto_delete
+ whether the exchange is deleted when no longer used
+
+arguments
+ exchange arguments
+
+=back
+
+list_bindings [-p I<vhostpath>]
+ list bindings by virtual host. Each line contains exchange name,
+ routing key and queue name (all URL encoded) and arguments.
+
+list_connections [I<connectioninfoitem> ...]
+ list connection information. If no I<connectioninfoitem>s are
+ specified then the user, peer address and peer port are displayed.
+
+=head3 Connection information items
+
+=over 4
+
+pid
+ Erlang process id associated with the connection
+
+address
+ server IP number
+
+port
+ server port
+
+peer_address
+ peer address
+
+peer_port
+ peer port
+
+state
+ connection state (B<pre-init>, B<starting>, B<tuning>, B<opening>,
+ B<running>, B<closing>, B<closed>)
+
+channels
+ number of channels using the connection
+
+user
+ username associated with the connection
+
+vhost
+ URL-encoded virtual host
+
+timeout
+ connection timeout
+
+frame_max
+ maximum frame size (bytes)
+
+recv_oct
+ octets received
+
+recv_cnt
+ packets received
+
+send_oct
+ octets sent
+
+send_cnt
+ packets sent
+
+send_pend
+ send queue size
+
+The list_queues, list_exchanges and list_bindings commands accept an
+optional virtual host parameter for which to display results, defaulting
+to I<"/">. The default can be overridden with the B<-p> flag. Result
+columns for these commands and list_connections are tab-separated.
+
=head1 EXAMPLES
Create a user named foo with (initial) password bar at the Erlang node
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index 5544a447..8b97d14b 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -113,10 +113,10 @@ Available commands:
list_user_vhosts <UserName>
list_vhost_users <VHostPath>
- list_queues [-p <VHostPath>] <QueueInfoItem> [<QueueInfoItem> ...]
- list_exchanges [-p <VHostPath>] <ExchangeInfoItem> [<ExchangeInfoItem> ...]
+ list_queues [-p <VHostPath>] [<QueueInfoItem> ...]
+ list_exchanges [-p <VHostPath>] [<ExchangeInfoItem> ...]
list_bindings [-p <VHostPath>]
- list_connections <ConnectionInfoItem> [<ConnectionInfoItem> ...]
+ list_connections [<ConnectionInfoItem> ...]
Quiet output mode is selected with the \"-q\" flag. Informational messages
are suppressed when quiet mode is in effect.
@@ -247,15 +247,19 @@ action(list_exchanges, Node, Args, Inform) ->
action(list_bindings, Node, Args, Inform) ->
Inform("Listing bindings", []),
{VHostArg, _} = parse_vhost_flag(Args),
- lists:map(
- fun({#resource{name = ExchangeName, virtual_host = _VirtualHost},
- #resource{name = QueueName, virtual_host = _VirtualHost},
- RoutingKey,
- Arguments}) ->
- io:format("~s\t~s\t~s\t~w~n",
- [url_encode(ExchangeName), RoutingKey, url_encode(QueueName), Arguments])
- end,
- rpc_call(Node, rabbit_exchange, list_bindings, [VHostArg])),
+ display_info_list(
+ lists:map(
+ fun({#resource{name = ExchangeName, virtual_host = _VirtualHost},
+ #resource{name = QueueName, virtual_host = _VirtualHost},
+ RoutingKey,
+ Arguments}) ->
+ [{exchange_name, ExchangeName},
+ {routing_key, RoutingKey},
+ {queue_name, QueueName},
+ {args, Arguments}]
+ end,
+ rpc_call(Node, rabbit_exchange, list_bindings, [VHostArg])),
+ [exchange_name, routing_key, queue_name, args]),
ok;
action(list_connections, Node, Args, Inform) ->
@@ -293,7 +297,7 @@ display_info_list(Results, InfoItemArgs) when is_list(Results) ->
io_lib:format("~w", [InfoItemValue])
end
end,
- io:fwrite(string:join([RenderInfoItem(X) || X <- InfoItemArgs], "\t")),
+ io:fwrite(lists:flatten(rabbit_misc:intersperse("\t", [RenderInfoItem(X) || X <- InfoItemArgs]))),
io:nl()
end,
Results),