Zabbix 3.0 + GC Cloud SQL : PGSQL v9.6 DB : ERROR CONNECTING TO DATABASE
-
Hello
I am not sure if anyone have try this before.
Currently, I'm trying to create a Zabbix 3.0 Server inside my Google Cloud (GC) Compute Engine. The DB will be using a PostgreSQL v9.6 DB instances that is created inside GC Cloud SQL.
Soo basically, there is two server. One for Zabbix Server and One for the PostgreSQL DB instances.
The zabbix server can connect to the server just fine by using the following command:
- psql -h <PGSQL IP> -U postgres
I have created a zabbix user, zabbix db inside the postgresql instances. I have also run
- zcat create.sql.gz | psql -h 35.200.156.83 -U zabbix -d zabbix
inside
- /usr/share/doc/zabbix-server-pgsql-3.0.4/
My config in "/etc/zabbix/zabbix_server.conf" is pretty much the basic setup which is:
DBHost=localhost
DBUser=zabbix
DBName=zabbix
DBPassword=password
DBPort=5432Then I try to go into browser and initialize the installation process via the "zabbix_server_ip/zabbix" and it all goes well until I get the following error:
Soo my question is, does anyone know what is wrong? Is it because my DB is not inside the Zabbix Server itself?
Also, have anyone try this before?Thanks
-
In your screenshot, you have database host : Localhost. You should change it to your postgresql host, i believe the 35.200.156.83
Also i don't know if your OS is equiped with SELinux, but it could be that you need to alter the SElinux config to allow http and php to communicatie to your database. For mysql you need the following selinux configs :
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1 -
Your Databse host should be 35.200.156.83 (or <PGSQL IP>) as per your sql import statement.
-
@ignaceq said in Zabbix 3.0 + GC Cloud SQL : PGSQL v9.6 DB : ERROR CONNECTING TO DATABASE:
In your screenshot, you have database host : Localhost. You should change it to your postgresql host, i believe the 35.200.156.83
Also i don't know if your OS is equiped with SELinux, but it could be that you need to alter the SElinux config to allow http and php to communicatie to your database. For mysql you need the following selinux configs :
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_can_network_connect_db 1Yup! Localhost is the Zabbix Sever, if your Zabbix Server doesn't have Postgresql then you need to use the remote Postgresql server.
-
Hello Guys
Thanks for the advice.
It is working now
What I did was change the information inside "/etc/zabbix/zabbix_server.cnf" as follows:
DBHost=35.200.156.83 (The PGSQL IP)
DBUser=zabbix
DBName=zabbix
DBPassword=password
DBPort=5432And change localhost in the installation page to the pgsql IP as well and it works.
Thanks Guys