Ad Widget

Collapse

Fresh Zabbix Server 5.4 install will not connect to PostgreSQL server

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • indgy
    Junior Member
    • Nov 2021
    • 3

    #1

    Fresh Zabbix Server 5.4 install will not connect to PostgreSQL server

    I have installed Zabbix Server 5.4 from packages and setup a PostgreSQL database with the schema and data from the package SQL files.

    Everything looks okay on the database side I have 166 tables in the public schema.

    I can connect to the Postgres server from the Zabbix server host just fine using psql:

    psql -h 192.168.1.141 -U zabbix -d zabbix

    psql (13.5, server 13.4)
    Type "help" for help.

    zabbix=>\dt

    List of relations
    Schema | Name | Type | Owner
    --------+----------------------------+-------+--------
    public | acknowledges | table | zabbix
    public | actions | table | zabbix
    public | alerts | table | zabbix
    public | auditlog | table | zabbix
    public | auditlog_details | table | zabbix
    public | autoreg_host | table | zabbix
    public | conditions | table | zabbix
    public | config | table | zabbix
    public | config_autoreg_tls | table | zabbix
    public | corr_condition | table | zabbix
    public | corr_condition_group | table | zabbix
    public | corr_condition_tag | table | zabbix
    ... continues...



    I have changed the following in the zabbix_server.conf file

    DBHost=192.168.1.141
    DBName=zabbix
    DBSchema=public
    DBUser=zabbix
    DBPassword=password
    # DBSocket=
    DBPort=65432


    When I start the server I see this in the logs

    Code:
    90070:20211124:124145.141 Starting Zabbix Server. Zabbix 5.4.7 (revision 84dc2ec5dc).
    90070:20211124:124145.141 ****** Enabled features ******
    90070:20211124:124145.141 SNMP monitoring: YES
    90070:20211124:124145.141 IPMI monitoring: NO
    90070:20211124:124145.141 Web monitoring: YES
    90070:20211124:124145.141 VMware monitoring: NO
    90070:20211124:124145.141 SMTP authentication: YES
    90070:20211124:124145.141 ODBC: YES
    90070:20211124:124145.141 SSH support: NO
    90070:20211124:124145.141 IPv6 support: YES
    90070:20211124:124145.141 TLS support: YES
    90070:20211124:124145.141 ******************************
    90070:20211124:124145.141 using configuration file: /usr/local/etc/zabbix54/zabbix_server.conf

    However I keep getting the following error:

    Code:
    [
    Z3001] connection to database 'zabbix' failed: [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 0
    database is down: reconnecting in 10 seconds

    Why is Zabbix looking for a MySQL server? Where do I need to configure the Postgres server?
  • Answer selected by indgy at 24-11-2021, 18:37.
    indgy
    Junior Member
    • Nov 2021
    • 3

    Turns out my Zabbix server package did not have support for PostgreSQL out of the box, I had to recompile it to support Postgres and it's all working now.

    Comment

    • indgy
      Junior Member
      • Nov 2021
      • 3

      #2
      I have setup a Percona MySQL server and the server and frontend are both working with just these changes in the config.

      < DBHost=192.168.1.141
      > DBHost=192.168.1.189

      < DBSchema=public
      > DBSchema=

      < DBPort=65432
      > DBPort=3306


      If I change the php frontend config to use the Postgres details it can connect but shows the server as inactive.

      Comment

      • indgy
        Junior Member
        • Nov 2021
        • 3

        #3
        Turns out my Zabbix server package did not have support for PostgreSQL out of the box, I had to recompile it to support Postgres and it's all working now.

        Comment

        • cyber
          Senior Member
          Zabbix Certified SpecialistZabbix Certified Professional
          • Dec 2006
          • 4807

          #4
          If you install from packages, you are supposed to choose the ones suitable for your DB. That's why you have "zabbix-server-mysql..." and "zabbix-server-pgsql..." packages available. Same for web frontend packages.

          Comment

          Working...