@@ -1238,6 +1238,69 @@ fun(Conf) ->
12381238 end
12391239end }.
12401240
1241+ % % Per-queue-type / per-mount-point disk alarms
1242+ {mapping , " disk_free_limits.$id.mount_point" , " rabbit.disk_free_limits" , [
1243+ {datatype , [string ]}
1244+ ]}.
1245+ {mapping , " disk_free_limits.$id.absolute" , " rabbit.disk_free_limits" , [
1246+ {datatype , [integer , string ]},
1247+ {validators , [" is_supported_information_unit" ]}
1248+ ]}.
1249+ {mapping , " disk_free_limits.$id.queue_types" , " rabbit.disk_free_limits" , [
1250+ {datatype , [binary ]}
1251+ ]}.
1252+
1253+ {translation , " rabbit.disk_free_limits" ,
1254+ fun (Conf ) ->
1255+ case cuttlefish_variable :filter_by_prefix (" disk_free_limits" , Conf ) of
1256+ [] ->
1257+ cuttlefish :unset ();
1258+ Settings ->
1259+ lists :foldl (
1260+ fun ({[" disk_free_limits" , Id , " mount_point" ], Path }, Acc ) ->
1261+ maps :update_with (
1262+ list_to_binary (Id ),
1263+ fun ({undefined , Limit , QTs }) ->
1264+ {Path , Limit , QTs };
1265+ ({ExistingPath , Limit , QTs }) ->
1266+ cuttlefish :warn (
1267+ " Duplicate mount point set for ~ts , using "
1268+ " '~ts ' instead of '~ts '" ,
1269+ [Id , Path , ExistingPath ]),
1270+ {Path , Limit , QTs }
1271+ end , {Path , undefined , []}, Acc );
1272+ ({[" disk_free_limits" , Id , " absolute" ], Limit }, Acc ) ->
1273+ maps :update_with (
1274+ list_to_binary (Id ),
1275+ fun ({Path , undefined , QTypes }) ->
1276+ {Path , Limit , QTypes };
1277+ ({Path , ExistingLimit , QTypes }) ->
1278+ cuttlefish :warn (
1279+ " Duplicate disk free limits set for ~ts , "
1280+ " using ~tp instead of ~tp " ,
1281+ [Id , Limit , ExistingLimit ]),
1282+ {Path , Limit , QTypes }
1283+ end , {undefined , Limit , []}, Acc );
1284+ ({[" disk_free_limits" , Id , " queue_types" ], QTs0 }, Acc ) ->
1285+ QTs = string :split (QTs0 , " ," ),
1286+ maps :update_with (
1287+ list_to_binary (Id ),
1288+ fun ({Path , Limit , []}) ->
1289+ {Path , Limit , QTs };
1290+ ({Path , Limit , ExistingQTs }) ->
1291+ cuttlefish :warn (" Duplicate queue types set "
1292+ " for disk free limit of ~ts , "
1293+ " using ~tp instead of ~tp " ,
1294+ [Id , QTs , ExistingQTs ]),
1295+ {Path , Limit , QTs }
1296+ end , {undefined , undefined , QTs }, Acc );
1297+ (Other , _Acc ) ->
1298+ cuttlefish :invalid (
1299+ io_lib :format (" ~p is invalid" , [Other ]))
1300+ end , #{}, Settings )
1301+ end
1302+ end }.
1303+
12411304% %
12421305% % Clustering
12431306% % =====================
0 commit comments