Relation and Database size for munin
Since we are running into some minor scaling problems at work and Munin doesn't provide the necessary information out of the box I created a small script that let's you see the relation size total relation size and also the database size of a PostgreSQL database.
The necessary information is quite easy to find in the PostgreSQL documentation. And with Python at hand you have a tool that let's you easily create the necessary script, available at my github repository.
The usage is simple just copy the script to a suitable place - personally I'd suggest either a directory under /opt oder /usr/local/bin - as my understanding of the Linux FHS is that this is just the right place.
When you're done make the script executable and symlink it to:
- pg_dbsize_ or
- pg_relation_size_ or
- pg_total_relation_size_ (this includes TOAST and indexes)
The latter two require to configure munin with at least a PG_DB environment variable so that the relation name is qualified and the functions used in the script will find the relation. The first form should just work.
Get the script here:Server!/Horror