Skip to content

Commit 7f9d9d1

Browse files
committed
rabbit_env: Enable disksup in os_mon but set threshold to 1.0
Previously we set `start_disksup` to `false` to avoid OTP's automatic monitoring of disk space. `disksup`'s gen_server starts a port (which runs `df` on Unix) which measures disk usage and sets an alarm through OTP's `alarm_handler` when usage exceeds the configured `disk_almost_full_threshold`. We can set this threshold to 1.0 to effectively turn off disksup's monitoring (i.e. the alarm will never be set). By enabling disksup we have access to `get_disk_data/0` and `get_disk_info/0,1` which can be used to replace the copied versions in `rabbit_disk_monitor`.
1 parent 6295123 commit 7f9d9d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

deps/rabbit_common/src/rabbit_env.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,12 @@ context_to_app_env_vars1(
306306
[{kernel, inet_default_connect_options, [{nodelay, true}]},
307307
{sasl, errlog_type, error},
308308
{os_mon, start_cpu_sup, false},
309-
{os_mon, start_disksup, false},
309+
%% Start disksup but configure the threshold high enough that it will
310+
%% never alarm. `disksup' must be started to call `get_disk_info/0,1'
311+
%% and `get_disk_data/0' but we don't want it polluting the logs with
312+
%% its alarms. Alarming is done by `rabbit_disk_monitor' instead.
313+
{os_mon, start_disksup, true},
314+
{os_mon, disk_almost_full_threshold, 1.0},
310315
{os_mon, start_memsup, false},
311316
{mnesia, dir, DataDir},
312317
{ra, data_dir, QuorumQueueDir},

0 commit comments

Comments
 (0)