ja:documentation:05_big_environments:07_server_management

差分

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

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
ja:documentation:05_big_environments:07_server_management [2022/01/30 04:28] – [ウォッチドッグ起動] junichija:documentation:05_big_environments:07_server_management [2023/11/14 06:16] (現在) – 削除 junichi
行 1: 行 1:
-====== サーバ管理 ======  
-{{indexmenu_n>7}} 
  
-[[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] 
- 
-===== Pandora FMS サーバ管理 ===== 
- 
-==== Pandora FMS サーバの手動起動/停止 ==== 
- 
-To start and / or stop the server manually Pandora FMS is running the following in a shell console: 
- 
-Pandora FMS を手動で起動・停止するには、コマンドラインから以下を実行します。 
- 
-Stop daemon: 
- 
-デーモンの停止: 
-<code> 
- 
-/etc/init.d/pandora_server stop 
- 
-</code> 
- 
-Start daemon: 
- 
-デーモンの起動: 
- 
-<code> 
-/etc/init.d/pandora_server start 
- 
-</code> 
- 
-Restart daemon: 
- 
-デーモンの再起動: 
- 
-<code> 
-/etc/init.d/pandora_server restart 
- 
-</code> 
- 
-<WRAP center round tip 60%>\\ 
-Version NG 756 or later.\\ 
-</WRAP> 
- 
-<WRAP center round tip 60%>\\ 
-バージョン NG 756 以上\\ 
-</WRAP> 
- 
-From version NG 756 onwards the previous instructions will also start the **pandora_ha** service. 
- 
-バージョン NG 756 以上では、上記の手順で **pandora_ha** サービスも起動されます。 
- 
-To start and/or stop manually **only** the Pandora FMS server, you have to execute the following in a shell console: 
- 
-Pandora FMS サーバ **のみ** を手動で起動・停止するには、コマンドラインから次のように実行します。 
- 
-Stop daemon: 
- 
-デーモンの停止: 
- 
-<code> 
-/etc/init.d/pandora_server stop-server 
- 
-</code> 
- 
-Start daemon: 
- 
-デーモンの起動: 
- 
-<code> 
-/etc/init.d/pandora_server start-server 
- 
-</code> 
- 
-Restart daemon: 
- 
-デーモンの再起動: 
- 
-<code> 
-/etc/init.d/pandora_server restart-server 
- 
-</code> 
- 
-You can monitor the status of **pandora_ha** through **systemd** with: 
- 
-**systemd** を通して次のように **pandora_ha** の状態を確認できます。 
- 
-<code> 
-systemctl status pandora_ha.service 
- 
-</code> 
- 
- 
-==== データベース管理 ==== 
-Pandora FMS インフラストラクチャは外部メンテナンスを必要としませんが、古いデータを削除し、データベースをできるだけコンパクトに維持することが非常に重要です。 これらのタスクの実行を担当する Pandora FMS に不可欠なツールが以下にあります。 
- 
-  /usr/share/pandora_server/util/pandora_db.pl 
- 
-Pandora FMS Enterprise 版の場合は以下です。 
- 
-  /usr/bin/pandora_db 
- 
-このツール(以降 **pandora_db.pl**)は、Pandora FMS サーバパッケージに含まれているため、Pandora FMS サーバがインストールされているシステムから実行する必要があります。 コンソール用とサーバ用で 2つのシステムがある場合、Pandora FMSサーバがホストされている方で //pandora_db// を実行する必要があります。 
-//Pandora_db// は、Pandora FMS が適切に動作するための重要なツールです。そのため、システムの cron タスクで一時間ごとに実行するように設定されています。 以下のファイルで設定されています。 
- 
-  /etc/cron.hourly/pandora_db 
- 
-このツールは、データベースの全てのメンテナンスを自動的に実行します。 
- 
-  * 古いデータの削除をします。 
- 
-  * 既存のデータを圧縮し、いくつかの間隔を補間します。これにより、グラフは同じですが、それらを保存するために必要なスペースははるかに小さくなります(これが、Pandora FMS が大量の情報を処理できる理由の 1つです)。 
- 
-  * 存在しないモジュールのデータベースでの整合性や、初期化されていないために利用されていないモジュール (これらのモジュールは、未初期化モジュールとして表示されます) をチェックします。 
- 
-  * エージェントの一日の接続情報を削除します。Pandora FMS は、24時間を越えるエージェント接続情報は必要としません。もし、それが増えると、データベースのアクセス速度が低下します。 
- 
-  * エンタープライズ版では、全ての古いデータをスタンバイデータベースに移動します。 
- 
-前述したように、//pandora_db// の実行はシステムの cron タスクで設定され、この実行は Pandora FMS サーバのインストールに自動的に含まれますが、確認すると良いでしょう。 ///etc/cron.hourly/pandora_db// が存在し、次の行が含まれている必要があります。 
- 
-  "/usr/share/pandora_server/util/pandora_db.pl" "/etc/pandora/pandora_server.conf" >/dev/null 2>&1 
- 
-Pandora FMS Enterprise 版では以下の通りです。 
- 
-  "/usr/bin/pandora_db" "/etc/pandora/pandora_server.conf" >/dev/null 2>&1 
- 
-パーミッションとファイルの所有者を確認することも同様に重要です。 正しいパーミッションは 755 です。これは、次を実行することで付与できます。 
- 
-  chmod 755 /etc/cron.hourly/pandora_db 
- 
-所有者に関しては、ユーザとグループ共に "root" である必要があり、次のように設定できます。 
- 
-  chown root:root /etc/cron.hourly/pandora_db 
- 
-==== メンテナンスツールの手動実行 ==== 
- 
-If necessary, it is possible to launch **pandora_db** execution manually as it was exposed in the previous section. Execute from a shell the following. 
- 
-必要に応じて、前のセクションで説明した **pandora_db** を手動で実行できます。 シェルコンソールからコマンドを実行します。 
- 
-In Pandora FMS Open version: 
- 
-Pandora FMS オープンソース版の場合: 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf 
- 
-</code> 
- 
-{{https://prewebs.pandorafms.com/manual/_media/wiki/icono-modulo-enterprise.png?direct&23x23|Versión Enterprise}}Or in Pandora FMS Enterprise version: 
- 
-{{https://prewebs.pandorafms.com/manual/_media/wiki/icono-modulo-enterprise.png?direct&23x23|Enterprise 版}}Pandora FMS Enterprise 版の場合: 
- 
-<code> 
-/usr/bin/pandora_db /etc/pandora/pandora_server.conf 
- 
-</code> 
- 
-次のような出力が表示されます。 
- 
-{{  :wiki:pandora_fms_db_tool_v7.0ng.757_build_210915.png  }} 
- 
-<WRAP center round important 60%> 
-負荷が高いシステムでは数時間かかる場合があるため、バックグラウンドでプロセスを実行することをお勧めします。 
-</WRAP> 
- 
-手動でメンテナンスツールをバックグラウンド実行するには、次のようにします。 
- 
-In Pandora FMS Open version: 
- 
-Pandora FMS オープンソース版の場合: 
- 
-<code> 
-nohup /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf 
- 
-</code> 
- 
-{{https://prewebs.pandorafms.com/manual/_media/wiki/icono-modulo-enterprise.png?direct&23x23|Versión Enterprise}}Or in Pandora FMS Enterprise version: 
- 
-{{https://prewebs.pandorafms.com/manual/_media/wiki/icono-modulo-enterprise.png?direct&23x23|Enterprise 版}}Pandora FMS Enterprise 版の場合: 
- 
-<code> 
-nohup /usr/bin/pandora_db /etc/pandora/pandora_server.conf 
- 
-</code> 
- 
-バックグラウンドでプロセスの実行には少々時間がかかります。プロセスの実行中でも、シェルこのソールを閉じることができます。 
- 
-<WRAP center round tip 60%> 
-インストールの状況によっては、ツールのディレクトリが変わります。ほとんどの場合は以下の通りです。 
- 
-  /usr/share/pandora_server/util/ 
- 
-Pandora FMS の以前のバージョンでは以下にあります。 
- 
-  /usr/share/pandora/util/ 
- 
-</WRAP> 
- 
-<WRAP center round important 60%> 
-古いバージョンではなく、新しいバージョンのツールを使用していることを確認することが非常に重要です。 引数なしでプログラムを実行すると、メッセージの先頭にツールのバージョンが表示され、サーバにインストールしたバージョンが一致している必要があります。 
-</WRAP> 
- 
-==== データベースバックアップ ==== 
- 
-<WRAP center round important 60%> It is important to remember that this **only** backs up or restores the database, //without including other files//, nor the server configuration.</WRAP> 
- 
-<WRAP center round important 60%> これは、他のファイルやサーバ設定を含めずに、データベース**のみ**のバックアップまたは復元であることを認識しておくことが重要です。</WRAP> 
- 
-The command **mysqldump** will do a complete database dump of the table structure as well as its contents. This is done by doing a full database dump, both of the table structure as well as their contents. This command has several options to do a backup, and its most basic usage is enough to dump from the same system where the database is hosted. Indicate the database name from which the backup will be done and the credentials to access it: 
- 
-コマンド **mysqldump** は、テーブル構造とその内容の完全なデータベースダンプを行います。このコマンドには、バックアップを実行するためのいくつかのオプションがありますが、ここでは最も基本的な使用法に焦点をあてます。これは、データベースを実行しているのと同じホストから実行することを意味します。 バックアップが行われるデータベース名とそれにアクセスするための認証情報を指定します。 
- 
-  mysqldump -u <user> -p <data_base> 
- 
-For instance, to backup "pandora" database and dump the result to an ''.sql'' file execute: 
- 
-例えば、"pandora" データベースをバックアップし、''.sql'' ファイルにダンプを出力するには次のようにします。 
- 
-  mysqldump -u root -p pandora > /backup/pandoradb_backup.sql 
- 
-From a backup done that way, you may fully restore the database. Login in MySQL, proceed to create the database that will be restored and then load the backup in that database. Following the previous example: 
- 
-そのようにして行われたバックアップから、データベースを完全に復元できます。MySQL にログインし、復元されるデータベースの作成に進み、そのデータベースにバックアップをロードします。前のファイルを例にすると、次のように実行します。 
- 
-<code> 
-[root@pandorafms ~]# mysql -u root -p 
-mysql> create database pandora; 
-mysql> use pandora; 
-mysql> source /backup/padnoradb_backup.sql 
-</code> 
- 
-Finally, it is necessary to set configured user permissions again both in Pandora FMS Console and server so they have total access to the database (replace ''mypassword'' by your password): 
- 
-最後に、Pandora FMS コンソールとサーバの両方で設定済みのユーザ権限を再度設定し、データベースへのアクセス権を付与します。(''mypassword'' をあなたのパスワードで置き換えてください) 
- 
-  grant all privileges on pandora.* to pandora@localhost identified by 'mypassword'; 
- 
-<WRAP center round important 60%> 
-これは、データベースのバックアップ/リカバリを実行するのみであり、サーバの設定などの他のファイルに対するものではないことに注意してください。 
-</WRAP> 
- 
-==== Pandora FMS のバックアップとリカバリ ==== 
- 
-There is a script in Pandora FMS server distribution that is useful to backup and restore Pandora FMS completely. This script is intended for backup and restoration in systems where the server and console are located in the same machine. 
- 
-Pandora FMS サーバの配布パッケージには、Pandora FMS を完全にバックアップおよび復元するのに役立つスクリプトがあります。 このスクリプトは、サーバとコンソールが同じマシン上にあるシステムでのバックアップと復元を目的としています。 
- 
-<WRAP center round tip 60%>If there are several components in your environment, then you should use the tool with the most adequate parameters for its use or modify them so they are tailored to your needs.</WRAP> 
- 
-<WRAP center round tip 60%>コンポーネントが複数に分かれた環境の場合は、適切なパラメーターでツールを使用するか、ニーズに合わせてツールを調整する必要があります。</WRAP> 
- 
-This script needs to be executed as **root**. You are the only **responsible** for said key. It is located at: 
- 
-この処理を実行するには、スクリプトを root 権限で実行する必要があります。スクリプトは以下にあります。 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_backup.sh 
- 
-</code> 
- 
-If it is executed without parameters, it will show the help menu: 
- 
-引数無しで実行すると、ヘルプを表示します。 
- 
-{{  :wiki:pandora_server_util_pandora_backup.png  }} 
- 
-このスクリプトは、次のコンポーネントのバックアップとリストアをするように設計されています。 
- 
-  * **Server configuration**  file(s). 
-  * Files **waiting for execution**, and also agent **remote configuration**  files. 
-  * Complete **DB**. 
-  * Complete **WEB Console**. 
- 
-  * **サーバ設定**ファイル 
-  * **処理待ちの**ファイルおよび、エージェントの**リモート設定**ファイル 
-  * **DB** 全体 
-  * **ウェブコンソール**全体 
- 
-===バックアップ元とバックアップ先オプション=== 
- 
-This script obtains access credentials to the database directly from the WEB console configuration. That is why the full path with the ''-c'' must be sent to the WEB console. That same parameter is also used to back up the web console itself. 
- 
-このスクリプトは、ウェブコンソールの設定ファイルに設定されている DB のアクセス情報を利用します。そのため、ウェブコンソールの設定ファイルのパスを ''-c'' オプションで指定する必要があります。 
-このパラメータは、ウェブコンソールのバックアップを取得するためにも利用されます。 
- 
-The backup's **destination** is specified with the //-d// parameter. The compressed backup file will be lodged in that path, with a name similar to ''pandorafms_backup_xxxxxxx.tar.gz''. 
- 
-パックアップ**先**は、//-d// オプションで指定します。バックアップファイルが ''pandorafms_backup_xxxxxxx.tar.gz'' というファイル名で圧縮されて置かれます。 
- 
-そのようにして、次のコマンドは完全な環境バックアップを実行します。 
- 
-  /usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -d /tmp/ 
- 
-With the ''-b'' parameter the database backup can be prevented: 
- 
-''-b'' オプションを付けるとデータベースのバックアップを行いません。 
- 
-  /usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -d /tmp/ -b 
- 
-===データベースリストア=== 
- 
-To restore the database with the script, replace the parameter ''-d'' by ''-s'', indicating in this particular case the path to the backup: 
- 
-スクリプトでデータベースをリストアするには、パラメーター ''-d'' を ''-s'' に置き換えて、バックアップ先のパスを指定します。 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -s /tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz 
- 
-</code> 
- 
-これは、ディレクトリを含まないデフォルトのリストアです。 
- 
-===データベースとディレクトリのリストア=== 
- 
-The ''-f'' option allows restoring backup files (**overwriting the current ones**). Since overwritting current configuration files could have serious consequences, use ''-f'' if you want to do a backup recovery and you want it to restore all Pandora FMS files (console and server). 
- 
-''-f'' オプションを使用すると、バックアップファイルを復元できます(現在のファイルを上書きします)。 現在の設定ファイルを上書きすると深刻な結果になる可能性があるため、バックアップリカバリを実行し、すべての Pandora FMS のファイル(コンソールおよびサーバ)を復元する場合は、''-f'' を使用します。 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -s /tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz -f 
- 
-</code> 
- 
-<WRAP center round important 60%> 
-//grant// コマンドを使って、データベースのユーザ権限の復元を忘れないようにしてください。 
-</WRAP> 
- 
-===ファイルのリストア(データベースではない)=== 
- 
-Same as with the previous option, it is possible to restore only the files, without including the database. To do it, add the ''-b'' option to the previous execution. 
- 
-前のオプションと同じように、データベースを含めずにファイルのみを復元できます。 それを行うには、上記の実行例に ''-b'' オプションを追加します。 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -s /tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz -f -b 
- 
-</code> 
- 
- 
-=== 利用例 === 
- 
-==バックアップの作成== 
- 
-root で以下を実行します。 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -d /tmp/ 
- 
-</code> 
- 
-次のようなメッセージが表示されます。 
- 
-<code> 
-Backup completed and placed in /tmp//pandorafms_backup_2021-12-16-16-11-50.tar.gz 
- 
-</code> 
- 
-This means that the backup is at, in this case: 
-''/tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz'' 
- 
-これは、バックアップが ''/tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz'' にできたことを意味します。 
- 
-==バックアップからのリストア== 
- 
-<WRAP center round info 60%>To restore the backup automatically, you need a console with the authentication credentials on the database correctly defined.</WRAP> 
- 
-<WRAP center round info 60%>自動でバックアップからリストアするために、コマンドラインからデータベースへアクセスできる権限が設定されていると仮定します。</WRAP> 
- 
-実行: 
- 
-<code> 
-/usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -s /tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz -f 
- 
-</code> 
- 
-次のような表示がされます。 
- 
-<code> 
- Detected Pandora FMS backup at /tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz, please wait... 
- Dropping current database 
- Restoring backup database 
- Restoring files and configuration 
- Done. Backup in /tmp/pandorafms_backup_2021-12-16-16-11-50.tar.gz restored 
- 
-</code> 
- 
-==コンソール障害時におけるバックアップからのリストア== 
- 
-Pandora FMS コンソールが障害により異常状態になった場合、このツールでバックアップを取得していれば、コンソールをリストアすることができます。そのためには、次のようにバックアップファイルを手動で展開します。 
- 
-<code> 
- cd /tmp 
- tar zxvf pandorafms_backup_2021-12-16-16-11-50.tar.gz 
- 
-</code> 
- 
-This will decompress your WEB console full directory in ''/tmp''. In case of the generated backup of the previous example, it creates a directory named: 
- 
-これより、ウェブコンソールのファイルが ''/tmp'' ディレクトリに展開されます。上記の例のバックアップの場合、次のようなディレクトリが作成されます。 
- 
-<code> 
-/tmp/var/www/html/pandora_console 
- 
-</code> 
- 
-このディレクトリ内の全てのファイルをウェブコンソールのディレクトリ (利用しているディストリビューションにより異なります) にコピーしてください。 
- 
-<code> 
-cp -R /tmp/var/www/html/pandora_console /var/www/html 
- 
-</code> 
- 
-以上でバックアップからリストアされ使えるようになります。 
- 
- 
-==== Pandora FMS の Watchdog 実装 ==== 
- 
-In the code repository, there is a small script that is used as **Watchdog**. This script performs a Pandora FMS status monitoring. 
- 
-コードリポジトリには、"ウォッチドッグ" (Watchdog) として使用できる小さなスクリプトがあります。 このスクリプトは、Pandora FMS の状態監視を実行します。 
- 
-Thus you may perform a recovery operation (trying to start Pandora FMS), and if that fails, a warning must be issued. This tool is at: 
- 
-復旧動作(Pandora FMS の起動を試みる)を実行できますが、失敗した場合は、警告を発行します。このツールは以下にあります。 
- 
-<file> 
- /usr/share/pandora_server/util/pandora_watchdog.sh 
- 
-</file> 
- 
- 
-=== アラート生成スクリプト === 
- 
-The ''pandora_watchdog.sh'' script looks for a file in ''/usr/bin/pandora_alert'' with the instrucctions to generate the alert. This file must be created defining the code to be executed when the **watchdog** cannot lift the Pandora FMS server. In this example, in addition to warning through a SMS, it stops the Tentacle server: 
- 
-''pandora_watchdog.sh'' スクリプトは、''/usr/bin/pandora_alert'' 内の設定ファイルを探し、アラートを生成します。 このファイルには、ウォッチドッグが Pandora FMS サーバを起動できないときに実行するコードを定義します。この例では、SMS を介した警告に加えて、Tentacle サーバを停止します。 
- 
-<code> 
- #!/bin/bash 
- sendsms +34458474843 "The Pandora FMS has suffered some issue and it cannot be started." 
- /etc/init.d/tentacle_serverd stop 
- 
-</code> 
- 
-スクリプトに実行パーミッションを与えます。 
- 
-<code> 
-chmod 750 /usr/bin/pandora_alert 
- 
-</code> 
- 
-=== ウォッチドッグ起動 === 
- 
-To launch the **Watchdog** and leave it workin in the background, execute the following: 
- 
-**ウォッチドッグ**を起動し、バックグラウンドで動作させるには、次のように実行します。 
- 
-<code> 
-nohup /usr/share/pandora_server/util/pandora_watchdog.sh & 
- 
-</code> 
- 
-<WRAP center round important 60%> When starting a **Watchdog**, bear in mind that if for maintenance reasons you wish to manually stop Pandora FMS server, you must also previously have stopped the **Watchdog** process to prevent it from trying to start the sercice automatically continuously. </WRAP> 
- 
-<WRAP center round important 60%> 
-**ウォッチドッグ**を実行しているときに、メンテナンス上の理由で Pandora FMS サーバを手動で停止したい場合は、事前に**ウォッチドッグ**プロセスを停止して、サービスが自動的に起動されないようにする必要があります。 
-</WRAP> 
- 
-==== ヒストリデータベース ==== 
-ヒストリデータベースは、メインの Pandora FMS データベースの応答を良くするために、そこから古いモジュールデータを移動させ保存しておくためのものです。データは、レポートやモジュールグラフの参照時に Pandora FMS コンソールでシームレスに利用できます。 
- 
-=== ヒストリデータベースの作成 === 
-ヒストリデータベースを設定するには、それを格納する(メインのデータベースとは異なる)新たなサーバが必要です。MySQL をインストールしたサーバを準備したら、以下の手順を実行します。 
- 
-  * 新たなヒストリデータベースを作成します。 
- 
-<code> 
-[root@pandorafms ~]# mysql -u root -p 
-mysql> create database pandora_history; 
-</code> 
- 
-  * Pandora FMS データベーススキーマを作成します。Pandora FMS コンソールと共に提供されている ///var/www/html/pandora_console/pandoradb.sql// が利用できます。それをヒストリデータベースサーバへコピーします。 
- 
-  cat pandoradb.sql | mysql -u user -p -D history_db 
- 
-  * ヒストリデータベースにアクセスできるように Pandora FMS サーバとコンソールで利用するユーザのパーミッションを設定します。 
- 
-  GRANT ALL PRIVILEGES ON pandora_history.* TO 'user'@'%' IDENTIFIED BY 'password'; 
-   
-=== ヒストリデータベースの設定 === 
- 
-  * Pandora FMS コンソールにて、設定(setup) -> ヒストリデータベース(History database) を選択し、データベースのホスト名、ポート番号、データベース名、ユーザ名、パスワードを入力します。 
- 
-{{  :wiki:pandora_console_06.png  }} 
- 
-{{  :wiki:pandora_console_06-1.png  }} 
- 
-このフォームの最後のフィールド(//Days//, //step//, //delay//)は、どのデータをヒストリデータベースへ送るかを定義します。//Days// に指定した日より古いデータを、//Step// に指定した行ブロックごとにヒストリデータベースに移動します。高負荷になることを防ぐために、一つのブロックを処理したあとは、次の処理までに //Delay// に指定した時間待ちます。 
- 
-同じ画面で、//イベント日数(Event days)// に指定するイベントの履歴をヒストリデータベースに送信するかどうかを設定することもできます。ただし、イベントを含めるとヒストリデータベースが大幅に大きくなることを考慮する必要があります。また、このデータはイベント表示ではなく、レポートの生成時にのみ参照されます。 
- 
-<WRAP center round tip 60%> 
-ヒストリデータベースの機能は Enterprise 版の機能で、データを転送するのに /usr/bin/pandora_db バイナリを用います。 
-</WRAP> 
- 
-=== ヒストリデータベースの削除と圧縮設定 === 
-ヒストリデータベースは、"過去の全データ" を保存することを想定しています。しかし、古いデータを削除したり圧縮したい場合は、pandora_db スクリプトを通常の DB に対する動作に見せかけて実行する必要があります。そのためには、ヒストリデータベースに何らかのデータが入っている必要があります。 
- 
-最初に、pandora_db ツールによって利用できるように、//tconfig// テーブルを適切な値を入れた状態で用意する必要があります。pandora_db の実行に必要な最小限の設定を行うために、ヒストリデータベースに対して以下の SQL を実行します。まずは、mysql の CLI を利用して、データベースに接続する必要があります。 
- 
-以下が例です。値は必要に応じて書き換えてください。(ただし、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> 
- 
-これは、ヒストリデータベースに(現在からさかのぼること) 6ヶ月間データを保存し、4ヶ月前のデータを圧縮することを意味します。メインのデータベースに 1ヶ月間のデータがあるとしても、トータルで 6ヶ月間のデータとなります。なぜなら、直近 1ヶ月のデータはメインデータベースから読まれ、それ以外はヒストリデータベースから読まれるためです。これらには任意の値を設定できます。ヒストリデータベースにはデータ量の上限はありません。ただし、ヒストリデータベースは、メインデータベースおよび Pandora FMS サーバやコンソールが動作しているマシンとは物理的に異なるマシンに配置しなければいけないことを理解してください。 
- 
-次に、追加の //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> 
- 
- 
-これで、ヒストリデータベースに対して 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/05_big_environments/07_server_management.1643516931.txt.gz
  • 最終更新: 2022/01/30 04:28
  • by junichi