Ad Widget

Collapse

Zabbix 2.4 Frontend + PostgreSQL 9.4

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ostry
    Junior Member
    • May 2014
    • 7

    #1

    Zabbix 2.4 Frontend + PostgreSQL 9.4

    Hello,

    I have problem with configuration of Frontend 2.4 with PostgreSQL 9.4, could somebody direct me the right way to troubleshoot it? Thanks in advance!

    Environment:
    * CentOS 6.6 (Final)
    * Zabbix 2.4 installed by yum according to this: https://www.zabbix.com/documentation..._from_packages
    * PostgreSQL 9.4 installed by youm according to this: https://wiki.postgresql.org/wiki/YUM_Installation

    Database created as instructed, Zabbix server up and running, connected to database, as I see in zabbix_server.log. But I am unable to successfully test the connection when setting up frontend. "Configure DB connection" is the same as in zabbix_server.conf:
    * Database type: PostgreSQL
    * Database host: tried empty field, localhost and server IP address
    * Database port: tried 0 (default) and 5432
    * Database name: zabbix_db
    * Database schema: tried empty field and public
    * User: zabbix_user
    * Password: the same as in zabbix_server.conf

    But still having Fail (Error connecting to database.) with no further description. I don't now how to troubleshoot it further, please help. I have a hypothesis that php-pgsql 5.3.3-40.el6_6 is not compatible with new PosgtreSQL 9.4, but I am not well with PHP and by googling I did not succeed to confirm or refute this hypothesis.

    Please, could somebody give me an advice where (in which log file) can I find more detailed error message to find exact cause of the failure?

    Thanks in advance.

    Jano
  • tchjts1
    Senior Member
    • May 2008
    • 1605

    #2
    I'm a MySql user, but I can give you some pointers.

    Database host: This field I use the IP of my Zabbix DB server
    Database port: I use whatever the standard port is for MySql. 3306 I think.
    Database schema: Not used by MySql. I think also not used by PostgreS

    As for troubleshooting with logs, on your Zabbix App server, find zabbix_server.log and you should see some entries detailing why it can't connect to the DB. You should see something like - connection to database 'zabbix' failed: and then some details about why it is failing.

    I see a fair number of issues getting the DB user and Password settings correctly specified on new installations. But I also think you definitely need to define your database host and database port.

    Also - check the file zabbix.conf.php as this is where the configuration of DB information goes and will look something like this: (MySql example)

    $DB['TYPE'] = 'MYSQL';
    $DB['SERVER'] = '123.45.67.89';
    $DB['PORT'] = '3306';
    $DB['DATABASE'] = 'zabbix';
    $DB['USER'] = 'zabbix';
    $DB['PASSWORD'] = 'MySuperSecretPW';

    // SCHEMA is relevant only for IBM_DB2 database
    $DB['SCHEMA'] = '';

    $ZBX_SERVER = '123.45.67.88';
    $ZBX_SERVER_PORT = '10051';
    $ZBX_SERVER_NAME = 'Whatever name you want to show in the top right corner of Zabbix GUI';

    $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
    ?>

    Comment

    • Ostry
      Junior Member
      • May 2014
      • 7

      #3
      thanks tchjts1 for trying to help me, I appreciate it

      I am not having failures in zabbix_server.log, server seems to be running OK, I "just" have problem with frontend and I consider frontend is not logging here, but somewhere else (but I don't know where - knowing that would also help me)

      my db name, user and password are correct, I am sure of it, I know PostgreSQL very well, I configured and tested it successfully and Zabbix server is connecting correctly

      I hadn't zabbix.conf.php (only /usr/share/zabbix/conf/zabbix.conf.php.example), because it should be created by setup.php, but I was unable to go through DB connection configuration test

      now created /etc/zabbix/web/zabbix.conf.php manually, but still having error message when accessing the frontend: Zabbix 2.4.4 Database error Error connecting to database. - nothing else to know WHY it can't connect

      the contents of this config. file is now:

      <?php
      // Zabbix GUI configuration file.
      global $DB;

      $DB["TYPE"] = 'POSTGRESQL';
      $DB["SERVER"] = 'localhost';
      $DB["PORT"] = '0';
      $DB["DATABASE"] = 'zabbix_db';
      $DB["USER"] = 'zabbix_user';
      $DB["PASSWORD"] = '<SECRET>';
      // Schema name. Used for IBM DB2 and PostgreSQL.
      $DB["SCHEMA"] = '';

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

      $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
      ?>

      I tried also empty string as $DB["PORT"], but with no success

      any ideas?

      thanks in advance

      Jano

      Comment

      • tchjts1
        Senior Member
        • May 2008
        • 1605

        #4
        Jano - Have you tried using IP addresses as I suggested instead of using "localhost"? localhost should work, provided you have the DB on the same box as the Zabbix App server, but I still use IP's out of habit.

        Also, I am not familiar with the CentOS build, but does it have SELinux? If so, you may need to set SELinux to "Permissive". That may be preventing the connection you are looking for. There are other more granular ways to deal with SELinux. Do a search on the forums here for "SELinux" as it has been discussed several times.

        Jeff

        EDIT: Ingus addresses it here: https://www.zabbix.com/forum/showthr...hlight=selinux

        And then if that doesn't work, perhaps this can provide some clues. I know this is for Oracle, but maybe there is a similar need for PostgreS? https://www.zabbix.com/forum/showpos...0&postcount=10
        Last edited by tchjts1; 31-03-2015, 02:53.

        Comment

        • Ostry
          Junior Member
          • May 2014
          • 7

          #5
          tchjts1, great, thank you! SELinux was it and this command has helped:

          setenforce permissive
          (no restart needed)

          these commands seemed to have not effect on this issue:

          setsebool -P zabbix_can_network=true
          setsebool -P httpd_can_network_connect=true

          so I have let these SELinux parameters off

          IP adress wasn't needed in this case and the working configuration of Zabbix Frontend (/etc/zabbix/web/zabbix.conf.php) is:

          <?php
          // Zabbix GUI configuration file.
          global $DB;

          $DB["TYPE"] = 'POSTGRESQL';
          $DB["SERVER"] = '';
          $DB["PORT"] = '0';
          $DB["DATABASE"] = 'zabbix_db';
          $DB["USER"] = 'zabbix_user';
          $DB["PASSWORD"] = '<SECRET>';
          // Schema name. Used for IBM DB2 and PostgreSQL.
          $DB["SCHEMA"] = '';

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

          $IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
          ?>

          thanks again!

          Comment

          • tchjts1
            Senior Member
            • May 2008
            • 1605

            #6
            Originally posted by Ostry
            tchjts1, great, thank you! SELinux was it and this command has helped:

            setenforce permissive
            (no restart needed)

            so I have let these SELinux parameters off

            thanks again!
            Excellent. Always glad when an issue gets resolved. For what it is worth, I have SELinux set to permissive as well.

            Comment

            • ds2000
              Junior Member
              • May 2015
              • 1

              #7
              Thanks for this post; I had exactly the same issues with my Dev build.

              Comment

              • Ostry
                Junior Member
                • May 2014
                • 7

                #8
                Originally posted by tchjts1
                Excellent. Always glad when an issue gets resolved. For what it is worth, I have SELinux set to permissive as well.
                In addition, I've set it permanently by SELINUX=enforcing in /etc/selinux/config. Now also after reboot everything OK.

                Comment

                Working...