prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.83k stars 745 forks source link

postgres_exporter issue Accept tcp [::]:9187: accept4: too many open files #943

Closed garry-t closed 1 year ago

garry-t commented 1 year ago

What did you do? start service via systemd What did you expect to see? nothing What did you see instead? Under which circumstances? after sometime system reports too many files opened Environment

--extend.query-path /etc/prometheus/postgres-queries.yml
--web.listen-address :9187
User limits

ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 514704 max locked memory (kbytes, -l) 65536 max memory size (kbytes, -m) unlimited open files (-n) 65535 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 65535 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited

postgress exporter limits

cat /proc/2262062/limits Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 514704 514704 processes Max open files 100 100 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 514704 514704 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us


Please help understand the issue and possible fix. 
Thanks
garry-t commented 1 year ago

Meanwhile I increased Max open files limit 100 -> 1000 I think it is only question of time when it will be reached

sysadmind commented 1 year ago

v0.4.7 is old and unsupported. Please upgrade to v0.14.0 or newer.