Munin with postgresql 9.2

Posted by jreid9001 on Server Fault See other posts from Server Fault or by jreid9001
Published on 2012-09-14T13:49:36Z Indexed on 2012/09/14 15:39 UTC
Read the original article Hit count: 439

Filed under:
|
|

I am trying to set up Munin to collect stats on a server with postgresql 9.1 and 9.2 (the server is currently running 9.1, have tested on a fresh VM with 9.2 to rule out some weird problem on the running server. I had to patch some of the plugins for 9.2 due to renamed columns (e.g. procpid to pid), but that's no problem).

Munin is installed from the EPEL repos, postgres from the official one. Both up to date.

When I try to run munin-node-configure --suggest, I get this output:

# The following plugins caused errors:
# postgres_bgwriter:
#   Junk printed to stderr
# postgres_cache_:
#   Junk printed to stderr
# postgres_checkpoints:
#   Junk printed to stderr
# postgres_connections_:
#   Junk printed to stderr
# postgres_connections_db:
#   Junk printed to stderr
# postgres_locks_:
#   Junk printed to stderr
# postgres_querylength_:
#   Junk printed to stderr
# postgres_scans_:
#   Junk printed to stderr
# postgres_size_:
#   Junk printed to stderr
# postgres_transactions_:
#   Junk printed to stderr
# postgres_tuples_:
#   Junk printed to stderr
# postgres_users:
#   Junk printed to stderr
# postgres_xlog:
#   Junk printed to stderr

After a lot of searching around, I edited /etc/munin/plugin-conf.d/munin-node and added the following:

[postgres*]
user postgres

This stops munin-node-configure complaining about stderr and lets me add the plugins, but when I telnet to the server on 4949 and try to fetch the stats, I just get "Bad exit". When I run the plugin individually via munin-run (e.g. munin-run postgres_size_ALL ), it works completely fine. Looking at /var/log/munin/munin-node.log, this is the output:

Error output from postgres_size_ALL:
    DBI connect('dbname=template1','',...)failed: could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"? at /usr/share/perl5/vendor_perl/Munin/Plugin/Pgsql.pm line 377
Service 'postgres_size_ALL exited with status 1/0.

I am now out of ideas... the socket definitely exists, and pg_hba.conf is set to allow all users/databases from localhost with trust.

© Server Fault or respective owner

Related posts about postgresql

Related posts about perl