On Thu, 19 Dec 2013 17:15:31 +0100 (CET) Christian Kratzer <[email protected]> wrote > On Thu, 19 Dec 2013, Michael Ströder wrote: > > Using back-mdb there's one thing which could cause trouble: > > One has to configure olcDbMaxSize which cannot be changed later. > > > > So when monitoring OpenLDAP with back-mdb it would be interesting to see > > how much space of configured olcDbMaxSize is already occupied. > > > > Does it make sense to compare the real file size shown by du -h > > /path/to/data.mdb to configured olcDbMaxSize? > > something like mdb_stat: > > [ldaptest1]# mdb_stat -e /var/lib/ldap > Environment Info > Map address: (nil) > Map size: 1073741824 > Page size: 4096 > Max pages: 262144 > Number of pages used: 2604 > Last transaction ID: 125386 > Max readers: 126 > Number of readers used: 9 > Status of Main DB > Tree depth: 1 > Branch pages: 0 > Leaf pages: 1 > Overflow pages: 0 > Entries: 17 > [ldaptest1]# > > Although I am not 100% sure what would be the best values to monitor. > > Propably Number of pages used and max pages.
Hmm, I'd prefer to use pure Python and avoid calling external command-line programs. How about plain file status information like described here? After all I'm just interested in a percentage of the used space. http://stackoverflow.com/questions/3211999/sparse-file-usage-in-python There's a hard-coded block-size of 512 bytes used therein which seems to match output of command "du -h" on my system. Not sure about other systems though. Ciao, Michael.
