Alternative PostgreSQL plugin for munin — Part 3

Wed 11 November 2015

Filed under sysadmin

Tags munin postgresql python

Comparison with the Official Plugins

The most obvious difference you see at first is that it's only one single file instead of multiple. At this time I'm still pondering to break it apart, but I have a strong tendency to leave it as it is.

If you want to only enable some of the graphs, this can be done using the PG_MULTIGRAPHS environment variable. See Part 2 for details on this.

The main aim of the work was to aggregate those plugins which generated too many graphs. While they show aggregated values on the default munin overview, these new graphs will show a breakdown page once clicking on them.

Quick overview:

Official Plugin Name for new plugin
postgres_bgwriter Not ported (good enough).
postgres_checkpoints Not ported (good enough).
postgres_xlog Not ported (good enough).
postgres_transactions_ Not ported (no use-case).

Replaced with:

  • indexio
  • sequenceio
  • tableio
postgres_connections_ connections
postgres_connections_db Merged with connections.
postgres_users Merged with connections
postgres_locks_ locks
postgres_querylength_ query_ages
postgres_scans_ scan_types
postgres_size_ sizes
postgres_tuples_ row_access

Design Decisions


Most graph aggregations use stacked areas to display values. The idea behind this is that you are usually interested in the total value. Using stacks gives you a much better view of this. Overlapping lines are more useful to see correlations between values.

Most aggregations show the sum of all the agregates. In the case of the query ages, it shows the maximum of all the aggregates.

Replacing postgres_cache_ with 3 new I/O Plugins

While investigating, I discovered the following stats tables:

They give a more fine-grained view on buffer I/O than pg_stat_database and decided to split that one up.

Connections to the DB

This currently shows connections by user. It does not show connections per DB (yet?). I currently have no pressing plans to include connections per DB. So I will leave it as-is for the time being.


The official plugin combines both locks which are granted with locks which aren't (somewhere someone's waiting for the release). Personally, I find it more important to watch for waiting locks than for granted locks. For this reason, this plugin now splits both lock types up, showing granted locks on one side of the X-axis, and waiting locks on the other.

This still keeps all the information from the old graphs, but adds an additional element to it.

Query Ages

I decided to use "age" instead of "length" as, in the context of a graph, this makes more sense. Maybe I was a bit too nitpicky here.

The official graph shows both query and transaction start. The transaction start is currently not yet implemented in the new graph, but I will do so once this blog-post is done.

Scan Types

Nothing of importance to say here.


Nothing of importance to say here.

Row Access

Named Tuple Access in the official plugins. I renamed it as the statistics table in PG also talks about "row access". So do the docs.


Michel Albert © Michel Albert Powered by Pelican and Twitter Bootstrap. Icons by Font Awesome and Font Awesome More