Ad Widget

Collapse

DB schema where?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • glibao
    Junior Member
    • Oct 2022
    • 9

    #1

    DB schema where?

    Good afternoon, I can't finish starting zabbix because I have an error, from what I've seen the create.sql.gz file doesn't exist and the DB schema is not imported, where can I download that file? Thank you

    # zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
    gzip: /usr/share/zabbix-sql-scripts/mysql/server.sql.gz: No such file or directory ?¿?¿?¿?¿?¿?¿?¿?¿
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    What platform and version are you using? Have you installed the zabbix-sql-scripts package?

    Comment

    • ripperSK
      Member
      • Jul 2019
      • 42

      #3
      as @Atsushi​ pointed out - zabbix has changed how these SQL files are installed somewhere between version 5 and 6 - these files are now all contained within package
      Code:
      zabbix-sql-scripts
      .

      Please refer to official zabbix installation manual https://www.zabbix.com/documentation..._from_packages for more details.

      Comment

      • glibao
        Junior Member
        • Oct 2022
        • 9

        #4
        Thanks to the 2 for responding, yes I have faithfully followed the official documentation, I use Ubuntu 22 and zabbix 6.2
        # apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

        Zabbix server log :​

        262146:20221113:201553.946 Starting Zabbix Server. Zabbix 6.2.3 (revision 98ee88fc19d).
        262146:20221113:201553.946 ****** Enabled features ******
        262146:20221113:201553.946 SNMP monitoring: YES
        262146:20221113:201553.946 IPMI monitoring: YES
        262146:20221113:201553.946 Web monitoring: YES
        262146:20221113:201553.946 VMware monitoring: YES
        262146:20221113:201553.946 SMTP authentication: YES
        262146:20221113:201553.946 ODBC: YES
        262146:20221113:201553.946 SSH support: YES
        262146:20221113:201553.946 IPv6 support: YES
        262146:20221113:201553.946 TLS support: YES
        262146:20221113:201553.946 ******************************
        262146:20221113:201553.946 using configuration file: /etc/zabbix/zabbix_server.conf
        262146:20221113:201553.951 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?)

        Zabbix agent log :​

        3973:20221106:114942.666 Got signal [signal:15(SIGTERM),sender_pid:28634,sender_uid:114 ,reason:0]. Exiting ...
        3973:20221106:114942.669 Zabbix Agent stopped. Zabbix 6.2.3 (revision 98ee88fc19d).
        690:20221106:114957.486 Starting Zabbix Agent [Zabbix server]. Zabbix 6.2.3 (revision 98ee88fc19d).
        690:20221106:114957.488 **** Enabled features ****
        690:20221106:114957.488 IPv6 support: YES
        690:20221106:114957.488 TLS support: YES
        690:20221106:114957.488 **************************
        690:20221106:114957.488 using configuration file: /etc/zabbix/zabbix_agentd.conf
        690:20221106:114957.488 agent #0 started [main process]
        691:20221106:114957.511 agent Home started [collector]
        692:20221106:114957.512 agent Forum started[listener #1]
        693:20221106:114957.539 agent #3 started[listener #2]
        694:20221106:114957.563 agent #4 started[listener #3]
        695:20221106:114957.592 agent #5 started [active checks #1]
        695:20221106:114957.635 Unable to connect to [127.0.0.1]:10051 [cannot connect to [[127.0.0.1]:10051]: [111] Connection refused]
        695:20221106:114957.635 Unable to send heartbeat message to [127.0.0.1]:10051 [cannot connect to [[127.0.0.1]:10051]: [111] Connection refused]
        695:20221106:114957.635 Unable to connect to [127.0.0.1]:10051 [cannot connect to [[127.0.0.1]:10051]: [111] Connection refused]

        Last edited by glibao; 13-11-2022, 22:27.

        Comment

        • ripperSK
          Member
          • Jul 2019
          • 42

          #5
          please follow the install instructions for SQL too:

          HERE

          mainly this part:


          Create initial database


          Documentation

          Code:
          ​
          
          Make sure you have database server up and running.
          
          Run the following on your database host.
          # mysql -uroot -p
          password
          mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
          mysql> create user zabbix@localhost identified by 'password';
          mysql> grant all privileges on zabbix.* to zabbix@localhost;
          mysql> set global log_bin_trust_function_creators = 1;
          mysql> quit;  ​
          
          On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
          # zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix  ​

          Comment

          • glibao
            Junior Member
            • Oct 2022
            • 9

            #6
            Hello again, I repeat the process and it tells me that it is already created: mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
            ERROR 1007 (HY000): Can't create database 'zabbix'; database exists

            and applying the command root@ubuntu-zabbix:~# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
            Enter password:
            ERROR 1050 (42S01) at line 1: Table 'role' already exists

            mysql> show databases;
            +--------------------+
            | Database |
            +--------------------+
            | information_schema |
            | mysql |
            | performance_schema |
            | sys |
            | zabbix |
            +--------------------+

            mysql> SELECT user FROM mysql.user;
            +------------------+
            | user |
            +------------------+
            | debian-sys-maint |
            | mysql.infoschema |
            | mysql.session |
            | mysql.sys |
            | root |
            | zabbix |
            +------------------+


            mysql> show tables;
            +----------------------------+
            | Tables_in_zabbix |
            +----------------------------+
            | acknowledges |
            | actions |
            | alerts |
            | auditlog |
            | autoreg_host |
            | changelog |
            | conditions |
            | config |
            | config_autoreg_tls |
            | corr_condition |
            | corr_condition_group |
            | corr_condition_tag |
            | corr_condition_tagpair |
            | corr_condition_tagvalue |
            | corr_operation |
            | correlation |
            | dashboard |
            | dashboard_page |
            | dashboard_user |
            | dashboard_usrgrp |
            | dbversion |
            | dchecks |
            | dhosts |
            | drules |
            | dservices |
            | escalations |
            | event_recovery |
            | event_suppress |
            | event_tag |
            | events |
            | expressions |
            | functions |
            | globalmacro |
            | globalvars |
            | graph_discovery |
            | graph_theme |
            | graphs |
            | graphs_items |
            | group_discovery |
            | group_prototype |
            | ha_node |
            | history |
            | history_log |
            | history_str |
            | history_text |
            | history_uint |
            | host_discovery |
            | host_inventory |
            | host_rtdata |
            | host_tag |
            | hostmacro |
            | hosts |
            | hosts_groups |
            | hosts_templates |
            | housekeeper |
            | hstgrp |
            | httpstep |
            | httpstep_field |
            | httpstepitem |
            | httptest |
            | httptest_field |
            | httptest_tag |
            | httptestitem |
            | icon_map |
            | icon_mapping |
            | ids |
            | images |
            | interface |
            | interface_discovery |
            | interface_snmp |
            | item_condition |
            | item_discovery |
            | item_parameter |
            | item_preproc |
            | item_rtdata |
            | item_tag |
            | items |
            | lld_macro_path |
            | lld_override |
            | lld_override_condition |
            | lld_override_opdiscover |
            | lld_override_operation |
            | lld_override_ophistory |
            | lld_override_opinventory |
            | lld_override_opperiod |
            | lld_override_opseverity |
            | lld_override_opstatus |
            | lld_override_optag |
            | lld_override_optemplate |
            | lld_override_optrends |
            | maintenance_tag |
            | maintenances |
            | maintenances_groups |
            | maintenances_hosts |
            | maintenances_windows |
            | media |
            | media_type |
            | media_type_message |
            | media_type_param |
            | module |
            | opcommand |
            | opcommand_grp |
            | opcommand_hst |
            | opconditions |
            | operations |
            | opgroup |
            | opinventory |
            | opmessage |
            | opmessage_grp |
            | opmessage_usr |
            | optemplate |
            | problem |
            | problem_tag |
            | profiles |
            | proxy_autoreg_host |
            | proxy_dhistory |
            | proxy_history |
            | regexps |
            | report |
            | report_param |
            | report_user |
            | report_usrgrp |
            | rights |
            | role |
            | role_rule |
            | script_param |
            | scripts |
            | service_alarms |
            | service_problem |
            | service_problem_tag |
            | service_status_rule |
            | service_tag |
            | services |
            | services_links |
            | sessions |
            | sla |
            | sla_excluded_downtime |
            | sla_schedule |
            | sla_service_tag |
            | sysmap_element_trigger |
            | sysmap_element_url |
            | sysmap_shape |
            | sysmap_url |
            | sysmap_user |
            | sysmap_usrgrp |
            | sysmaps |
            | sysmaps_element_tag |
            | sysmaps_elements |
            | sysmaps_link_triggers |
            | sysmaps_links |
            | tag_filter |
            | task |
            | task_acknowledge |
            | task_check_now |
            | task_close_problem |
            | task_data |
            | task_remote_command |
            | task_remote_command_result |
            | task_result |
            | timeperiods |
            | token |
            | trends |
            | trends_uint |
            | trigger_depends |
            | trigger_discovery |
            | trigger_queue |
            | trigger_tag |
            | triggers |
            | userdirectory |
            | users |
            | users_groups |
            | usrgrp |
            | valuemap |
            | valuemap_mapping |
            | widget |
            | widget_field |
            +----------------------------+
            176 rows in set (0.01 sec)

            ************************************************** **********************

            ​root@ubuntu-zabbix:~# systemctl enable zabbix-server zabbix-agent apache2
            Synchronizing state of zabbix-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
            Executing: /lib/systemd/systemd-sysv-install enable zabbix-server
            Synchronizing state of zabbix-agent.service with SysV service script with /lib/systemd/systemd-sysv-install.
            Executing: /lib/systemd/systemd-sysv-install enable zabbix-agent
            Failed to enable unit: Unit file apache2.service does not exist.


            I have already done all these steps and have repeated them several times, I have also deleted the database, user...etc and recreated, I have and nothing, it is a bit desperate. Thanks for your help!!​
            Last edited by glibao; 14-11-2022, 22:09.

            Comment

            • ripperSK
              Member
              • Jul 2019
              • 42

              #7
              coming back to the reported issue:

              Code:
              262146:20221113:201553.951 cannot use database "zabbix": its "users" table is empty (is this the Zabbix proxy database?)
              can you post the output of:

              Code:
              mysql> use zabbix;
              mysql> SELECT * FROM users;
              is it possible that you have by mistake imported proxy DB SQL script for server instance ?

              Also double-check that SQL scripts package is the same version as zabbix server package.

              Please know that installation of zabbix server v. 6.2 is proven to work OK and people all around the world have successfully installed this product (at this version) using the official wiki pages as a guide - therefore there's a mistake you're making somewhere - try to follow the instructions carefully - I'm sure you will find it if you're careful enough.

              Comment

              • glibao
                Junior Member
                • Oct 2022
                • 9

                #8
                mysql> SELECT * FROM users;
                Empty set (0.00 sec)

                Comment

                • ripperSK
                  Member
                  • Jul 2019
                  • 42

                  #9
                  Originally posted by glibao
                  mysql> SELECT * FROM users;
                  Empty set (0.00 sec)
                  this is definitely wrong as SQL script for zabbix server clearly creates at least two users:

                  Code:
                  root@xy:~# zgrep -i users /usr/share/zabbix-sql-scripts/mysql/server.sql.gz|grep 'INSERT INTO `users`'
                  INSERT INTO `users` (`userid`,`username`,`name`,`surname`,`passwd`,`url`,`autologin`,`autologout`,`refresh`,`rows_per_page`,`roleid`) values ('1','Admin','Zabbix','Administrator','$2y$10$92nDno4n0Zm7Ej7Jfsz8WukBfgSS/U0QkIuu8WkJPihXBb2A1UrEK','','1','0','30s','50','3');
                  INSERT INTO `users` (`userid`,`username`,`name`,`surname`,`passwd`,`url`,`autologin`,`autologout`,`refresh`,`rows_per_page`,`roleid`) values ('2','guest','','','$2y$10$89otZrRNmde97rIyzclecuk6LwKAsHN0BcvoOKGjbT.BwMBfm7G06','','0','15m','30s','50','4');
                  therefore - if no "Admin" and "guest" users exist - you have imported the SQL script:

                  Code:
                  /usr/share/zabbix-sql-scripts/mysql/server.sql.gz
                  incorrectly.

                  Comment

                  • glibao
                    Junior Member
                    • Oct 2022
                    • 9

                    #10
                    Thanks for your answer, I understand that when I run # apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent the sql-scripts does not correspond to the version I have?

                    Comment

                    • ripperSK
                      Member
                      • Jul 2019
                      • 42

                      #11
                      The error reported indicates you've imported zabbix proxy DB schema for zabbix server instance - just drop the DB and start over and make sure you're importing server SQL script this time.

                      Also - how to verify package versions falls under the scope of basic Linux system administration and therefore outside of zabbix troubleshooting and problems forum.

                      Comment

                      • glibao
                        Junior Member
                        • Oct 2022
                        • 9

                        #12
                        Good afternoon, first of all thank you very much for the help, I'm going to get on it and I'll tell you how much. Thank you very much!!

                        Comment

                        Working...