summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/rabbitmqctl.1.xml36
-rw-r--r--src/rabbit_control.erl24
2 files changed, 55 insertions, 5 deletions
diff --git a/docs/rabbitmqctl.1.xml b/docs/rabbitmqctl.1.xml
index ee07ebfea9..3a5ee30d81 100644
--- a/docs/rabbitmqctl.1.xml
+++ b/docs/rabbitmqctl.1.xml
@@ -1422,6 +1422,7 @@
</para>
</listitem>
</varlistentry>
+
<varlistentry>
<term><cmdsynopsis><command>set_vm_memory_high_watermark</command> <arg choice="req"><replaceable>fraction</replaceable></arg></cmdsynopsis></term>
<listitem>
@@ -1437,6 +1438,41 @@
</variablelist>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><cmdsynopsis><command>set_disk_free_limit</command> <arg choice="req"><replaceable>bytes</replaceable></arg></cmdsynopsis></term>
+ <listitem>
+ <variablelist>
+ <varlistentry>
+ <term>bytes</term>
+ <listitem><para>
+ The new disk free limit at which flow
+ control is triggered, for the drive or partition
+ that the broker data store resides on.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><cmdsynopsis><command>set_disk_free_limit_mem_relative</command> <arg choice="req"><replaceable>multiple</replaceable></arg></cmdsynopsis></term>
+ <listitem>
+ <variablelist>
+ <varlistentry>
+ <term>multiple</term>
+ <listitem><para>
+ The new disk free limit at which flow
+ control is triggered, expressed relative to total RAM.
+ The argument may be a floating point number
+ and the limit will be calculated as the argument
+ times the total installed RAM.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect2>
</refsect1>
diff --git a/src/rabbit_control.erl b/src/rabbit_control.erl
index 6a775adfb0..580faaeabc 100644
--- a/src/rabbit_control.erl
+++ b/src/rabbit_control.erl
@@ -324,13 +324,21 @@ action(trace_off, Node, [], Opts, Inform) ->
rpc_call(Node, rabbit_trace, stop, [list_to_binary(VHost)]);
action(set_vm_memory_high_watermark, Node, [Arg], _Opts, Inform) ->
- Frac = list_to_float(case string:chr(Arg, $.) of
- 0 -> Arg ++ ".0";
- _ -> Arg
- end),
- Inform("Setting memory threshhold on ~p to ~p", [Node, Frac]),
+ Frac = format_float(Arg),
+ Inform("Setting memory threshold on ~p to ~p", [Node, Frac]),
rpc_call(Node, vm_memory_monitor, set_vm_memory_high_watermark, [Frac]);
+action(set_disk_free_limit, Node, [Arg], _Opts, Inform) ->
+ Bytes = list_to_integer(Arg),
+ Inform("Setting disk free space limit on ~p to ~p bytes", [Node, Bytes]),
+ rpc_call(Node, disk_monitor, set_disk_free_limit, [Bytes]);
+
+action(set_disk_free_limit_mem_relative, Node, [Arg], _Opts, Inform) ->
+ Mult = format_float(Arg),
+ Inform("Setting disk free space limit on ~p to ~p times total RAM",
+ [Node, Mult]),
+ rpc_call(Node, disk_monitor, set_disk_free_limit, [{mem_relative, Mult}]);
+
action(set_permissions, Node, [Username, CPerm, WPerm, RPerm], Opts, Inform) ->
VHost = proplists:get_value(?VHOST_OPT, Opts),
Inform("Setting permissions for user ~p in vhost ~p", [Username, VHost]),
@@ -550,3 +558,9 @@ prettify_typed_amqp_value(table, Value) -> prettify_amqp_table(Value);
prettify_typed_amqp_value(array, Value) -> [prettify_typed_amqp_value(T, V) ||
{T, V} <- Value];
prettify_typed_amqp_value(_Type, Value) -> Value.
+
+format_float(Arg) ->
+ list_to_float(case string:chr(Arg, $.) of
+ 0 -> Arg ++ ".0";
+ _ -> Arg
+ end).