ja:documentation:05_big_environments:07_server_management

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン両方とも次のリビジョン
ja:documentation:05_big_environments:07_server_management [2022/07/08 23:08] – 外部編集 127.0.0.1ja:documentation:05_big_environments:07_server_management [2022/12/09 08:43] – [NG 753 およびそれ以前のバージョンにおけるヒストリデータベース] junichi
行 629: 行 629:
  
   * ヒストリデータベースにアクセスできるように Pandora FMS サーバとコンソールで利用するユーザのパーミッション(''user'' と ''password'')を設定します。   * ヒストリデータベースにアクセスできるように Pandora FMS サーバとコンソールで利用するユーザのパーミッション(''user'' と ''password'')を設定します。
 +
 +**For MySQL 5.7**
 +
 +**MySQL 5.7 向け:**
  
 <code bash> <code bash>
 GRANT ALL PRIVILEGES ON pandora_history.* TO 'user'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON pandora_history.* TO 'user'@'%' IDENTIFIED BY 'password';
 +
 +
 +</code>
 +
 +**For MySQL 8:**
 +
 +**MySQL 8 向け:**
 +
 +  * ''$DBROOTPASS'': MySQL 8 **root**  user password.
 +  * ''$DBUSER'': MySQL 8 user name.
 +  * ''$DBPASS'': MySQL 8 user password.
 +  * ''$DBPORT'': Connection port for MySQL 8.
 +  * ''$DBHOST'': IP address or FQDN of the MySQL server 8.
 +  * ''$DBNAME'': Name of the database.
 +
 +  * ''$DBROOTPASS'': MySQL 8 **root** ユーザパスワード。
 +  * ''$DBUSER'': MySQL 8 ユーザ名。
 +  * ''$DBPASS'': MySQL 8 ユーザパスワード。
 +  * ''$DBPORT'': MySQL 8 用接続ポート。
 +  * ''$DBHOST'': MySQL 8 サーバの IP アドレスまたは FQDN。
 +  * ''$DBNAME'': データベース名。
 +
 +To use these environment variables just define them before running //grants// in the terminal, enter the following:
 +
 +これらの環境変数を使用するには、//GRANT// を実行する前に次のようにターミナルで設定するだけです。
 +
 +<code bash>
 +env TZ='Europe/Madrid' \
 + DBHOST='127.0.0.1' \
 + DBNAME='pandora' \
 + DBUSER='pandora' \
 + DBPASS='pandora' \
 + DBPORT='3306' \
 + DBROOTPASS='pandora'
 +
 +</code>
 +
 +Enter in the terminal:
 +
 +ターミナルで以下を実行します:
 +
 +<code bash>
 +systemctl restart mysql
 +
 +</code>
 +
 +Enter in the terminal:
 +
 +ターミナルで以下を実行します:
 +
 +<code bash>
 +
 +export MYSQL_PWD=$DBROOTPASS
 +echo "CREATE USER  \"$DBUSER\"@'%' IDENTIFIED BY \"$DBPASS\";" | mysql -uroot -P$DBPORT -h$DBHOST
 +echo "ALTER USER \"$DBUSER\"@'%' IDENTIFIED WITH mysql_native_password BY \"$DBPASS\"" | mysql -uroot -P$DBPORT -h$DBHOST
 +echo "GRANT ALL PRIVILEGES ON $DBNAME.* TO \"$DBUSER\"@'%'" | mysql -uroot -P$DBPORT -h$DBHOST
 +
 +export MYSQL_PWD=$DBPASS
  
  
行 729: 行 791:
 <WRAP center round tip 60%>この処理は、別のサーバの別のデータベースに対して実行されるため、メインのデータベースには影響を与えません。</WRAP> <WRAP center round tip 60%>この処理は、別のサーバの別のデータベースに対して実行されるため、メインのデータベースには影響を与えません。</WRAP>
  
-=== ヒストリデータベースの設定 === 
  
