Take a look at the pg_stat_archiver view, if you have not already:

https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ARCHIVER-VIEW

So I want to check how many wal file got created in x minutes and how many
> .ready files got created in those x minutes.
>

It's not clear why you would want to track .ready files, they should be
quite transient, and not a concern unless you are rolling your own
archiving system (which you should not be). But Ron's suggestion of
inotifywait is a good one for this. Probably listed as inotify or
inotify-tools in your packaging system. Basic usage would be something like
this, from the data directory:

timeout 10m inotifywait pg_wal/ -r -m -e close_write -o walinfo.log

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

Reply via email to