Ad Widget

Collapse

Zabbix 5 LTS frontend connection failure to Azure Postgresql database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aeiffel
    Junior Member
    • Feb 2019
    • 4

    #1

    Zabbix 5 LTS frontend connection failure to Azure Postgresql database

    Hi all

    New Zabbix installed from packages on Ubuntu Server 20.04.

    Followed all steps from https://www.zabbix.com/download?zabb...resql&ws=nginx

    I am able to connect to the Azure postgresql database using postgres CLI.

    However, when running the Frontend setup wizard, I get:
    Database error
    • Error connecting to database. Connection is not secure.


    I am however able to configure the relevant DB parameters in zabbix_server.conf just fine, and the backend server connects to Azure successfully.

    So something is different about the the frontend php connectivity.

    My php config is as follows:

    <?php
    // Zabbix GUI configuration file.

    $DB['TYPE'] = 'POSTGRESQL';
    $DB['SERVER'] = 'myzabbixdb.postgres.database.azure.com';
    $DB['PORT'] = '5432';
    $DB['DATABASE'] = 'zabbix';
    $DB['USER'] = 'zabbix@myzabbixdb';
    $DB['PASSWORD'] = 'mypassword';

    // Schema name. Used for PostgreSQL.
    $DB['SCHEMA'] = '';

    // Used for TLS connection.
    $DB['ENCRYPTION'] = true;
    $DB['KEY_FILE'] = '';
    $DB['CERT_FILE'] = '';
    $DB['CA_FILE'] = '/usr/share/zabbix/BaltimoreCyberTrustRoot.crt.pem';
    $DB['VERIFY_HOST'] = true;
    $DB['CIPHER_LIST'] = '';

    // Use IEEE754 compatible value range for 64-bit Numeric (float) history values.
    // This option is enabled by default for new Zabbix installations.
    // For upgraded installations, please read database upgrade notes before enabling this option.
    $DB['DOUBLE_IEEE754'] = true;

    $ZBX_SERVER = 'localhost';
    $ZBX_SERVER_PORT = '10051';
    $ZBX_SERVER_NAME = 'zabbixserver';

    $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;


    Any help would be appreciated!
  • aeiffel
    Junior Member
    • Feb 2019
    • 4

    #2
    I found the problem in the php source code.

    In PostgresqlDbBackend.php there is a comparison within the isConnectionSecure function that is using a less than operator ("<") when it should be greater than (">").

    Changing it to > fixed my problem!

    public function isConnectionSecure() {
    $row = DBfetch(DBselect('SHOW server_version'));
    $is_secure = false;

    if (version_compare($row['server_version'], '9.5', '<')) {
    $row = DBfetch(DBselect('SHOW ssl'));
    $is_secure = ($row && $row['ssl'] === 'on');

    Maybe this will help someone else..

    Comment

    • highpeak
      Member
      • Nov 2019
      • 30

      #3
      Big help for me, thank you very much. BTW - we had issues with Azure's implementation of Timescale DB - it's based on the Apache license and does not support some of the features required for Zabbix v5.4 so we had to move to a VM-based Postgres instance instead.

      Comment

      Working...