-{{:wiki:icono-modulo-enterprise.png?23x23  |Versión Enterprise}}In Pandora FMS console, go to **Setup> Setup> Enterprise** to access [[:en:documentation:04_using:12_console_setup#historical_database|connection configuration]] (**Configure connection target**). 
  
-{{:wiki:icono-modulo-enterprise.png?23x23  |Enterprise 版}}Pandora FMS コンソールにて、[[:ja:documentation:04_using:12_console_setup#ヒストリデータベース|接続設定]] へアクセスするために、**セットアップ(setup) > Enterprise** へ行きます。 
- 
-{{  :wiki:pandora_console_06.png  }} 
- 
-Fill in the following fields: 
- 
-次のフィールドに入力します。 
- 
-  * **Host**: Host name (web link or IP address) of the history database. 
-  * **Port**: Connection port of the history database. Stardard value: ''3306''. 
-  * **Database name**: Name of the history database. Default value: ''pandora''. 
-  * **Database user**: History database user. Default value: ''pandora''. 
-  * **Database password**: Password of the history database. This will allow to cennect to the history database. Next fill in the custom parameters (**Customize settings**): 
- 
-  * **ホスト(Host)**: ヒストリデータベースのホスト名(Webリンクまたは IP アドレス)。 
-  * **ポート(Port)**: ヒストリデータベースの接続ポート。標準は ''3306'' です。 
-  * **データベース名(Database name)**: ヒストリデータベースの名前。デフォルトは ''pandora'' です。 
-  * **データベースユーザ(Database user)**: ヒストリデータベースユーザ。デフォルトは ''pandora'' です。 
-  * **データベースパスワード(Database password)**: ヒストリデータベースのパスワード。これにより、ヒストリデータベースへ接続することができます。次に、カスタムパラメータを入力します(**設定のカスタマイズ**): 
- 
-{{  :wiki:pandora_console_06-1.png  }} 
- 
-The last fields of this form **Data days old to keep in active database, Transference block size (Step)**  and **Delay betewwn transferences (seconds)**  will define the way in which the data will be sent to the historical database, that is, the oldest data those with more than n //days (Data days)// will be moved to the history database in blocks of made of n rows (//Step//) waiting n seconds (//Delay//) between one block and the next to avoid overloads. 
- 
-このフォームの最後のフィールド **アクティブなデータベースに保持するデータ日数、転送ブロックサイズ(ステップ)** および **転送の遅延(秒)** は、データをヒストリデータベースに送信される方法を定義します。つまり、n //日(Data days)// を超える最も古いデータは、n 行(//Step//)ごとに、オーバーロードを回避するために 1つのブロックと次のブロックの間を n 秒(//Delay//)待機し、ヒストリデータベースに移動されます。 
- 
-In the same screen, it is also possible to decide whether to send the events with more than n days to the history database (**Events days old to keep in active database**), although it must be taken into account that including the events will considerably increase the growth rate of the historical database, and that these will only be consulted when generating reports, not in the event view. 
- 
-同じ画面で、n日を超えるイベントをヒストリデータベースに送信するかどうかを決定することもできます(**アクティブなデータベースに保持する古いイベント(Events days old to keep in active database)**)。ただし、イベントはヒストリデータベースの増大率を大幅に増加させます。また、これらはイベント表示ではなく、レポートを生成するときにのみ参照されます。  
- 
-<WRAP center round tip 75%> {{:wiki:icono-modulo-enterprise.png?23x23  |Versión Enterprise}}The historical database is a feature of the Enterprise version that uses the ''/usr/bin/pandora_db''  binary to transfer data. </WRAP> 
- 
-<WRAP center round tip 75%> {{:wiki:icono-modulo-enterprise.png?23x23  |Enterprise 版}} 
-ヒストリデータベースの機能は Enterprise 版の機能で、データを転送するのに ''/usr/bin/pandora_db'' バイナリを用います。 
-</WRAP> 
- 
-=== ヒストリデータベースの削除と圧縮設定 === 
- 
-History database is supposed to contain all history data, but if you want to delete old data, or compact them, you will need to use some specific data in database that take into account the script **pandora_db** when executed from the node. 
- 
-ヒストリデータベースは、"過去の全データ" を保存することを想定しています。しかし、古いデータを削除したり圧縮したい場合は、**pandora_db** スクリプトを通常の DB に対する動作に見せかけて実行する必要があります。そのためには、ヒストリデータベースに何らかのデータが入っている必要があります。 
- 
-First, enter some data from the history database in //tconfig// table. Use this SQL queries to create a minimal configuration and configure the performance od **pandora_db** when executed against the history databas. First you need to connect to your database using the command line (CLI) of MySQL. 
- 
-最初に、pandora_db ツールによって利用できるように、//tconfig// テーブルを適切な値を入れた状態で用意する必要があります。**pandora_db** の実行に必要な最小限の設定を行うために、ヒストリデータベースに対して以下の SQL を実行します。まずは、mysql の CLI を利用して、データベースに接続する必要があります。 
- 
-This is an example, replace values according to your criteria (but leave ''history_db_enabled'' at zero): 
- 
-以下が例です。値は必要に応じて書き換えてください。(ただし、history_db_enabled は 0 にしてください) 
- 
-<code> 
- INSERT INTO `tconfig` VALUES (1,'days_purge','180'); 
- INSERT INTO `tconfig` VALUES (2,'history_db_enabled','0'); 
- INSERT INTO `tconfig` VALUES (3,'days_compact','120'); 
- INSERT INTO `tconfig` VALUES (4,'step_compact','1'); 
- INSERT INTO `tconfig` VALUES (5,'event_purge','180'); 
- INSERT INTO `tconfig` VALUES (6,'string_purge','180'); 
- INSERT INTO `tconfig` VALUES (7,'MR','0'); 
- 
-</code> 
- 
-  * This example is for the history database ito store for 6 months (180 days) from the execution date. 
-  * Compact data more than 4 months old (120 days). 
-  * If you have 1 month worth of data in your main database, you will have a total of 6 months of data, because the last month has no data in the history database, but it has them in the main database. 
-  * You may type in any value here, there is no limit of data storage in history database aprt from the machine's free space. Just remember that the history database must be in a physical server separated from the main DB and Pandora FMS. 
- 
-  * この例は、ヒストリデータベースに(現在からさかのぼること) 6ヶ月間データを保存します。 
-  * 4ヶ月(120日)前のデータを圧縮することを意味します。 
-  * メインのデータベースに 1ヶ月間のデータがあるとしても、トータルで 6ヶ月間のデータとなります。なぜなら、直近 1ヶ月のデータはメインデータベースから読まれ、それ以外はヒストリデータベースから読まれるためです。 
-  * これらには任意の値を設定できます。ヒストリデータベースにはデータ量の上限はありません。ただし、ヒストリデータベースは、メインデータベースおよび Pandora FMS サーバやコンソールが動作しているマシンとは物理的に異なるマシンに配置しなければいけないことを理解してください。 
- 
-<WRAP center round tip 75%> In versions prior to Pandora FMS 753 you must execute the script **pandora_db**  in the history server itself using the data specified previously in the database and additionnally create the configuration file as explained below, in order to use the maintenance script as if we were using a normal database. </WRAP> 
- 
-<WRAP center round tip 75%> Pandora FMS 753 より前のバージョンでは、通常のデータベースと同じように、前述のデータベースと以降で説明する追加の設定ファイルを用いてヒストリサーバでメンテナンスのために **pandora_db** スクリプトを実行する必要があります。</WRAP> 
- 
-In versions prior to Pandora FMS 753, create an additional ''pandora_server.conf''  file. Use this small version to create your own and name it ''/etc/pandora/pandora_server_history_db.conf''  : 
- 
-Pandora FMS 753 までのバージョンでは、追加の ''pandora_server.conf'' ファイルを作成する必要があります。次のような内容で、''/etc/pandora/pandora_server_history_db.conf'' として作成します。 
- 
-<code> 
-dbengine mysql 
-dbname pandora4_history 
-dbuser pandora4_history 
-dbpass 1234 
-dbhost 192.168.50.23 
-log_file /var/log/pandora/pandora_db_history.log 
-</code> 
- 
-Now you can execute **pandora_db**  tool against the history database configuration and program it for its periodical execution: 
- 
-これで、ヒストリデータベースに対して **pandora_db** ツールの定期実行をプログラムできます。 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server_history_db.conf 
- 
-</code> 
- 
-また、設定値は[[:ja:documentation:04_using:12_console_setup#ヒストリデータベースメンテナンスオプション|こちら]]に説明しているようにコンソールからも入力できます。 
- 
-<WRAP center round tip 60%> 
-この処理は、メインのデータベースには影響しません。なぜなら、異なるサーバの異なるデータベースに対して行っているためです。 
-</WRAP> 
  
 [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]]