Zabbix データベースは、 Zabbix サーバまたは Zabbix プロキシのインストール中に作成される必要があります。
このセクションでは、Zabbix データベースの作成のスクリプトを説明します。サポートされているデータベースそれぞれに対して、別のスキーマのスクリプトが提供されます。
<note important>データベースファイルのインポートの順番が変更されました - いまは、data.sql の前にイメージをインポートする必要があります。 :::
Zabbix プロキシのデータベースでは、schema.sql だけがインポートされます(images.sql やdata.sql はインポートされません)
schema.sql、 images.sql、data.sql ファイルは、Zabbix ソースのディストリビューション内に、サブディレクトリのデータベースにあります。Zabbix がディストリビューションパッケージからインストールされた場合は、ディストリビューションのドキュメントを参照してください。
MySQL(ユーザー username とそのパスワード password が存在し、かつデータベースオブジェクトの作成のパーミッションを持っていることを確認済みであること):
shell> mysql -u<username> -p<password> mysql> create database zabbix character set utf8 collate utf8_bin; mysql> quit; shell> mysql -u<username> -p<password> zabbix < database/mysql/schema.sql # stop here if you are creating database for Zabbix proxy shell> mysql -u<username> -p<password> zabbix < database/mysql/images.sql shell> mysql -u<username> -p<password> zabbix < database/mysql/data.sqlPostgreSQL ( ユーザー username が存在し、かつデータベースオブジェクトの作成のパーミッションを持っていることを確認済みであること):
shell> psql -U <username> psql> create database zabbix; psql> \q shell> cd database/postgresql shell> psql -U <username> zabbix < schema.sql # stop here if you are creating database for Zabbix proxy shell> psql -U <username> zabbix < images.sql shell> psql -U <username> zabbix < data.sqlOracle (ユーザー zabbix とそのパスワード password が存在し、かつサービスORCL内のデータベースオブジェクトの作成のパーミッションを持っていることを確認済みであること): Zabbix サーバ用にデータベースを作成しようとする場合は、Oracle のホストのどこかにイメージを置く必要があります。
# copy directory create/images/old_images somewhere on Oracle server (e.g. /home/oracle): shell> scp -r create/images/old_images user@host:/home/oracle # edit file database/oracle/images.sql and set images_dir variable to where you have copied them (e. g. "/home/oracle/old_images"): CREATE OR REPLACE DIRECTORY image_dir AS '/home/oracle/old_images'これで、データベースが準備できます。
shell> sqlplus zabbix/password@host/ORCL sqlplus> set def off sqlplus> @database/oracle/schema.sql # stop here if you are creating database for Zabbix proxy sqlplus> @database/oracle/images.sql sqlplus> @database/oracle/data.sqlZabbix は、UTF-8 のデータベースの文字セットを必要とします。データベースがUTF-8 出ない場合は、次を実行して変換することができます: ALTER DATABASE NATIONAL CHARACTER SET UTF8;
IBM DB2:
shell> db2 "create database zabbix using codeset utf-8 territory us pagesize 32768" shell> cd database/ibm_db2 shell> db2batch -d zabbix -f schema.sql # stop here if you are creating database for Zabbix proxy shell> db2batch -d zabbix -f images.sql shell> db2batch -d zabbix -f data.sql SQLite:
shell> cd database/sqlite3 shell> sqlite3 /var/lib/sqlite/zabbix.db < schema.sql # stop here if you are creating database for Zabbix proxy shell> sqlite3 /var/lib/sqlite/zabbix.db < images.sql shell> sqlite3 /var/lib/sqlite/zabbix.db < data.sqlZabbix プロキシで SQLite を使用している場合、データベースが存在していなければ自動的に作成されます。
インストールのセクションに戻ります。
本ページは2013/06/02時点の原文を基にしておりますので、内容は必ずしも最新のものとは限りません。
最新の情報は右上の「Translations of this page」から英語版を参照してください。