Ad Widget

Collapse

Fresh install on dedicated server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AndreaACME
    Junior Member
    • May 2016
    • 7

    #1

    Fresh install on dedicated server

    Hi, I have just installed Zabbix 3.0.2 on a fresh virtual machine (vSphere 6.0) CentOS7 + PostegreSQL 9.5
    I run through first web/frontend setup and all pre-requisites are met.
    At "Configure DB connection" page I get error:
    Code:
    Cannot connect to the database
    On the server (/var/log/zabbix/zabbix_server.log) I have this:

    Code:
     14886:20160509:090321.221 SSH2 support:              YES
     14886:20160509:090321.221 IPv6 support:              YES
     14886:20160509:090321.221 TLS support:               YES
     14886:20160509:090321.221 ******************************
     14886:20160509:090321.221 using configuration file: /etc/zabbix/zabbix_server.conf
     14886:20160509:090321.227 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR:  relation "users" does not exist
    LINE 1: select userid from users limit 1
                               ^
     [select userid from users limit 1]
     14886:20160509:090321.227 cannot use database "zabbix": database is not a Zabbix database
    Postgres tables have been loaded correctly:

    Code:
    -bash-4.2$ psql -h 10.x.x.xxx -Uzabbix zabbix
    Password for user zabbix:
    psql (9.5.2)
    Type "help" for help.
    
    zabbix=> select userid from users limit 1;
    
     userid
    --------
          1
    (1 row)

    Any help?

    Thanks
    Last edited by AndreaACME; 30-05-2016, 13:18. Reason: hidden ip
  • AndreaACME
    Junior Member
    • May 2016
    • 7

    #2
    Zabbix now works. Sounds great doesn't it...

    Comment

    • bpxy240
      Junior Member
      • May 2016
      • 1

      #3
      Hi,

      I'm having the same issue, what did you do to resolve this?

      Thanks

      Comment

      • AndreaACME
        Junior Member
        • May 2016
        • 7

        #4
        Originally posted by bpxy240
        Hi,

        I'm having the same issue, what did you do to resolve this?

        Thanks
        I posted this same issue in the online IRC chat and nobody could solve it. They all told me that I was loading the wrong DB files.... (which was bullshit of course) because the files THEY gave me were exactly the same SQL commands (only divided into 3 files instead of the single GZ that came with my installation).

        To solve it? I installed Zabbix Server on MySQL, it all went fine.

        I left that open reply just to see if anyone (other than other poor users with the same problem) would reply with a meaningful answer.

        Good luck!

        Comment

        • Atsushi
          Senior Member
          • Aug 2013
          • 2028

          #5
          It will introduce a sample installation procedure.
          This is an example of building a DB to the local.

          Install Zabbix modules :

          Code:
          # yum install http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
          # yum install zabbix-agent zabbix-server-pgsql zabbix-web-pgsql
          Install PostgreSQL 9.5 Server :

          Code:
          # yum install https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
          # yum install postgresql95-server
          # /usr/pgsql-9.5/bin/postgresql95-setup initdb
          # systemctl start postgresql-9.5
          # systemctl enable postgresql-9.5
          Setting password for postgres :

          Code:
          # su - postgres
          $ psql -c "alter user postgres with password 'password'"
          Create user and database :

          Code:
          $ createuser zabbix -P -S -R -D
          $ createdb -O zabbix -E UTF8 zabbix
          Change access settings :

          Code:
          # pushd /var/lib/pgsql/9.5/data/
          # vi pg_hba.conf
          # systemctl restart postgresql-9.5
          Create tables and load initial data :

          Code:
          # zcat /usr/share/doc/zabbix-server-pgsql-3.0.3/create.sql.gz | /usr/pgsql-9.5/bin/psql -U zabbix zabbix -W
          Settings for DB access for zabbix_server :

          Code:
          # vi /etc/zabbix/zabbix_server.conf
          Change DBPassword & DBPort.

          Setting timezone for httpd(PHP) :

          Code:
          # vi /etc/httpd/conf.d/zabbix.conf
          Daemons start :

          Code:
          # systemctl start zabbix-agent
          # systemctl start zabbix-server
          # systemctl start httpd
          # systemctl enable zabbix-agent
          # systemctl enable zabbix-server
          # systemctl enable httpd

          ex.
          pg_hba.conf diff
          Code:
          --- pg_hba.conf.orig    2016-05-30 18:37:19.969000000 +0900
          +++ pg_hba.conf 2016-05-30 18:46:15.213000000 +0900
          @@ -77,11 +77,11 @@
           # TYPE  DATABASE        USER            ADDRESS                 METHOD
          
           # "local" is for Unix domain socket connections only
          -local   all             all                                     peer
          +local   all             all                                     trust
           # IPv4 local connections:
          -host    all             all             127.0.0.1/32            ident
          +host    all             all             127.0.0.1/32            trust
           # IPv6 local connections:
          -host    all             all             ::1/128                 ident
          +host    all             all             ::1/128                 trust
           # Allow replication connections from localhost, by a user with the
           # replication privilege.
           #local   replication     postgres                                peer

          Comment

          • AndreaACME
            Junior Member
            • May 2016
            • 7

            #6
            Those steps were exactly what I performed with Postgres install, except for the last config in pg_hba.conf where I had my entries with "Method" = md5 instead of trust (as you write).

            Could that have been the only problem?


            Regards.
            Last edited by AndreaACME; 30-05-2016, 13:35. Reason: wrong method

            Comment

            • Atsushi
              Senior Member
              • Aug 2013
              • 2028

              #7
              If the difference of the access method is the cause, you will not be able to access the database.
              So that error had been in the SQL execution, it would be a high possibility of another cause.

              Perhaps database of the destination was different.
              Attention to the setting of the destination database is required.
              ex. DBHost, DBName, DBUser, DBPort in zabbix_server.conf

              Comment

              • AndreaACME
                Junior Member
                • May 2016
                • 7

                #8
                Yesterday evening, I has come spare time and brought up the old snapshot of the Postgres just to try that ..... no luck. That was not the problem.

                Still a mistery!

                Comment

                • mcielavs
                  Junior Member
                  • Oct 2015
                  • 5

                  #9
                  I have a similar problem .
                  DB I installed on a different host . zabbix_server.conf swapped file entries :
                  DBHost =
                  DBname =
                  DBUser =
                  DBPassword =
                  but when I participated Zabbix then there is an error :

                  4786:20160630:151302.292 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR: relation "users" does not exist
                  LINE 1: select userid from users limit 1
                  ^
                  [select userid from users limit 1]
                  4786:20160630:151302.293 cannot use database "zabbix": database is not a Zabbix database

                  where could be the problem?

                  Comment

                  • AndreaACME
                    Junior Member
                    • May 2016
                    • 7

                    #10
                    Originally posted by mcielavs
                    I have a similar problem .
                    DB I installed on a different host . zabbix_server.conf swapped file entries :
                    DBHost =
                    DBname =
                    DBUser =
                    DBPassword =
                    but when I participated Zabbix then there is an error :

                    4786:20160630:151302.292 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR: relation "users" does not exist
                    LINE 1: select userid from users limit 1
                    ^
                    [select userid from users limit 1]
                    4786:20160630:151302.293 cannot use database "zabbix": database is not a Zabbix database

                    where could be the problem?
                    Nobody seems to know, I still cannot find an answer.

                    My quick solution was to use MySQL instead of Postgres.

                    Regards.

                    Comment

                    • mcielavs
                      Junior Member
                      • Oct 2015
                      • 5

                      #11
                      Originally posted by AndreaACME
                      Nobody seems to know, I still cannot find an answer.

                      My quick solution was to use MySQL instead of Postgres.

                      Regards.
                      Do you install zabbix db and app on single server or on diferent servers?

                      I have problem with mysql to.
                      With workbench I can conect to db server, in zabbix log I see :

                      connection to database 'zabbix' failed: [0] received invalid response to SSL negotiation: J

                      SSL is disabled on MYSQL...
                      Also can not access to zabbix from web broser.


                      With PGSQL was the same - with pgadmin had access to db.

                      Comment

                      • AndreaACME
                        Junior Member
                        • May 2016
                        • 7

                        #12
                        Zabbix was installed on single together with its Postgres DB (same goes for the fresh install with MariaDB; present working config).

                        Connection to both Postgres and MariaDB is possible but Zabbix Server cannot connect to the DB when started (see errors in my posts above).

                        The only web page I could access was the setup one, I never got to entering the actual Zabbix Web interface (neither the login prompt).

                        Comment

                        • mcielavs
                          Junior Member
                          • Oct 2015
                          • 5

                          #13
                          My zabbix wit PGSQL now works
                          my instalation steps:

                          app-server:

                          rpm -Uvh https://dl.fedoraproject.org/pub/epe...t-6.noarch.rpm
                          rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
                          yum install php56w php56w-opcache
                          php -v
                          vi /etc/php.ini
                          yum install epel-release
                          yum list pgadmin*
                          yum install pgadmin3.x86_64
                          rpm -ivh http://repo.zabbix.com/zabbix/3.0/rh...el6.noarch.rpm
                          yum install zabbix-server-pgsql zabbix-web-pgsql

                          db-server:

                          rpm -Uvh https://download.postgresql.org/pub/...5-2.noarch.rpm
                          yum install postgresql95-server postgresql95-contrib
                          service postgresql-9.5 initdb
                          service postgresql-9.5 start
                          su - postgres
                          psql
                          CREATE DATABASE zabbix WITH ENCODING='UTF-8';
                          CREATE USER zabbix WITH PASSWORD 'zabbix';
                          GRANT ALL PRIVILAGES ON DATABASE zabbix To zabbix
                          \q
                          exit
                          yum install epel-release
                          yum list pgadmin*
                          yum install pgadmin3.x86_64
                          rpm -Uvh http://repo.zabbix.com/zabbix/3.0/rh...el6.noarch.rpm
                          yum list zabbix-agent*
                          yum install zabbix-agent.x86_64

                          app - server

                          cat /usr/share/doc/zabbix-server-pgsql-3.0.4/create.sql.gz | psql -U zabbix -h db-server_IP -p zabbix
                          yum install zabbix-agent.x86_64
                          yum install php56w-bcmath.x86_64 php56w-dba.x86_64 php56w-gd.x86_64 php56w-intl.x86_64 php56w-mbstring.x86_64 php56w-pdo.x86_64 php56w-pgsql.x86_64 php56w-xml.x86_64
                          service zabbix-server start
                          service zabbix-agent start



                          + disable SELINUX
                          + config zabbix_server.conf (/etc/zabbix)
                          + config pg_hba.con (/var/lib/pgsql/9.5/data)
                          + coppy and config zabbix.conf (copy from -/usr/share/doc/zabbix-web-3.0.4)

                          Comment

                          • jeffstoner
                            Junior Member
                            • Oct 2016
                            • 1

                            #14
                            I came across this same issue. This is how I fixed it:

                            - in /etc/zabbix/zabbix_server.conf, do NOT set DBSchema to anything (leave it blank.)

                            To run with SELinux enabled, you need to turn on some booleans:

                            Code:
                            # setsebool -P httpd_can_network_connect_db=true httpd_can_network_connect=true

                            Comment

                            • fjvillegas
                              Junior Member
                              • Sep 2017
                              • 1

                              #15
                              A little bit late but hope it helps

                              I had the same error while trying to install from source code.

                              My mistake was that within the zabbix_server.conf file I declared the DBSchema variable to zabbix. I did that because somehow understood that PostgreSQL will need the variable.

                              The zabbix_server.log file just mentions the failure of the select statement but it doesn't mention that there is no DBSchema zabbix. The database is zabbix and the Schema are: public (which Zabbix uses for its installation) and the postgresql (base used at the createdb statement)

                              I proceed to comment the #DBSchema variable and restart the zabbix_server and thats it!

                              Comment

                              Working...