diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-10 12:26:31 +0000 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-01-10 12:26:31 +0000 |
commit | ef2ab5274618b3750479875b927be218b0d8bda4 (patch) | |
tree | 67e615e338e25a59ab176a0259b17a4da6d248fd | |
parent | 5b55bf19ff24fcc24c31efa04d3590b67059c294 (diff) | |
download | rabbitmq-server-ef2ab5274618b3750479875b927be218b0d8bda4.tar.gz |
include fd info in rabbit:status()
There is a slight layer violation here - we label the info items with
'socket...', which is correct in the rabbit context but really could
be any fd in other contexts. Note though that we already mentioned
sockets in the log message produced on startup.
-rw-r--r-- | docs/rabbitmqctl.1.xml | 7 | ||||
-rw-r--r-- | src/file_handle_cache.erl | 8 | ||||
-rw-r--r-- | src/rabbit.erl | 24 |
3 files changed, 22 insertions, 17 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml index 15755038..7268f090 100644 --- a/docs/rabbitmqctl.1.xml +++ b/docs/rabbitmqctl.1.xml @@ -1273,9 +1273,10 @@ <para> Displays broker status information such as the running applications on the current Erlang node, RabbitMQ and - Erlang versions, OS name and memory statistics. (See - the <command>cluster_status</command> command to find - out which nodes are clustered and running.) + Erlang versions, OS name, memory and file descriptor + statistics. (See the <command>cluster_status</command> + command to find out which nodes are clustered and + running.) </para> <para role="example-prefix">For example:</para> <screen role="example">rabbitmqctl status</screen> diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index 66114732..3ef12375 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -261,7 +261,7 @@ -endif. %%---------------------------------------------------------------------------- --define(INFO_KEYS, [obtain_count, obtain_limit]). +-define(INFO_KEYS, [count, limit, socket_count, socket_limit]). %%---------------------------------------------------------------------------- %% Public API @@ -789,8 +789,10 @@ write_buffer(Handle = #handle { hdl = Hdl, offset = Offset, infos(Items, State) -> [{Item, i(Item, State)} || Item <- Items]. -i(obtain_count, #fhc_state{obtain_count = Count}) -> Count; -i(obtain_limit, #fhc_state{obtain_limit = Limit}) -> Limit; +i(count, #fhc_state{open_count = C1, obtain_count = C2}) -> C1 + C2; +i(limit, #fhc_state{limit = Limit}) -> Limit; +i(socket_count, #fhc_state{obtain_count = Count}) -> Count; +i(socket_limit, #fhc_state{obtain_limit = Limit}) -> Limit; i(Item, _) -> throw({bad_argument, Item}). %%---------------------------------------------------------------------------- diff --git a/src/rabbit.erl b/src/rabbit.erl index 0a2681a2..114e62e3 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -308,17 +308,19 @@ stop_and_halt() -> ok. status() -> - [{pid, list_to_integer(os:getpid())}, - {running_applications, application:which_applications(infinity)}, - {os, os:type()}, - {erlang_version, erlang:system_info(system_version)}, - {memory, erlang:memory()}] ++ - rabbit_misc:filter_exit_map( - fun ({Key, {M, F, A}}) -> {Key, erlang:apply(M, F, A)} end, - [{vm_memory_high_watermark, {vm_memory_monitor, - get_vm_memory_high_watermark, []}}, - {vm_memory_limit, {vm_memory_monitor, - get_memory_limit, []}}]). + S1 = [{pid, list_to_integer(os:getpid())}, + {running_applications, application:which_applications(infinity)}, + {os, os:type()}, + {erlang_version, erlang:system_info(system_version)}, + {memory, erlang:memory()}], + S2 = rabbit_misc:filter_exit_map( + fun ({Key, {M, F, A}}) -> {Key, erlang:apply(M, F, A)} end, + [{vm_memory_high_watermark, {vm_memory_monitor, + get_vm_memory_high_watermark, []}}, + {vm_memory_limit, {vm_memory_monitor, + get_memory_limit, []}}]), + S3 = [{file_descriptors, file_handle_cache:info()}], + S1 ++ S2 ++ S3. is_running() -> is_running(node()). |