首先,我正在运行CentOS 6.5并尝试使用Zabbix 2.2.4.任何主机名都已替换为示例.
原文链接:https://www.f2er.com/php/139100.html我已将以下RPM安装到我的Zabbix机器上(主机名为zbx-hostname):
zabbix-java-gateway-2.2.4-1.el6.x86_64 zabbix-web-2.2.4-1.el6.noarch zabbix-agent-2.2.4-1.el6.x86_64 zabbix-server-2.2.4-1.el6.x86_64 zabbix-2.2.4-1.el6.x86_64 zabbix-web-pgsql-2.2.4-1.el6.noarch zabbix-server-pgsql-2.2.4-1.el6.x86_64
我的Postgresql机器安装了带有RPMS的postgresql 9.2(主机名将是db-hostname):
postgresql92-9.2.8-1PGDG.rhel6.x86_64 postgresql92-libs-9.2.8-1PGDG.rhel6.x86_64 postgresql92-server-9.2.8-1PGDG.rhel6.x86_64
我的zabbix_server.conf文件如下所示:
LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=0 PidFile=/var/run/zabbix/zabbix_server.pid DBHost=db-hostname DBName=zabbix-dbname DBUser=zabbix-user DBPassword=zabbix-password DBSocket= DBPort=5432
我的zabbix PHP配置如下:
$DB['TYPE'] = 'POSTGREsql'; $DB['SERVER'] = 'db-hostname'; $DB['PORT'] = '5432'; $DB['DATABASE'] = 'zabbix-dbname'; $DB['USER'] = 'zabbix-user'; $DB['PASSWORD'] = 'zabbix-password'; // SCHEMA is relevant only for IBM_DB2 database $DB['SCHEMA'] = ''; $ZBX_SERVER = 'localhost'; $ZBX_SERVER_PORT = '10051'; $ZBX_SERVER_NAME = ''; $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; ?>
export PGPASSWORD=zabbix; psql -U zabbix-user -d zabbix-dbname -h db-hostname export PGPASSWORD=zabbix; psql -U zabbix-user -d zabbix-dbname -h 192.168.0.1
但zabbix拒绝连接打印输出(192.168.0.1是正确解析的IP地址):
25015:20150205:112656.236 [Z3001] connection to database 'zabbix-dbname' Failed: [0] could not connect to server: Permission denied Is the server running on host "db-hostname" (192.168.0.1) and accepting TCP/IP connections on port 5432? 25015:20150205:112656.236 Database is down. Reconnecting in 10 seconds.
但是在我监控TCP流量的数据库主机上,我没有看到任何传入连接(同时使用tcpdump和iptables).看来zabbix甚至没有尝试向数据库框发出请求?