CyberDem0n / bg_mon

Background worker for monitoring PostgreSQL
MIT License
66 stars 11 forks source link

[Discuss] Track sizes of certain subdirectories in bg_mon #64

Open sdudoladov opened 5 months ago

sdudoladov commented 5 months ago

Hello, @CyberDem0n

I would like to extend bg_mon to report the sizes of pg_replslot and pgsql_tmp. My question is how to do it in the best way.

  1. I can follow the implementation of pg_log directory size . That however will duplicate data bg_mon reports under the device key for the most common case where all subdirectories reside at the same place (such duplication already happens for data, wal, and logentries). This approach also does not look extensible if one needs to add sizes of more subdirectories of $PGDATA to the bg_mon in the future.

  2. Or I can create a separate subdirectories dictionary with "subdirectory": its size in KB key-value pairs. The dictionary will list all subdirectories in $PGDATA

wdyt ?

Jan-M commented 5 months ago

As long as we dont try or want to resolve issues around real free space and or mount points, just continuing approach 1) sounds fine. Seems that monitoring/alerting would need some knowledge about disk layout either way.