差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
ja:documentation:05_big_environments:07_server_management [2022/01/30 04:29] – [ヒストリデータベース] junichi | ja:documentation:05_big_environments:07_server_management [2023/11/14 06:16] (現在) – 削除 junichi | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== サーバ管理 ====== | ||
- | {{indexmenu_n> | ||
- | [[ja: | ||
- | |||
- | ===== 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: | ||
- | |||
- | デーモンの停止: | ||
- | < | ||
- | |||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Start daemon: | ||
- | |||
- | デーモンの起動: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Restart 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 daemon: | ||
- | |||
- | デーモンの停止: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Start daemon: | ||
- | |||
- | デーモンの起動: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | Restart 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 サーバを手動で停止したい場合は、事前に**ウォッチドッグ**プロセスを停止して、サービスが自動的に起動されないようにする必要があります。 | ||
- | </ | ||
- | |||
- | ==== ヒストリデータベース ==== | ||
- | |||
- | {{: | ||
- | |||
- | {{: | ||
- | |||
- | === ヒストリデータベースの作成 === | ||
- | ヒストリデータベースを設定するには、それを格納する(メインのデータベースとは異なる)新たなサーバが必要です。MySQL をインストールしたサーバを準備したら、以下の手順を実行します。 | ||
- | |||
- | * 新たなヒストリデータベースを作成します。 | ||
- | |||
- | < | ||
- | [root@pandorafms ~]# mysql -u root -p | ||
- | mysql> create database pandora_history; | ||
- | </ | ||
- | |||
- | * Pandora FMS データベーススキーマを作成します。Pandora FMS コンソールと共に提供されている /// | ||
- | |||
- | cat pandoradb.sql | mysql -u user -p -D history_db | ||
- | |||
- | * ヒストリデータベースにアクセスできるように Pandora FMS サーバとコンソールで利用するユーザのパーミッションを設定します。 | ||
- | |||
- | GRANT ALL PRIVILEGES ON pandora_history.* TO ' | ||
- | | ||
- | === ヒストリデータベースの設定 === | ||
- | |||
- | * Pandora FMS コンソールにて、設定(setup) -> ヒストリデータベース(History database) を選択し、データベースのホスト名、ポート番号、データベース名、ユーザ名、パスワードを入力します。 | ||
- | |||
- | {{ : | ||
- | |||
- | {{ : | ||
- | |||
- | このフォームの最後のフィールド(// | ||
- | |||
- | 同じ画面で、// | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | ヒストリデータベースの機能は Enterprise 版の機能で、データを転送するのに / | ||
- | </ | ||
- | |||
- | === ヒストリデータベースの削除と圧縮設定 === | ||
- | ヒストリデータベースは、" | ||
- | |||
- | 最初に、pandora_db ツールによって利用できるように、// | ||
- | |||
- | 以下が例です。値は必要に応じて書き換えてください。(ただし、history_db_enabled は 0 にしてください) | ||
- | |||
- | < | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | </ | ||
- | |||
- | これは、ヒストリデータベースに(現在からさかのぼること) 6ヶ月間データを保存し、4ヶ月前のデータを圧縮することを意味します。メインのデータベースに 1ヶ月間のデータがあるとしても、トータルで 6ヶ月間のデータとなります。なぜなら、直近 1ヶ月のデータはメインデータベースから読まれ、それ以外はヒストリデータベースから読まれるためです。これらには任意の値を設定できます。ヒストリデータベースにはデータ量の上限はありません。ただし、ヒストリデータベースは、メインデータベースおよび Pandora FMS サーバやコンソールが動作しているマシンとは物理的に異なるマシンに配置しなければいけないことを理解してください。 | ||
- | |||
- | 次に、追加の // | ||
- | |||
- | < | ||
- | dbengine mysql | ||
- | dbname pandora4_history | ||
- | dbuser pandora4_history | ||
- | dbpass 1234 | ||
- | dbhost 192.168.50.23 | ||
- | log_file / | ||
- | </ | ||
- | |||
- | |||
- | これで、ヒストリデータベースに対して pandora_db ツールの定期実行をプログラムできます。 | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | </ | ||
- | |||
- | また、設定値は[[: | ||
- | |||
- | <WRAP center round tip 60%> | ||
- | この処理は、メインのデータベースには影響しません。なぜなら、異なるサーバの異なるデータベースに対して行っているためです。 | ||
- | </ |