From 6ab94d3b8bd9c9ca44185df53cab7e76bb97fc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 20 Jun 2024 15:35:19 +0200 Subject: [PATCH] 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. --- deps/rabbit/src/rabbit.erl | 5 ++++- .../lib/rabbitmq/cli/ctl/commands/status_command.ex | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/deps/rabbit/src/rabbit.erl b/deps/rabbit/src/rabbit.erl index ac8a49ccd2b1..0f201f3b4cfa 100644 --- a/deps/rabbit/src/rabbit.erl +++ b/deps/rabbit/src/rabbit.erl @@ -744,6 +744,9 @@ status() -> get_disk_free_limit, []}}, {disk_free, {rabbit_disk_monitor, get_disk_free, []}}]), + S3 = rabbit_misc:with_exit_handler( + fun () -> [] end, + fun () -> [{file_descriptors, file_handle_cache:info()}] end), S4 = [{processes, [{limit, erlang:system_info(process_limit)}, {used, erlang:system_info(process_count)}]}, {run_queue, erlang:statistics(run_queue)}, @@ -778,7 +781,7 @@ status() -> (_) -> false end, maps:to_list(product_info())), - S1 ++ S2 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8. + S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8. alarms() -> Alarms = rabbit_misc:with_exit_handler(rabbit_misc:const([]), diff --git a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex index 2cbd55f6205a..c37c0971ceee 100644 --- a/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex +++ b/deps/rabbitmq_cli/lib/rabbitmq/cli/ctl/commands/status_command.ex @@ -164,6 +164,11 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do "#{category}: #{IU.convert(val[:bytes], unit)} #{unit} (#{val[:percentage]} %)" end) + file_descriptors = [ + "\n#{bright("File Descriptors")}\n", + "Total: #{m[:file_descriptors][:total_used]}, limit: #{m[:file_descriptors][:total_limit]}" + ] + disk_space_section = [ "\n#{bright("Free Disk Space")}\n", "Low free disk space watermark: #{IU.convert(m[:disk_free_limit], unit)} #{unit}", @@ -194,7 +199,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do log_section ++ alarms_section ++ memory_section ++ - disk_space_section ++ totals_section ++ listeners_section + file_descriptors ++ disk_space_section ++ totals_section ++ listeners_section {:ok, Enum.join(lines, line_separator())} end @@ -258,6 +263,7 @@ defmodule RabbitMQ.CLI.Ctl.Commands.StatusCommand do vm_memory_high_watermark_limit: Keyword.get(result, :vm_memory_limit), disk_free_limit: Keyword.get(result, :disk_free_limit), disk_free: Keyword.get(result, :disk_free), + file_descriptors: Enum.into(Keyword.get(result, :file_descriptors), %{}), alarms: Keyword.get(result, :alarms), listeners: listener_maps(Keyword.get(result, :listeners, [])), memory: Keyword.get(result, :memory) |> Enum.into(%{}),