summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2019-04-13 00:36:03 +0400
committerMichael Klishin <michael@clojurewerkz.org>2019-04-13 01:12:20 +0400
commite553ecbc0173ad4e1962c127e9e94e27b3adbad1 (patch)
tree58ed2f917337600b59819a63c5b95e0e50087e2e
parentdc3c04ffc3862d89d24f55594ae62ab0f8747fdd (diff)
downloadrabbitmq-server-git-e553ecbc0173ad4e1962c127e9e94e27b3adbad1.tar.gz
rabbit:status/0: new section on basic (topology) totals
Per suggestion from @gerhard in rabbitmq/rabbitmq-cli#341
-rw-r--r--src/rabbit.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 59feef6376..a60ffe789e 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -851,7 +851,12 @@ status() ->
{enabled_plugin_file, rabbit_plugins:enabled_plugins_file()}],
S6 = [{config_files, config_files()},
{log_files, log_locations()}],
- S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6.
+ S7 = [{totals, [
+ {virtual_host_count, rabbit_vhost:count()},
+ {connection_count, length(rabbit_networking:connections_local())},
+ {queue_count, total_queue_count()}
+ ]}],
+ S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6 ++ S7.
alarms() ->
Alarms = rabbit_misc:with_exit_handler(rabbit_misc:const([]),
@@ -868,6 +873,12 @@ listeners() ->
end,
[L || L = #listener{node = Node} <- Listeners, Node =:= node()].
+total_queue_count() ->
+ lists:foldl(fun (VirtualHost, Acc) ->
+ Acc + rabbit_amqqueue:count(VirtualHost)
+ end,
+ 0, rabbit_vhost:list()).
+
%% TODO this only determines if the rabbit application has started,
%% not if it is running, never mind plugins. It would be nice to have
%% more nuance here.