# 12. Pandora FMSプラグインの使い方。

プラグインは、Pandora が複雑な処理を必要とする情報や、複雑なシステムやAPIを利用する情報を取得することを可能にします。プラグインの例: MySQL データベースのモニタリング。

このクイックガイドでは、Pandora FMS にデフォルトで含まれているプラグインの例を紹介します。

#### サーバー・プラグイン

Pandora FMS には、デフォルトでいくつかのプラグインが登録されています。 Pandora FMS に登録されているサーバプラグインを表示するには、管理 -&gt; サーバ -&gt; プラグイン を参照してください (**Management → Servers → Plugins**)。この種のプラグインは、一つの値しか返しません。

これらのプラグインは、`/usr/share/pandora_server/util/plugin/` ディレクトリに保存され、サーバによって実行されます。

[![plugins1-1.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugins1-1.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugins1-1.png)

<p class="callout info">このタイプのプラグインを使用するには、`/etc/pandora/pandora_server.conf` ファイルでプラグインサーバを有効にする必要があります。</p>

プラグインタイプのリモートモジュールを作成するには、エージェントエディションのモジュールタブに移動します：

[![plugin2.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin2.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin2.png)

プラグイン・サーバー・モジュールを作成する。

[![plugin3-1.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin3-1.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin3-1.png)

このタイプのモジュールでは、プラグインのドロップダウンがあり、使用するプラグインを選択することができます。

この例では、Packet Lossプラグインを使用して、サーバーと宛先間の時間スパンで失われたパケット数をチェックしている。

[![plugin5-1.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin5-1.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin5-1.png)

必要な情報をフィールドに入力します。パケットロス プラグインの場合は、テスト時間と宛先IPを定義します。

設定されたモジュールはこのようになる：

[![plugin6.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin6.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin6.png)

例えば、MySQLプラグインの場合、MySQLサーバーのIP、ユーザー名とパスワード、抽出したいデータを定義する必要があります。

[![plugin7.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin7.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin7.png)

モジュールを作成してから数秒後、モジュールとその取得値がエージェントのビューに表示されます：

[![plugin8.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin8.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin8.png)

[![plugin9.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin9.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin9.png)

#### エージェント・プラグイン

##### GNU/Linux

このようなプラグインは、ソフトウェアエージェントから保存・実行され、複数の値を返すことができる。

これらのプラグインは、ローカルエージェントの `/usr/share/pandora_agent/plugins/` ディレクトリに保存され、設定ファイル `/etc/pandora/pandora_agent.conf` で定義されます。

この例では、top.shと呼ばれるプラグインが使用されており、エージェント内で実行されているプロセスを表示します。

[![plugin10-1.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin10-1.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin10-1.png)

作成されたモジュールとその値（プラグインによっては値）を見るには、コンソールのソフトウェアエージェントビューに行く。

[![plugin8.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin8.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin8.png)

このアイコンをクリックすると、エージェントプラグインを通して機器から抽出されたプロセスのリストが表示されます。

[![plugin10-2.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin10-2.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin10-2.png)

[![plugin11.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin11.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin11.png)

##### MS Windows

プラグインは、`C:\Program Files\pandora_agent\util\`ディレクトリに格納され、設定ファイル`C:\Program Files\pandora_agent\pandora_agent.conf`で定義されます。

GNU/Linuxと同様、設定ファイルに定義されたプラグインの例がいくつかある。

[![plugin12.png](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/scaled-1680-/plugin12.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2023-10/plugin12.png)

この章で説明した結果は達成されていませんか? [ヘルプ](https://pandorafms.com/guides/public/books/pandora-fms/page/21)または[サポート](https://pandorafms.com/guides/public/books/pandora-fms/page/22)セクションにアクセスします。