差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
ja:documentation:05_big_environments:07_server_management [2022/01/30 05:12] – [Pandora FMS サーバの手動起動/停止] junichi | ja:documentation:05_big_environments:07_server_management [2023/11/14 06:16] (現在) – 削除 junichi | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== サーバ管理 ====== | ||
- | {{indexmenu_n> | ||
- | |||
- | [[ja: | ||
- | |||
- | ===== Pandora FMS サーバ管理 ===== | ||
- | |||
- | ==== Pandora FMS サーバの手動起動/ | ||
- | |||
- | <WRAP center round info 75%> Bear in mint that if for maintenance reasons you want to manually stop Pandora FMS server, verify whether a service **Watchdog** is running. [[: | ||
- | |||
- | <WRAP center round info 75%> メンテナンスにより Pandora FMS サーバを手動で停止する場合は、サービス**ウォッチドッグ**が実行されているかどうかを確認してください。詳細は、[[: | ||
- | |||
- | To start or stop manually Pandora FMS server execute the followin in a shell console: | ||
- | |||
- | Pandora FMS を手動で起動・停止するには、コマンドラインから以下を実行します。 | ||
- | |||
- | * Stop the // | ||
- | |||
- | * // | ||
- | |||
- | < | ||
- | |||
- | / | ||
- | |||
- | </ | ||
- | |||
- | * Start the daemon: | ||
- | |||
- | * デーモンの起動: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | * Restart the daemon: | ||
- | |||
- | * デーモンの再起動: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round tip 60%>\\ | ||
- | Version NG 756 or later.\\ | ||
- | </ | ||
- | |||
- | <WRAP center round tip 60%>\\ | ||
- | バージョン 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: | ||
- | |||
- | * デーモンの停止: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | * Start the daemon: | ||
- | |||
- | * デーモンの起動: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | * Restart the daemon: | ||
- | |||
- | * デーモンの再起動: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | You can monitor the status of **pandora_ha** through **systemd** with: | ||
- | |||
- | **systemd** を通して次のように **pandora_ha** の状態を確認できます。 | ||
- | |||
- | < | ||
- | systemctl status pandora_ha.service | ||
- | |||
- | </ | ||
- | |||
- | |||
- | ==== データベース管理 ==== | ||
- | Pandora FMS インフラストラクチャは外部メンテナンスを必要としませんが、古いデータを削除し、データベースをできるだけコンパクトに維持することが非常に重要です。 これらのタスクの実行を担当する Pandora FMS に不可欠なツールが以下にあります。 | ||
- | |||
- | / | ||
- | |||
- | Pandora FMS Enterprise 版の場合は以下です。 | ||
- | |||
- | / | ||
- | |||
- | このツール(以降 **pandora_db.pl**)は、Pandora FMS サーバパッケージに含まれているため、Pandora FMS サーバがインストールされているシステムから実行する必要があります。 コンソール用とサーバ用で 2つのシステムがある場合、Pandora FMSサーバがホストされている方で // | ||
- | // | ||
- | |||
- | / | ||
- | |||
- | このツールは、データベースの全てのメンテナンスを自動的に実行します。 | ||
- | |||
- | * 古いデータの削除をします。 | ||
- | |||
- | * 既存のデータを圧縮し、いくつかの間隔を補間します。これにより、グラフは同じですが、それらを保存するために必要なスペースははるかに小さくなります(これが、Pandora FMS が大量の情報を処理できる理由の 1つです)。 | ||
- | |||
- | * 存在しないモジュールのデータベースでの整合性や、初期化されていないために利用されていないモジュール (これらのモジュールは、未初期化モジュールとして表示されます) をチェックします。 | ||
- | |||
- | * エージェントの一日の接続情報を削除します。Pandora FMS は、24時間を越えるエージェント接続情報は必要としません。もし、それが増えると、データベースのアクセス速度が低下します。 | ||
- | |||
- | * エンタープライズ版では、全ての古いデータをスタンバイデータベースに移動します。 | ||
- | |||
- | 前述したように、// | ||
- | |||
- | "/ | ||
- | |||
- | Pandora FMS Enterprise 版では以下の通りです。 | ||
- | |||
- | "/ | ||
- | |||
- | パーミッションとファイルの所有者を確認することも同様に重要です。 正しいパーミッションは 755 です。これは、次を実行することで付与できます。 | ||
- | |||
- | chmod 755 / | ||
- | |||
- | 所有者に関しては、ユーザとグループ共に " | ||
- | |||
- | chown root:root / | ||
- | |||
- | ==== メンテナンスツールの手動実行 ==== | ||
- | |||
- | 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 オープンソース版の場合: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | {{https:// | ||
- | |||
- | {{https:// | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | 次のような出力が表示されます。 | ||
- | |||
- | {{ : | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 負荷が高いシステムでは数時間かかる場合があるため、バックグラウンドでプロセスを実行することをお勧めします。 | ||
- | </ | ||
- | |||
- | 手動でメンテナンスツールをバックグラウンド実行するには、次のようにします。 | ||
- | |||
- | In Pandora FMS Open version: | ||
- | |||
- | Pandora FMS オープンソース版の場合: | ||
- | |||
- | < | ||
- | nohup / | ||
- | |||
- | </ | ||
- | |||
- | {{https:// | ||
- | |||
- | {{https:// | ||
- | |||
- | < | ||
- | nohup / | ||
- | |||
- | </ | ||
- | |||
- | バックグラウンドでプロセスの実行には少々時間がかかります。プロセスの実行中でも、シェルこのソールを閉じることができます。 | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | インストールの状況によっては、ツールのディレクトリが変わります。ほとんどの場合は以下の通りです。 | ||
- | |||
- | / | ||
- | |||
- | Pandora FMS の以前のバージョンでは以下にあります。 | ||
- | |||
- | / | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | 古いバージョンではなく、新しいバージョンのツールを使用していることを確認することが非常に重要です。 引数なしでプログラムを実行すると、メッセージの先頭にツールのバージョンが表示され、サーバにインストールしたバージョンが一致している必要があります。 | ||
- | </ | ||
- | |||
- | ==== データベースバックアップ ==== | ||
- | |||
- | <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 center round important 60%> これは、他のファイルやサーバ設定を含めずに、データベース**のみ**のバックアップまたは復元であることを認識しておくことが重要です。</ | ||
- | |||
- | 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 < | ||
- | |||
- | For instance, to backup " | ||
- | |||
- | 例えば、" | ||
- | |||
- | mysqldump -u root -p pandora > / | ||
- | |||
- | 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 / | ||
- | </ | ||
- | |||
- | 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 '' | ||
- | |||
- | 最後に、Pandora FMS コンソールとサーバの両方で設定済みのユーザ権限を再度設定し、データベースへのアクセス権を付与します。('' | ||
- | |||
- | grant all privileges on pandora.* to pandora@localhost identified by ' | ||
- | |||
- | <WRAP center round important 60%> | ||
- | これは、データベースのバックアップ/ | ||
- | </ | ||
- | |||
- | ==== 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, | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | |||
- | This script needs to be executed as **root**. You are the only **responsible** for said key. It is located at: | ||
- | |||
- | この処理を実行するには、スクリプトを root 権限で実行する必要があります。スクリプトは以下にあります。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | If it is executed without parameters, it will show the help menu: | ||
- | |||
- | 引数無しで実行すると、ヘルプを表示します。 | ||
- | |||
- | {{ : | ||
- | |||
- | このスクリプトは、次のコンポーネントのバックアップとリストアをするように設計されています。 | ||
- | |||
- | * **Server configuration** | ||
- | * Files **waiting for execution**, | ||
- | * 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 '' | ||
- | |||
- | このスクリプトは、ウェブコンソールの設定ファイルに設定されている DB のアクセス情報を利用します。そのため、ウェブコンソールの設定ファイルのパスを '' | ||
- | このパラメータは、ウェブコンソールのバックアップを取得するためにも利用されます。 | ||
- | |||
- | The backup' | ||
- | |||
- | パックアップ**先**は、// | ||
- | |||
- | そのようにして、次のコマンドは完全な環境バックアップを実行します。 | ||
- | |||
- | / | ||
- | |||
- | With the '' | ||
- | |||
- | '' | ||
- | |||
- | / | ||
- | |||
- | ===データベースリストア=== | ||
- | |||
- | To restore the database with the script, replace the parameter '' | ||
- | |||
- | スクリプトでデータベースをリストアするには、パラメーター '' | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | これは、ディレクトリを含まないデフォルトのリストアです。 | ||
- | |||
- | ===データベースとディレクトリのリストア=== | ||
- | |||
- | The '' | ||
- | |||
- | '' | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> | ||
- | //grant// コマンドを使って、データベースのユーザ権限の復元を忘れないようにしてください。 | ||
- | </ | ||
- | |||
- | ===ファイルのリストア(データベースではない)=== | ||
- | |||
- | Same as with the previous option, it is possible to restore only the files, without including the database. To do it, add the '' | ||
- | |||
- | 前のオプションと同じように、データベースを含めずにファイルのみを復元できます。 それを行うには、上記の実行例に '' | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | |||
- | === 利用例 === | ||
- | |||
- | ==バックアップの作成== | ||
- | |||
- | root で以下を実行します。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | 次のようなメッセージが表示されます。 | ||
- | |||
- | < | ||
- | Backup completed and placed in / | ||
- | |||
- | </ | ||
- | |||
- | This means that the backup is at, in this case: | ||
- | ''/ | ||
- | |||
- | これは、バックアップが ''/ | ||
- | |||
- | ==バックアップからのリストア== | ||
- | |||
- | <WRAP center round info 60%>To restore the backup automatically, | ||
- | |||
- | <WRAP center round info 60%> | ||
- | |||
- | 実行: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | 次のような表示がされます。 | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | Done. Backup in / | ||
- | |||
- | </ | ||
- | |||
- | ==コンソール障害時におけるバックアップからのリストア== | ||
- | |||
- | 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 ''/ | ||
- | |||
- | これより、ウェブコンソールのファイルが ''/ | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | このディレクトリ内の全てのファイルをウェブコンソールのディレクトリ (利用しているディストリビューションにより異なります) にコピーしてください。 | ||
- | |||
- | < | ||
- | cp -R / | ||
- | |||
- | </ | ||
- | |||
- | 以上でバックアップからリストアされ使えるようになります。 | ||
- | |||
- | |||
- | ==== 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. | ||
- | |||
- | コードリポジトリには、" | ||
- | |||
- | 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 の起動を試みる)を実行できますが、失敗した場合は、警告を発行します。このツールは以下にあります。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | |||
- | === アラート生成スクリプト === | ||
- | |||
- | The '' | ||
- | |||
- | '' | ||
- | |||
- | < | ||
- | # | ||
- | | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | スクリプトに実行パーミッションを与えます。 | ||
- | |||
- | < | ||
- | chmod 750 / | ||
- | |||
- | </ | ||
- | |||
- | === ウォッチドッグ起動 === | ||
- | |||
- | To launch the **Watchdog** and leave it workin in the background, execute the following: | ||
- | |||
- | **ウォッチドッグ**を起動し、バックグラウンドで動作させるには、次のように実行します。 | ||
- | |||
- | < | ||
- | nohup / | ||
- | |||
- | </ | ||
- | |||
- | <WRAP center round important 60%> When starting a **Watchdog**, | ||
- | |||
- | <WRAP center round important 60%> | ||
- | **ウォッチドッグ**を実行しているときに、メンテナンス上の理由で Pandora FMS サーバを手動で停止したい場合は、事前に**ウォッチドッグ**プロセスを停止して、サービスが自動的に起動されないようにする必要があります。 | ||
- | </ | ||
- | |||
- | ==== ヒストリデータベース ==== | ||
- | |||
- | {{: | ||
- | |||
- | {{: | ||
- | |||
- | === ヒストリデータベースの作成 === | ||
- | |||
- | {{: | ||
- | |||
- | {{: | ||
- | |||
- | * 新たなヒストリデータベースを作成します。 | ||
- | |||
- | < | ||
- | [root@pandorafms ~]# mysql -u root -p | ||
- | mysql> create database pandora_history; | ||
- | </ | ||
- | |||
- | * Create Pandora FMS database schema. You may use the script ''/ | ||
- | |||
- | * Pandora FMS データベーススキーマを作成します。Pandora FMS コンソールと共に提供されている ''/ | ||
- | |||
- | cat pandoradb.sql | mysql -u user -p -D history_db | ||
- | |||
- | * Grant permissions to a user ('' | ||
- | |||
- | * ヒストリデータベースにアクセスできるように Pandora FMS サーバとコンソールで利用するユーザのパーミッション('' | ||
- | |||
- | GRANT ALL PRIVILEGES ON pandora_history.* TO ' | ||
- | | ||
- | === ヒストリデータベースの設定 === | ||
- | |||
- | {{: | ||
- | |||
- | {{: | ||
- | |||
- | {{ : | ||
- | |||
- | 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: '' | ||
- | * **Database name**: Name of the history database. Default value: '' | ||
- | * **Database user**: History database user. Default value: '' | ||
- | * **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)**: | ||
- | * **ポート(Port)**: | ||
- | * **データベース名(Database name)**: ヒストリデータベースの名前。デフォルトは '' | ||
- | * **データベースユーザ(Database user)**: ヒストリデータベースユーザ。デフォルトは '' | ||
- | * **データベースパスワード(Database password)**: | ||
- | |||
- | {{ : | ||
- | |||
- | The last fields of this form **Data days old to keep in active database, Transference block size (Step)** | ||
- | |||
- | このフォームの最後のフィールド **アクティブなデータベースに保持するデータ日数、転送ブロックサイズ(ステップ)** および **転送の遅延(秒)** は、データをヒストリデータベースに送信される方法を定義します。つまり、n //日(Data days)// を超える最も古いデータは、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**), | ||
- | |||
- | 同じ画面で、n日を超えるイベントをヒストリデータベースに送信するかどうかを決定することもできます(**アクティブなデータベースに保持する古いイベント(Events days old to keep in active database)**)。ただし、イベントはヒストリデータベースの増大率を大幅に増加させます。また、これらはイベント表示ではなく、レポートを生成するときにのみ参照されます。 | ||
- | |||
- | <WRAP center round tip 75%> {{: | ||
- | |||
- | <WRAP center round tip 75%> {{: | ||
- | ヒストリデータベースの機能は Enterprise 版の機能で、データを転送するのに ''/ | ||
- | </ | ||
- | |||
- | === ヒストリデータベースの削除と圧縮設定 === | ||
- | |||
- | 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. | ||
- | |||
- | ヒストリデータベースは、" | ||
- | |||
- | 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 ツールによって利用できるように、// | ||
- | |||
- | This is an example, replace values according to your criteria (but leave '' | ||
- | |||
- | 以下が例です。値は必要に応じて書き換えてください。(ただし、history_db_enabled は 0 にしてください) | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | * 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' | ||
- | |||
- | * この例は、ヒストリデータベースに(現在からさかのぼること) 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** | ||
- | |||
- | <WRAP center round tip 75%> Pandora FMS 753 より前のバージョンでは、通常のデータベースと同じように、前述のデータベースと以降で説明する追加の設定ファイルを用いてヒストリサーバでメンテナンスのために **pandora_db** スクリプトを実行する必要があります。</ | ||
- | |||
- | In versions prior to Pandora FMS 753, create an additional '' | ||
- | |||
- | Pandora FMS 753 までのバージョンでは、追加の '' | ||
- | |||
- | < | ||
- | dbengine mysql | ||
- | dbname pandora4_history | ||
- | dbuser pandora4_history | ||
- | dbpass 1234 | ||
- | dbhost 192.168.50.23 | ||
- | log_file / | ||
- | </ | ||
- | |||
- | Now you can execute **pandora_db** | ||
- | |||
- | これで、ヒストリデータベースに対して **pandora_db** ツールの定期実行をプログラムできます。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | また、設定値は[[: | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | この処理は、メインのデータベースには影響しません。なぜなら、異なるサーバの異なるデータベースに対して行っているためです。 | ||
- | </ | ||
- | |||
- | [[ja: | ||