我在centOS 7上启动zabbix服务器时遇到了麻烦。
这是我尝试启动zabbix-server后得到的状态消息:
[root@monitor2:~] #systemctl status zabbix-server
zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled)
Active: failed (Result: start-limit) since Thu 2016-04-28 01:15:16 EDT; 20s ago
Process: 23744 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=killed, signal=SEGV)
Main PID: 31446 (code=exited, status=1/FAILURE)
Apr 28 01:15:16 monitor2 systemd[1]: zabbix-server.service: control process exited, code=killed status=11
Apr 28 01:15:16 monitor2 systemd[1]: Failed to start Zabbix Server.
Apr 28 01:15:16 monitor2 systemd[1]: Unit zabbix-server.service entered failed state.
Apr 28 01:15:16 monitor2 systemd[1]: zabbix-server.service holdoff time over, scheduling restart.
Apr 28 01:15:16 monitor2 systemd[1]: Stopping Zabbix Server...
Apr 28 01:15:16 monitor2 systemd[1]: Starting Zabbix Server...
Apr 28 01:15:16 monitor2 systemd[1]: zabbix-server.service start request repeated too quickly, refusing to start.
Apr 28 01:15:16 monitor2 systemd[1]: Failed to start Zabbix Server.
Apr 28 01:15:16 monitor2 systemd[1]: Unit zabbix-server.service entered failed state.
这就是我在zabbix服务器日志中看到的内容:
[root@monitor2:~] #tail /var/log/zabbix/zabbix_server.log
zabbix_server [24366]: [file:'log.c',line:271] lock failed: [43] Identifier removed
zabbix_server [24366]: [file:'log.c',line:271] lock failed: [43] Identifier removed
zabbix_server [24370]: [file:'log.c',line:271] lock failed: [43] Identifier removed
zabbix_server [24370]: [file:'log.c',line:271] lock failed: [43] Identifier removed
zabbix_server [24374]: [file:'log.c',line:271] lock failed: [43] Identifier removed
zabbix_server [24374]: [file:'log.c',line:271] lock failed: [43] Identifier removed
24378:20160428:011714.312 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
24378:20160428:011714.312 database is down: reconnecting in 10 seconds
19933:20160428:011714.593 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)
19933:20160428:011714.593 database is down: reconnecting in 10 seconds
这是我的/etc/zabbix/zabbix_server.conf文件:
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword='secret'
SNMPTrapperFile=/var/log/snmptt/snmptt.log
ListenIP=127.0.0.1
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
这是我的/etc/zabbix/web/zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '127.0.0.1';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'secret';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = 'zabbix.example.com';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'Zabbix';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>
我可以使用我在两个配置文件中列出的相同凭据连接到mysql数据库:
[root@monitor2:~] #mysql -uzabbix -p -h 127.0.0.1
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36326
Server version: 10.0.22-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
所以我不知道为什么zabbix服务器无法连接到数据库。
我很感激你的帮助!
答案 0 :(得分:1)
对我来说,问题是在/etc/zabbix/zabbix_server.conf
中,我在实际密码周围设置了DBPassword
参数和(双)引号。
配置必须是:
DBPassword=ZABBIX_DB_PASSWORD
而不是:
DBPassword="ZABBIX_DB_PASSWORD"