[Zabbix][Server][3.0.5]データベースの作成

Zabbixサーバをインストールしたら、データベースを作成する必要があります。

■公式ドキュメント
https://www.zabbix.com/documentation/3.0/manual/installation/install

Zabbixサーバのインストールは、以下を参照ください。

Zabbixサーバ3.0系をソースファイルからインストールする際の手順をまとめます。 インストール手順は、基本的に公式ドキュメントにし...

環境

インストールを行った環境は、以下の通りです。

  • CentOS 6.8
  • Zabbix Server 3.0.5
  • MySQL 5.7(ローカルホストにインストール済)

データベースの作成

データベース作成

まず、Zabbix Server で使用するデータベースを作成します。
MySQLのインストールがまだであれば、この先に進む前にMySQLのインストールを完了させておきます。

MySQLのインストールは以下を参照ください。

環境 インストールを行った環境は、以下の通りです。 OS:CentOS 6.8 インストールするものは、以下です。 ...

MySQLにログインして、以下のようにデータベースを作成します。
データベース名は「zabbix」、文字コードは「UTF-8」を指定しましょう。

$ mysql -uroot -p
password:
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE USER zabbix@localhost IDENTIFIED BY 'パスワード';
Query OK, 0 rows affected, 1 warning (0.09 sec)
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost;
Query OK, 0 rows affected, 1 warning (0.09 sec)
mysql> quit;
Bye

初期スキーマとデータの投入

続いて、初期スキーマとデータを投入します。
Zabbix Server のインストール方法(パッケージ or ソースファイル)によって、初期スキーマやデータ投入用のSQLファイルの場所がことなりますので、注意が必要です。

パッケージでインストールした場合

以下のように実行します。

# zcat /usr/share/doc/zabbix-server-mysql-3.0.5/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:

ソースファイルからインストールした場合

ソースファイルからインストールした場合でも、事前に用意されたSQLファイルを実行することに違いはありませんが、SQLファイルの保存場所が異なります。

SQLファイルは、ソースファイルを展開して生成されるディレクトリの中にあります。
ソースファイルを展開した場所が「/usr/local/src」だった場合は、以下のようになります。

$ pwd
/usr/local/src/zabbix-3.0.5/database/mysql
$ ls -al
total 3012
-rw-r--r-- 1 1000 1000 990351 Sep 30 18:46 data.sql
-rw-r--r-- 1 1000 1000 1978341 Sep 30 18:42 images.sql
-rw-r--r-- 1 1000 1000 113197 Sep 30 18:46 schema.sql

これらのSQLファイルを以下のように実行します。

# mysql -uroot -p zabbix < schema.sql
Enter password:
# mysql -uroot -p zabbix < images.sql
Enter password:
# mysql -uroot -p zabbix < data.sql
Enter password:

確認

データベースが作成できているか、確認しておきましょう。

# mysql -uroot -p zabbix
Enter password:

mysql> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
| auditlog_details           |
| autoreg_host               |
| conditions                 |
| config                     |
| dbversion                  |
| dchecks                    |
| dhosts                     |
| drules                     |
| dservices                  |
| escalations                |
| events                     |
| expressions                |
| functions                  |
| globalmacro                |
| globalvars                 |
| graph_discovery            |
| graph_theme                |
| graphs                     |
| graphs_items               |
| group_discovery            |
| group_prototype            |
| groups                     |
| history                    |
| history_log                |
| history_str                |
| history_text               |
| history_uint               |
| host_discovery             |
| host_inventory             |
| hostmacro                  |
| hosts                      |
| hosts_groups               |
| hosts_templates            |
| housekeeper                |
| httpstep                   |
| httpstepitem               |
| httptest                   |
| httptestitem               |
| icon_map                   |
| icon_mapping               |
| ids                        |
| images                     |
| interface                  |
| interface_discovery        |
| item_application_prototype |
| item_condition             |
| item_discovery             |
| items                      |
| items_applications         |
| maintenances               |
| maintenances_groups        |
| maintenances_hosts         |
| maintenances_windows       |
| mappings                   |
| media                      |
| media_type                 |
| opcommand                  |
| opcommand_grp              |
| opcommand_hst              |
| opconditions               |
| operations                 |
| opgroup                    |
| opinventory                |
| opmessage                  |
| opmessage_grp              |
| opmessage_usr              |
| optemplate                 |
| profiles                   |
| proxy_autoreg_host         |
| proxy_dhistory             |
| proxy_history              |
| regexps                    |
| rights                     |
| screen_user                |
| screen_usrgrp              |
| screens                    |
| screens_items              |
| scripts                    |
| service_alarms             |
| services                   |
| services_links             |
| services_times             |
| sessions                   |
| slides                     |
| slideshow_user             |
| slideshow_usrgrp           |
| slideshows                 |
| sysmap_element_url         |
| sysmap_url                 |
| sysmap_user                |
| sysmap_usrgrp              |
| sysmaps                    |
| sysmaps_elements           |
| sysmaps_link_triggers      |
| sysmaps_links              |
| timeperiods                |
| trends                     |
| trends_uint                |
| trigger_depends            |
| trigger_discovery          |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
+----------------------------+
113 rows in set (0.00 sec)

mysql> quit

以上でデータベースの作成は完了です。

スポンサーリンク

シェアする

  • このエントリーをはてなブックマークに追加

フォローする

スポンサーリンク