mod_measure_process: Report the enforced limit
authorKim Alvefur <zash@zash.se>
Tue, 18 Jan 2022 18:55:20 +0100
changeset 4881 adc6241e5d16
parent 4880 0f5f2d4475b9
child 4882 c26f515751af
mod_measure_process: Report the enforced limit The soft limit is what the kernel actually enforces, while the hard limit is is how far you can change the soft limit without privileges. Unless the process dynamically adjusts the soft limit, knowing the hard limit is not as useful as knowing the soft limit. Reporting the soft limit and the number of in-use FDs allows placing alerts on expressions like 'process_open_fds / process_max_fds >= 0.95'
mod_measure_process/mod_measure_process.lua
--- a/mod_measure_process/mod_measure_process.lua	Tue Jan 18 17:01:18 2022 +0000
+++ b/mod_measure_process/mod_measure_process.lua	Tue Jan 18 18:55:20 2022 +0100
@@ -67,7 +67,7 @@
 		if has_posix then
 			local ok, soft, hard = posix.getrlimit("NOFILE")
 			if ok then
-				max_fds:set(hard)
+				max_fds:set(soft or hard);
 			end
 		end
 	end);