我正在尝试用PostgreSQL9.1和9.2在服务器上设置Munin来收集统计数据(服务器目前正在运行9.1,已经用9.2在一个新的VM上进行了测试,以排除运行服务器上的一些奇怪问题。由于重命名的列(例如procpid到pid),我不得不为9.2修复一些插件,但这是没有问题的。
穆宁是从EPEL repos安装的,postgres是从官方安装的。都是最新的。
当我尝试运行munin节点--配置--建议时,我得到了以下输出:
# 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经过大量搜索,我编辑了/etc/munin/plugin.d/munin节点,并添加了以下内容:
[postgres*]
user postgres这就停止了munin-节点配置对stderr的抱怨,并允许我添加插件,但是当我在4949登录到服务器并尝试获取数据时,我只会得到“坏退出”。当我通过munin(例如munin postgres_size_ALL )单独运行插件时,它完全可以正常工作。查看/var/log/munin/munin-node.log,这是输出:
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.我现在没有主意了..。套接字绝对存在,并且pg_hba.conf被设置为允许所有用户/数据库从本地主机获得信任。
发布于 2012-09-17 12:03:52
原来SELinux阻止了对套接字的访问。
setsebool -P allow_user_postgresql_connect on发布于 2013-04-07 19:21:56
我也有这个问题,但我不使用SELinux。在我的系统(Gentoo Linux)中,PostgreSQL UNIX套接字受组权限的保护,所有想要访问该套接字的用户都必须在组postgres中。我的用户munin已经是postgres的成员了(因此,所有的事情都可以从一个shell中得到很好的运行),但是事实证明,Munin是那些没有隐含地应用用户组的程序之一。在插件配置文件中同时设置user munin和group postgres解决了这个问题。
https://serverfault.com/questions/427474
复制相似问题