====== サーバ管理 ====== {{indexmenu_n>6}} [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] ===== Pandora FMS サーバ管理 ===== ==== Pandora FMS サーバの手動起動/停止 ==== Bear in mint that if for maintenance reasons you want to manually stop Pandora FMS server, verify whether a service **Watchdog** is running. [[:en:documentation:05_big_environments:07_server_management#watchdog_for_pandora_fms_servers|Check this section]] for more details. メンテナンスにより Pandora FMS サーバを手動で停止する場合は、サービス**ウォッチドッグ**が実行されているかどうかを確認してください。詳細は、[[:ja:documentation:02_installation:06_server_management#pandora_fms_の_watchdog_実装|こちらの章]]を参照してください。 To start or stop manually Pandora FMS server execute the followin in a shell console: Pandora FMS を手動で起動・停止するには、コマンドラインから以下を実行します。 * Stop the //[[:en:documentation:01_understanding:03_glossary#daemon|daemon]]// : * //[[:ja:documentation:01_understanding:03_glossary#daemon|デーモン]]//の停止 : /etc/init.d/pandora_server stop * Start the daemon: * デーモンの起動: /etc/init.d/pandora_server start * Restart the daemon: * デーモンの再起動: /etc/init.d/pandora_server restart \\ Version NG 756 or later.\\ \\ バージョン NG 756 以上\\ 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 the daemon: * デーモンの停止: /etc/init.d/pandora_server stop-server * Start the daemon: * デーモンの起動: /etc/init.d/pandora_server start-server * Restart the daemon: * デーモンの再起動: /etc/init.d/pandora_server restart-server You can monitor the status of **pandora_ha** through **systemd** with: **systemd** を通して次のように **pandora_ha** の状態を確認できます。 systemctl status pandora_ha.service ==== データベース管理 ==== Pandora FMS infrastructure does not need external maintenance, but it is very important to purge old data, and maintain the database as much compacted as possible. There is an essential tool for the proper functioning of Pandora FMS which is in charge of carrying out these tasks. Pandora FMS インフラストラクチャは外部メンテナンスを必要としませんが、古いデータを削除し、データベースをできるだけコンパクトに維持することが非常に重要です。 これらのタスクの実行を担当する Pandora FMS に不可欠なツールがあります。 In Pandora FMS Open version its location is: Pandora FMS オープンソース版では以下にあります。 /usr/share/pandora_server/util/pandora_db.pl {{:wiki:icono-modulo-enterprise.png?23x23 |Versión Enterprise}}Or here in case of Pandora FMS Enterprise version: {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise 版}}Pandora FMS Enterprise 版の場合は以下です。 /usr/bin/pandora_db This tool, hereinafter **pandora_db.pl** is included in Pandora FMS server package, so it must be executed from a system where there is a Pandora FMS server installed. If there are two systems, one for the console and one for the server, **pandora_db** must be executed where Pandora FMS server is hosted. このツール(以降 **pandora_db.pl**)は、Pandora FMS サーバパッケージに含まれているため、Pandora FMS サーバがインストールされているシステムから実行する必要があります。 コンソール用とサーバ用で 2つのシステムがある場合、Pandora FMS サーバがホストされている方で **pandora_db** を実行する必要があります。 **Pandora_db** is a key tool for Pandora FMS to work properly, and that is why its execution is programmed in system cron tasks with an **hourly interval**. Its execution is configured within the file: **Pandora_db** は、Pandora FMS が適切に動作するための重要なツールです。そのため、システムの cron タスクで一時間ごとに実行するように設定されています。 以下のファイルで設定されています。 /etc/cron.hourly/pandora_db このツールは、データベースの全てのメンテナンスを自動的に実行します。 * **It deletes old data**. * **It compresses existing data**, interpolating them at several intervals, so that graphics are the same but the space needed to store them is much smaller (this is one reason why Pandora FMS is able to process such an amount of information). * **It checks the consistency of the database for non-existing modules**, or modules that are not used because they can not be started (these modules appear in the tactical view as uninitialized modules). * **It deletes the daily agent contact information**. Pandora FMS does not need more than 24hr agent contact history, and if it builds up, it slows down database access. * {{:wiki:icono-modulo-enterprise.png?23x23 |Versión Enterprise}}In the enterprise version, it **moves** all old data to the standby history database. * **古いデータの削除をします。** * **既存のデータを圧縮**し、いくつかの間隔を補間します。これにより、グラフは同じですが、それらを保存するために必要なスペースははるかに小さくなります(これが、Pandora FMS が大量の情報を処理できる理由の 1つです)。 * 存在しないモジュールのデータベースでの整合性や、初期化されていないために利用されていないモジュール (これらのモジュールは、未初期化モジュールとして表示されます) を**チェックします**。 * **エージェントの一日の接続情報を削除します**。Pandora FMS は、24時間を越えるエージェント接続情報は必要としません。もし、それが増えると、データベースのアクセス速度が低下します。 * {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise 版}}Enterprise 版では、全ての古いデータをスタンバイデータベースに移動します。 As mentioned before, **pandora_db** execution is configured in system [[http://en.wikipedia.org/wiki/Cron_(Unix)|cron]] tasks and although this execution is automatically included in Pandora FMS server installation, it is convenient to check it. Therefore, ''/etc/cron.hourly/pandora_db'' must exist and contain the following. 前述したように、**pandora_db** の実行はシステムの cron タスクで設定されます。この設定は Pandora FMS サーバのインストールに自動的に含まれますが、確認すると良いでしょう。 ''/etc/cron.hourly/pandora_db'' が存在し、次の行が含まれている必要があります。 In Pandora FMS Open version: Pandora FMS オープンソース版の場合: "/usr/share/pandora_server/util/pandora_db.pl" "/etc/pandora/pandora_server.conf">/dev/null 2>&1 Or in Pandora FMS Enterprise version: Pandora FMS Enterprise 版の場合: "/usr/bin/pandora_db" "/etc/pandora/pandora_server.conf">/dev/null 2>&1 It is equally important to check permissions and the file's owner. The appropriate file permissions would be ''755'', which can be granted by executing: パーミッションとファイルの所有者を確認することも同様に重要です。 正しいパーミッションは ''755'' です。これは、次を実行することで付与できます。 chmod 755 /etc/cron.hourly/pandora_db Regarding the owner, it must be **root** both for the user and group, which is set executing: 所有者に関しては、ユーザとグループ共に "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 オープンソース版の場合: /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf {{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 版の場合: /usr/bin/pandora_db /etc/pandora/pandora_server.conf 次のような出力が表示されます。 {{ :wiki:pandora_fms_db_tool_v7.0ng.757_build_210915.png }} 負荷が高いシステムでは数時間かかる場合があるため、バックグラウンドでプロセスを実行することをお勧めします。 手動でメンテナンスツールをバックグラウンド実行するには、次のようにします。 In Pandora FMS Open version: Pandora FMS オープンソース版の場合: nohup /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server.conf {{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 版の場合: nohup /usr/bin/pandora_db /etc/pandora/pandora_server.conf バックグラウンドでプロセスの実行には少々時間がかかります。プロセスの実行中でも、シェルこのソールを閉じることができます。 インストールの状況によっては、ツールのディレクトリが変わります。ほとんどの場合は以下の通りです。 /usr/share/pandora_server/util/ Pandora FMS の以前のバージョンでは以下にあります。 /usr/share/pandora/util/ 古いバージョンではなく、新しいバージョンのツールを使用していることを確認することが非常に重要です。 引数なしでプログラムを実行すると、メッセージの先頭にツールのバージョンが表示され、サーバにインストールしたバージョンが一致している必要があります。 ==== データベースバックアップ ==== It is important to remember that this **only** backs up or restores the database, //without including other files//, nor the server configuration. これは、他のファイルやサーバ設定を含めずに、データベース**のみ**のバックアップまたは復元であることを認識しておくことが重要です。 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 -p 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 にログインし、復元されるデータベースの作成に進み、そのデータベースにバックアップをロードします。前のファイルを例にすると、次のように実行します。 [root@pandorafms ~]# mysql -u root -p mysql> create database pandora; mysql> use pandora; mysql> source /backup/padnoradb_backup.sql 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'; これは、データベースのバックアップ/リカバリを実行するのみであり、サーバの設定などの他のファイルに対するものではないことに注意してください。 ==== 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 を完全にバックアップおよび復元するのに役立つスクリプトがあります。 このスクリプトは、サーバとコンソールが同じマシン上にあるシステムでのバックアップと復元を目的としています。 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. コンポーネントが複数に分かれた環境の場合は、適切なパラメーターでツールを使用するか、ニーズに合わせてツールを調整する必要があります。 This script needs to be executed as **root**. You are the only **responsible** for said key. It is located at: この処理を実行するには、スクリプトを root 権限で実行する必要があります。スクリプトは以下にあります。 /usr/share/pandora_server/util/pandora_backup.sh 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'' に置き換えて、バックアップ先のパスを指定します。 /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 これは、ディレクトリを含まないデフォルトのリストアです。 ===データベースとディレクトリのリストア=== 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'' を使用します。 /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 //grant// コマンドを使って、データベースのユーザ権限の復元を忘れないようにしてください。 ===ファイルのリストア(データベースではない)=== 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'' オプションを追加します。 /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 === 利用例 === ==バックアップの作成== root で以下を実行します。 /usr/share/pandora_server/util/pandora_backup.sh -c /var/www/html/pandora_console/ -d /tmp/ 次のようなメッセージが表示されます。 Backup completed and placed in /tmp//pandorafms_backup_2021-12-16-16-11-50.tar.gz 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'' にできたことを意味します。 ==バックアップからのリストア== To restore the backup automatically, you need a console with the authentication credentials on the database correctly defined. 自動でバックアップからリストアするために、コマンドラインからデータベースへアクセスできる権限が設定されていると仮定します。 実行: /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 次のような表示がされます。 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 ==コンソール障害時におけるバックアップからのリストア== Pandora FMS コンソールが障害により異常状態になった場合、このツールでバックアップを取得していれば、コンソールをリストアすることができます。そのためには、次のようにバックアップファイルを手動で展開します。 cd /tmp tar zxvf pandorafms_backup_2021-12-16-16-11-50.tar.gz 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'' ディレクトリに展開されます。上記の例のバックアップの場合、次のようなディレクトリが作成されます。 /tmp/var/www/html/pandora_console このディレクトリ内の全てのファイルをウェブコンソールのディレクトリ (利用しているディストリビューションにより異なります) にコピーしてください。 cp -R /tmp/var/www/html/pandora_console /var/www/html 以上でバックアップからリストアされ使えるようになります。 ==== 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 の起動を試みる)を実行できますが、失敗した場合は、警告を発行します。このツールは以下にあります。 /usr/share/pandora_server/util/pandora_watchdog.sh === アラート生成スクリプト === 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 サーバを停止します。 #!/bin/bash sendsms +34458474843 "The Pandora FMS has suffered some issue and it cannot be started." /etc/init.d/tentacle_serverd stop スクリプトに実行パーミッションを与えます。 chmod 750 /usr/bin/pandora_alert === ウォッチドッグ起動 === To launch the **Watchdog** and leave it workin in the background, execute the following: **ウォッチドッグ**を起動し、バックグラウンドで動作させるには、次のように実行します。 nohup /usr/share/pandora_server/util/pandora_watchdog.sh & 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. **ウォッチドッグ**を実行しているときに、メンテナンス上の理由で Pandora FMS サーバを手動で停止したい場合は、事前に**ウォッチドッグ**プロセスを停止して、サービスが自動的に起動されないようにする必要があります。 ==== ヒストリデータベース ==== {{ :wiki:pfms-databases-sql.png?nolink& }} {{:wiki:icono-modulo-enterprise.png?23x23 |Versión Enterprise}}A **history database** is a database where old module data is transferred to make the main Pandora FMS database more responsive for everyday operations. That data will still be available for Pandora FMS console when viewing reports, module charts etc. {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise 版}}ヒストリデータベースは、メインの Pandora FMS データベースの応答を良くするために、そこから古いモジュールデータを移動させ保存しておくためのものです。データは、レポートやモジュールグラフの参照時に Pandora FMS コンソールでシームレスに利用できます。 === ヒストリデータベースの設定 === Version NG 754 and later versions{{:wiki:icono-modulo-enterprise.png?23x23|Enterprise version}}. \\ バージョン NG 754 およびそれ以降{{:wiki:icono-modulo-enterprise.png?23x23|Enterprise 版}} \\ {{:wiki:icono-modulo-enterprise.png?23x23 |Versión Enterprise}}To configure a historical database, it is necessary to have a new server where to host it (**different from the one of the main database**). Once you have that server where MySQL is installed, follow these steps: {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise 版}}ヒストリデータベースを設定するには、それをホストする新しいサーバが必要です(**メインデータベースのサーバとは異なります**)。MySQL がインストールされているサーバを用意したら、次の手順に従います。 In Pandora FMS console, go to ►**Setup** → **Setup** → **Historical database** to access [[:en:documentation:04_using:12_console_setup#the_history_database|connection configuration]] (**Configure connection target**). Pandora FMS コンソールで、**セットアップ(Setup)** → **セットアップ(Setup)** → **ヒストリデータベース(Historical database)** へ行き、[[:ja:documentation:04_using:12_console_setup#ヒストリデータベース|接続設定]] (**接続先設定(Configure connection target)**) にアクセスします。 {{ :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)**: ヒストリデータベースのホスト名(または IP アドレス) * **ポート(Port)**: ヒストリデータベースの接続ポート番号。標準は、''3306'' です。 * **データベース名(Database name)**: ヒストリデータベースの名前。デフォルトは ''pandora'' です。 * **データベースユーザ(Database user)**: ヒストリデータベースユーザ。デフォルトは ''pandora'' です。 * **データベースパスワード(Dabase 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 //日(データ日)//以上前の古いデータが、n 行(//ステップ//)単位で、それぞれの送信単位の間に n 秒(//遅延//)待機しながらヒストリデータベースに移動されます。 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 日を超えるイベントをヒストリデータベースに送信するかどうかを決定することもできます(**アクティブなデータベースにイベントを保持する日数**)。ただし、 イベントはヒストリデータベースを大幅に増大させることと、レポートを生成するときにのみ参照されイベント表示では参照されない点を考慮する必要があります。 {{: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. In addition, you must configure the settings [[:en:documentation:04_using:12_console_setup#history_database_maintenance_options|for the maintenance of the history database]]. {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise 版}}ヒストリデータベースは、''/usr/bin/pandora_db'' バイナリを使用してデータを転送する Enterprise 版の機能です。加えて、[[:ja:documentation:04_using:12_console_setup#ヒストリデータベースメンテナンスオプション|ヒストリデータベースのメンテナンス]]設定を行う必要があります。 === NG 753 およびそれ以前のバージョンにおけるヒストリデータベース === These steps are only for version 753 and previous versions. From version 754 the only thing necessary is to configure the connection values explained in the previous section and Pandora FMS will take care of the whole installation process and the [[:en:documentation:04_using:12_console_setup#history_database_maintenance_options|maintenance of the historical database]]. こちらの手順は、バージョン 753 およびそれ以前のバージョンのみを対象としています。バージョン 754 以降、必要なのは前の章で説明した接続値を設定することだけです。Pandora FMS は、インストールプロセス全体と [[:ja:documentation:04_using:12_console_setup#ヒストリデータベースメンテナンスオプション|ヒストリデータベースのメンテナンス]]を処理します。 {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise version}}To configure a historical database, it is necessary to have a new server where to host it (**different from the one of the main database**). Once you have that server where MySQL is installed, follow these steps: {{:wiki:icono-modulo-enterprise.png?23x23 |Enterprise 版}}ヒストリデータベースを設定するには、それを格納する(メインのデータベースとは異なる)新たなサーバが必要です。MySQL をインストールしたサーバを準備したら、以下の手順を実行します。 * Create the new historical database: * 新たなヒストリデータベースを作成します。 [root@pandorafms ~]# mysql -u root -p mysql> create database pandora_history; * Create Pandora FMS database schema. You may use the script ''/var/www/html/pandora_console/pandoradb.sql'' included in Pandora FMS console, copying it to the historical database server: * Pandora FMS データベーススキーマを作成します。Pandora FMS コンソールと共に提供されている ''/var/www/html/pandora_console/pandoradb.sql'' が利用できます。それをヒストリデータベースサーバへコピーします。 cat pandoradb.sql | mysql -u root -p -D pandora_history * Grant permissions to a user (''user'' and ''password)'' which will be used from the Pandora FMS server and console to send and check historical data: * ヒストリデータベースにアクセスできるように Pandora FMS サーバとコンソールで利用するユーザのパーミッション(''user'' と ''password'')を設定します。 **For MySQL 5.7** **MySQL 5.7 向け:** GRANT ALL PRIVILEGES ON pandora_history.* TO 'user'@'%' IDENTIFIED BY 'password'; **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// を実行する前に次のようにターミナルで設定するだけです。 env TZ='Europe/Madrid' \ DBHOST='127.0.0.1' \ DBNAME='pandora' \ DBUSER='pandora' \ DBPASS='pandora' \ DBPORT='3306' \ DBROOTPASS='pandora' Enter in the terminal: ターミナルで以下を実行します: systemctl restart mysql Enter in the terminal: ターミナルで以下を実行します: 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 The history database (DB) can contain //all the system data// (without limit), but if you want to delete data or compact them from the history database, you will need to use specific data in the database that the **pandora_db** script takes into account when executing from the node. ヒストリデータベース(DB)には//すべてのシステムデータ//(無制限)を含めることができますが、ヒストリデータベースからデータを削除または圧縮する場合は、**pandora_db** スクリプトがノードから実行される際の設定を示すデータベース内の特定のデータを使用する必要があります。 Remember that all these steps are only for version 753 and earlier versions. これらの手順はすべて、バージョン 753 以前のバージョンのみを対象としていることに注意してください。 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 database. First you need to connect to your database using the command line (CLI) of MySQL. まず、ヒストリデータベースのデータを //tconfig// テーブルに入力します。 この SQL クエリを使用して最小限の設定を作成し、**pandora_db** がヒストリデータベースに対して実行される際の設定をします。 まず、MySQL のコマンドライン(CLI)を使用してデータベースに接続する必要があります。 This is an example, replace values according to your criteria (but leave ''history_db_enabled'' at zero): これは例です。値は好みに応じて置き換えます(ただし、''history_db_enabled'' はゼロのままにします)。 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',''); * Take special care to replace ''< actual MR value >'' with the current MR value that you currently have in the main Pandora FMS server. * This example is for the history database ito store for 6 months (180 days) from the execution date (''days_purge''). * Compact data more than 120 days old (''days_compact''). * 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 (''event_purge'' y ''string_purge''). * //Use the values that you think convenient// (except for ''MR'' and ''history_db_enabled''). The limit in the storage of the history database only depends on the free space of the machine. **Just remember that the history database must be in a physical server independent** from the main database and Pandora FMS. * ''< actual MR value >'' を、メインの Pandora FMS サーバの現在の MR 値に置き換える場合は特に注意してください。 * この例は、ヒストリデータベースに過去 6ヵ月間(180日)のデータを保存します。(''days_purge'') * 120日より古いデータを圧縮します。(''days_compact'') * メインデータベースに最低 1ヵ月分のデータがある場合、前月分がヒストリデータベースになくてもメインデータベースにはデータがあるため、合計 6か月のデータを参照できます。(''event_purge'' および ''string_purge'') * //各値は任意に変更してください//(''MR'' および ''history_db_enables'' は除く)。ヒストリデータベースのストレージの上限は、マシンの空き容量にのみ依存します。 **ヒストリデータベースは、メインデータベースおよび Pandora FMS から独立した物理サーバ** にある必要があることに注意してください。 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. Pandora FMS 753 以前のバージョンでは、通常のデータベースのように、データベースであらかじめ設定したデータを使用してヒストリデータベースサーバ自体でメンテナンススクリプト **pandora_db** を実行し、さらに以下で説明するように設定ファイルを作成する必要があります。 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'' という名前を付けます。 dbengine mysql dbname pandora_history dbuser user dbpass password dbhost 192.168.70.140 log_file /var/log/pandora/pandora_db_history.log Remember that all these steps are only for version 753 and earlier versions. これらの手順はすべて、バージョン 753 以前のバージョンのみを対象としていることに注意してください。 Now you can execute **pandora_db** tool against the history database configuration and program it for its periodical execution: これで、ヒストリデータベースに対して **pandora_db** ツールを実行できるようになり、定期的に実行するように設定できます。 /usr/share/pandora_server/util/pandora_db.pl /etc/pandora/pandora_server_history_db.conf This process SHOULD NOT affect your main operation because it is running against a different database in a different server. この処理は、別のサーバの別のデータベースに対して実行されるため、メインのデータベースには影響を与えません。 [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]]