Monitor PostgreSQL database with munin

Install munin and dependencies.
sudo aptitude install munin munin-node munin-plugins-extra libdbd-pg-perl

Let munin make suggestions for you.
sudo munin-node-configure --suggest| grep postgres

The above should reply with several lines similar to this.

Plugin                     | Used | Suggestions                            
------                     | ---- | -----------  
postgres_bgwriter          | no   | yes                                    
postgres_cache_            | no   | yes (+ALL +gis)            
postgres_checkpoints       | no   | yes

The no | yes pattern is what we hope to see for the postgres-related plugins. That means they are installed but not enabled, and ready to be enabled. Munin makes this easy.
sudo munin-node-configure --shell
Will print a list of ln -s symbolic link commands. Select and sudo execute the symbolic link command for the plugins you wish to enable. For example, to enable a single munin-node plugin that graphs the size of all postgres databases as a stack.
sudo ln -s '/usr/share/munin/plugins/postgres_size_' '/etc/munin/plugins/postgres_size_ALL'

Repeat this for each of the plugins you wish to enable. Or, try this shortcut. If you wish to use all of the suggestions from munin.
sudo munin-node-configure --shell | sudo sh
Will execute the symbolic link commands for you.

Then wait for munin to update and you should see your new postgres graphs.

For legacy mysql apps monitoring....

Cool hint, thanks! BTW on Ubuntu 10.04 Lucid if you want to do the same thing with mysql, you need to install the perl cache library:
aptitude install libcache-cache-perl
Have a nice day!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <q> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <h1> <h2> <h3> <h4> <pre> <sup> <sub> <blockquote>
  • Lines and paragraphs break automatically.

More information about formatting options