May 2018
Intermediate to advanced
576 pages
30h 25m
English
You may want this as a Nagios plugin.
Look at check_postgres_bloat, which is a part of the check_postgres plugins.
It provides some flexible options to assess bloat. Unfortunately, it's not that well documented, but if you've read this, it should make sense. You'll need to play with it to get the thresholding correct anyway, so that shouldn't be a problem.
Note also that the only way to know for certain the exact bloat of a table or index is to scan the whole relation. Anything else is just an estimate, and might lead to you running maintenance either too early or too late.