Skip to content

Commit 6ab94d3

Browse files
committed
Restore FD info in rabbitmqctl status
The FD limits are still valuable. The FD used will still show some information during CQv1 upgrade to v2 so it is kept for now. But in the future it will have to be reworked to query the system, or be removed.
1 parent 11e335c commit 6ab94d3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

deps/rabbit/src/rabbit.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,9 @@ status() ->
744744
get_disk_free_limit, []}},
745745
{disk_free, {rabbit_disk_monitor,
746746
get_disk_free, []}}]),
747+
S3 = rabbit_misc:with_exit_handler(
748+
fun () -> [] end,
749+
fun () -> [{file_descriptors, file_handle_cache:info()}] end),
747750
S4 = [{processes, [{limit, erlang:system_info(process_limit)},
748751
{used, erlang:system_info(process_count)}]},
749752
{run_queue, erlang:statistics(run_queue)},
@@ -778,7 +781,7 @@ status() ->
778781
(_) -> false
779782
end,
780783
maps:to_list(product_info())),
781-
S1 ++ S2 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8.
784+
S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8.
782785

783786
alarms() ->
784787
Alarms = rabbit_misc:with_exit_handler(rabbit_misc:const([]),

deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
164164
"#{category}: #{IU.convert(val[:bytes], unit)} #{unit} (#{val[:percentage]} %)"
165165
end)
166166

167+
file_descriptors = [
168+
"\n#{bright("File Descriptors")}\n",
169+
"Total: #{m[:file_descriptors][:total_used]}, limit: #{m[:file_descriptors][:total_limit]}"
170+
]
171+
167172
disk_space_section = [
168173
"\n#{bright("Free Disk Space")}\n",
169174
"Low free disk space watermark: #{IU.convert(m[:disk_free_limit], unit)} #{unit}",
@@ -194,7 +199,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
194199
log_section ++
195200
alarms_section ++
196201
memory_section ++
197-
disk_space_section ++ totals_section ++ listeners_section
202+
file_descriptors ++ disk_space_section ++ totals_section ++ listeners_section
198203

199204
{:ok, Enum.join(lines, line_separator())}
200205
end
@@ -258,6 +263,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do
258263
vm_memory_high_watermark_limit: Keyword.get(result, :vm_memory_limit),
259264
disk_free_limit: Keyword.get(result, :disk_free_limit),
260265
disk_free: Keyword.get(result, :disk_free),
266+
file_descriptors: Enum.into(Keyword.get(result, :file_descriptors), %{}),
261267
alarms: Keyword.get(result, :alarms),
262268
listeners: listener_maps(Keyword.get(result, :listeners, [])),
263269
memory: Keyword.get(result, :memory) |> Enum.into(%{}),

0 commit comments

Comments
 (0)