diff options
| author | Emile Joubert <emile@rabbitmq.com> | 2012-03-23 17:04:18 +0000 |
|---|---|---|
| committer | Emile Joubert <emile@rabbitmq.com> | 2012-03-23 17:04:18 +0000 |
| commit | d4e9e4fbdcd0b807487070adb31ca197fe8313b9 (patch) | |
| tree | 0721e3783130d9db27feba2b08359eedb3e5b701 /src | |
| parent | e0357983739240a39c2a1ffea2b5033a57ead7fb (diff) | |
| download | rabbitmq-server-git-d4e9e4fbdcd0b807487070adb31ca197fe8313b9.tar.gz | |
Disk free limit setting with rabbitmqctl
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_control.erl | 24 |
1 files changed, 19 insertions, 5 deletions
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). |
