[ZBX-4941] Zabbix server can't work without DBHost directive on PostgreSQL. Created: 2012 May 03 Updated: 2017 May 30 Resolved: 2012 May 08 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 1.8.10 |
Fix Version/s: | 2.0.0rc4 |
Type: | Incident report | Priority: | Minor |
Reporter: | max | Assignee: | dimir |
Resolution: | Fixed | Votes: | 0 |
Labels: | database | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
In zabbix_server.conf i see:
When i try to start daemon, i see error in log: 1674:20120427:120043.412 [Z3001] connection to database 'mon3' failed: [0] could not connect to server: Permission denied 1674:20120427:120043.412 Database is down. Reconnecting in 10 seconds. When i uncomment DBHost=localhost it's work fine. But why zabbix developers write this "# Default is localhost" if it not true and server can't work with default value of directive? |
Comments |
Comment by dimir [ 2012 May 07 ] |
What we have currently is we pass NULL to the postgresql function that connects to db. According to their docs in that case the library tries to connect to default socket if UNIX domain sockets are enabled otherwise "localhost" (see function PQconnectdb "host" parameter): http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT We decided to fix that to explicitly use "localhost" as host parameter if that is not specified in Zabbix configuration, just like the docs say. |
Comment by dimir [ 2012 May 08 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-4941 |
Comment by Alexander Vladishev [ 2012 May 08 ] |
(1) If DBName is empty an error occur: zabbix_server: db.c:114: zbx_db_connect: Assertion `((void *)0) != host && '\0' != *host' failed. <dimir> Great catch, I only tested without the parameter. With empty parameter (DBHost=) the assertion occurs, which is not correct. We decided to allow empty strings, in that case the behavior is based on appropriate DB library implementation. <dimir> RESOLVED in r27354 <Sasha> CLOSED |
Comment by Alexander Vladishev [ 2012 May 08 ] |
Successfully tested! Please review my changes in r27356. |
Comment by dimir [ 2012 May 09 ] |
(1) We decided to fix that only in 2.0 . For 1.8 these changes might lead to regression of current installations. For example, in case of PostgreSQL if no DBHost specified in configuration before this change zabbix would first try to connect to Unix domain socket before trying TCP to "localhost", after the changes it would always use TCP "localhost". <dimir> RESOLVED in development branch for 2.0: svn://svn.zabbix.com/branches/dev/ZBX-4941-TRUNK . These are merged from branch ZBX-4971 plus some minor changes, needs a review. <Sasha> TESTED |
Comment by dimir [ 2012 May 09 ] |
(2) We should update 1.8 docs to say that in case DBHost is not specified the connection method is based on used library implementation. <dimir> RESOLVED in http://www.zabbix.com/documentation/1.8/manual/processes/zabbix_proxy#configuration_file <martins-v> CLOSED |
Comment by dimir [ 2012 May 10 ] |
Fixed in pre-2.0.0 r27417. If DBHost parameter is missing in configuration it will be set to "localhost". Empty value is allowed, in this case the connection method (Unix domain socket, TCP etc.) is based on used backend library. E. g. in case of PostgreSQL if you would like to use Unix domain socket to connect to database DBHost should be set to empty string. Missing parameter will result in TCP connection to "localhost". In case of MySQL both empty string and missing parameter will result in attempt to use Unix domain socket. |