summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2012-03-26 10:49:26 +0100
committerEmile Joubert <emile@rabbitmq.com>2012-03-26 10:49:26 +0100
commit30178a63189e0e7edf6d7e07c80f4ce53e97829d (patch)
treedfc3316ec0095359254f775974bffe60a69f5156
parentba60685def0c21d523ab0d5c0e260cbb2c656eb5 (diff)
downloadrabbitmq-server-30178a63189e0e7edf6d7e07c80f4ce53e97829d.tar.gz
Disk free checking updates
- add to status output - check supported platforms
-rw-r--r--src/rabbit.erl4
-rw-r--r--src/rabbit_alarm.erl14
2 files changed, 11 insertions, 7 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index dd5fb89c..84a08412 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -327,7 +327,9 @@ status() ->
[{vm_memory_high_watermark, {vm_memory_monitor,
get_vm_memory_high_watermark, []}},
{vm_memory_limit, {vm_memory_monitor,
- get_memory_limit, []}}]),
+ get_memory_limit, []}},
+ {disk_free_limit, {disk_monitor,
+ get_disk_free_limit, []}}]),
S3 = rabbit_misc:with_exit_handler(
fun () -> [] end,
fun () -> [{file_descriptors, file_handle_cache:info()}] end),
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index c95966b5..2678cd7b 100644
--- a/src/rabbit_alarm.erl
+++ b/src/rabbit_alarm.erl
@@ -48,9 +48,10 @@ start() ->
{ok, DiskLimit} = application:get_env(disk_free_limit),
rabbit_sup:start_restartable_child(disk_monitor, [DiskLimit]),
- case disk_monitor:get_disk_free() of
- Number when is_integer(Number) -> ok;
- _ -> error_logger:warning_msg("Disabling disk free space monitoring~n"),
+ case {vm_memory_monitor:get_total_memory(), disk_monitor:get_disk_free()} of
+ {N1, N2} when is_integer(N1), is_integer(N2) -> ok;
+ _ -> error_logger:warning_msg("Disabling disk free space monitoring "
+ "on unsupported platform~n"),
ok = rabbit_sup:stop_child(disk_monitor_sup)
end,
ok.
@@ -103,7 +104,7 @@ handle_event({node_up, Node}, State) ->
{ok, State};
handle_event({node_down, Node}, State) ->
- {ok, maybe_alert(fun dict_unappend/3, Node, '$all_values', State)};
+ {ok, maybe_alert(fun dict_unappend_all/3, Node, State)};
handle_event({register, Pid, HighMemMFA}, State) ->
{ok, internal_register(Pid, HighMemMFA, State)};
@@ -126,8 +127,9 @@ code_change(_OldVsn, State, _Extra) ->
%%----------------------------------------------------------------------------
-dict_unappend(Key, '$all_values', Dict) ->
- dict:erase(Key, Dict);
+dict_unappend_all(Key, Dict) ->
+ dict:erase(Key, Dict).
+
dict_unappend(Key, Val, Dict) ->
case lists:delete(Val, dict:fetch(Key, Dict)) of
[] -> dict:erase(Key, Dict);