zabbix server won't start - database error

bluethundr picture bluethundr · Apr 28, 2016 · Viewed 15.7k times · Source

I'm having trouble starting zabbix server on centOS 7.

This is the status message I get after trying to start 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.

And this is what I see in the zabbix server log:

[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

This is my /etc/zabbix/zabbix_server.conf file:

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

And this is my /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;
?>

And I can connect to the mysql database using the same credentials as I have listed in both config files:

[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.

So I don't know why the zabbix server fails to connect to the database.

I'd appreciate some help on this!

Answer

fleuryc picture fleuryc · May 26, 2016

For me, the problem was that in /etc/zabbix/zabbix_server.conf, I had set the DBPassword parameter with (double) quotes around the actual password.


The configuration must be :

DBPassword=ZABBIX_DB_PASSWORD

And not :

DBPassword="ZABBIX_DB_PASSWORD"