Postgresql plugins are in the core of Munin 1.4 !
The current muninpgplugins are
not actively maintain.
MuninPgPlugins are a set of plugins to collect statistic data from a PostgreSQL server.
They are mainly used to monitor by database, so you need to install them for every database you want to monitor.
All the plugins are in perl and need the DBD::Pg Perl module.
Every plugins are self documented and can be used alone.
Munin let you do some things with data grabbed by the plugins.
For example you can agreagte, stack and do some basic stuff.
Or remove some data from graph when they are useless and noisy.
Check the file pg.munin.conf for examples.
This plugin output the number of idle, waiting and active connections.
This plugin output the database size as provided by pg_database_size('my_db');
This plugin output all possible locks from postgresql.
This plugin output all data from this view for specified database.
This plugin take every column in pg_stat_*_tables (except *vacuum and *analyze). The data is then usable for agregate graph in munin.conf (like ratio).
Special parameter (statscope) to specify if pg_stat_all_tables or pg_stat_user_tables or pg_stat_sys_tables is used (user by default).
This plugin take every column in pg_statio_*_tables. The data is then usable for agregate graph in munin.conf (like ratio).
Special parameter (statscope) to specify if pg_statio_all_tables or pg_statio_user_tables or pg_statio_sys_tables is used (user by default).
This plugin take every column in pg_stat_bgwriter. The data is then usable for agregate graph in munin.conf (like ratio).
As all databases have the same values in this table, it is unecessary to grab them more than once.
First you'll need the DBD::Pg Perl module.
For example, on Debian, you should have:
sudo aptitude install libdbd-pg-perl
Then just untar the tarball where you want.
$ tar xvzf muninpgplugins-*.tar.gz
$ cd muninpgplugins*
You must also activate Postgresql statistics for most of the plugin to work. See
for how to enable this. Specifically, the following lines must
exist in your postgresql.conf:
stats_start_collector = true
stats_block_level = true
MuninPgPlugins come with a special file to help you install the plugins for your specified database.
$ ./install.sh mydb
This will output the commandlines you have to execute yourself. And look at the last lines, it is the configuration you have to add to munin-node :
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__connections /etc/munin/plugins/pg_mydb_connections
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__db_size /etc/munin/plugins/pg_mydb_db_size
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__locks /etc/munin/plugins/pg_mydb_locks
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__stat_bgwriter /etc/munin/plugins/pg_mydb_stat_bgwriter
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__stat_database /etc/munin/plugins/pg_mydb_stat_database
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__statio_tables /etc/munin/plugins/pg_mydb_statio_tables
sudo ln -s /usr/share/munin/plugins/muninpgplugins/pg__stat_tables /etc/munin/plugins/pg_mydb_stat_tables
# Add this to your plugin-conf.d/munin-node :
cat <<INFO >> /etc/munin/plugin-conf.d/munin-node
If required, you can give username, password and/or Postgresql server
host through environment variables or via the configuration file :
Which database server to use. Defaults to 'localhost'.
Which database to use. Defaults to template1
A Postgresql user account with read permission to the given database. Defaults to 'postgres'. Anyway, Munin must be told which user this plugin should be run as.
The corresponding password, if applicable. Default to undef. Remember that pg_hba.conf must be configured accordingly.
The config variables need to be write like this in the configuration file: