====== プラグイン開発において考慮すべき点 ====== {{indexmenu_n>4}} [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]] ===== 概要 ===== The plugins allows to Pandora FMS to get information that requires a complex process or that requires the use of complex systems or APIs. Examples of plugins could be the Oracle® database monitoring that requires a complex process for the monitoring and also some auto-discovery tasks. Other example could be a simple HTML parse, but that requires some that Goliat ([[:en:documentation:01_understanding:02_architecture#the_web_server_goliat|checking web server]]) can't do. プラグインにより Pandora は、複雑な処理を必要とするものや、複雑なシステムや API を利用する必要のある情報収集を実行することができます。プラグインの例をあげると、複雑な処理が必要な Oracle データベースのモニタリングや、何らかの自動検出処理があります。他には、Goliat ([[:ja:documentation:01_understanding:02_architecture#ウェブサーバ_goliat|ウェブサーバチェック]]) が実行できないような簡単な HTML のパースができます。 ===== 実装とパフォーマンスの違い ===== Pandora FMS offers two possibilities when executing plugins: execution in the [[:en:documentation:01_understanding:02_architecture#pandora_fms_software_agents|Software agent]] or in the server. Pandora のプラグイン実行には、[[:ja:documentation:01_understanding:02_architecture#pandora_fms_のソフトウエアエージェント|ソフトウエアエージェント]]での実行とサーバでの実行の二種類があります。 サーバプラグインは、収集する情報ごとに個々に実行されます。サーバプラグインの実行は、重くなく、一つの種類の情報を取得するのを簡単な処理にする必要があるため、とても難しいです。特定の HTML をパースするプラグインは、多くの処理を実装せずにサーバに負荷をかけないようにする必要があります。 エージェントプラグインは、同時に複数のモジュールの情報を取得することができます。このことにより、サーバプラグインよりより柔軟性があります。一つの情報を取得するのに多くの処理が必要なプラグインに適しています。そのため、同時に複数のモジュールの値を返すことができ、開発者にとってより柔軟性があります。 ===== 自動検出処理 ===== プラグインで自動検出処理を実行するには、次の二種類の方法があります。 一つは、Pandora サーバの自動検出サーバを利用しての構成です。これを行うには、特定の技術や状況に応じてアドホックなコードを作成する必要があります。自動検出処理は、Pandora サーバに負荷を与えます。そのため、大量のデータ処理が必要な場合は、この選択枝は考えるべきではありません。 エージェントプラグインを用いても自動検出処理を作成することができます。通常、エージェントプラグインは、Pandora サーバに対して送信する XML に記載されたモジュールを返します。しかし、エージェントのインストールと一緒にプラグインをインストールし、tentacle も入っていれば、Pandora サーバに XML を送信することができます。自動検出処理をエージェントプラグインから実行するには、この方法を利用することができます。さらに、通常のプラグインの実行と同じように、モジュールを追加します。自動検出処理が実行するように、エージェントの更新情報を Pandora へ XML で送信するようにプラグインを用意します。 プラグインにより平均的なモジュールの作成および情報収集を行ったり、必要に応じて他のエージェントをシミュレートするXMLを作成して送信するという考え方です。 XML でデータを送信するプラグインを作成する理由は、自動検出処理の負荷をサーバに集中させずに分散することにあります。 ===== サーバプラグインとエージェントプラグイン ===== A [[:en:documentation:08_technical_reference:05_anexo_server_plugins_development|server plugin]] should be used when: [[:ja:documentation:08_technical_reference:05_anexo_server_plugins_development|サーバプラグイン]]は次のような場面で利用すべきです。 * The load of each execution is small, for example, simple queries. * If the Recon Task requires low data process. * If the Recon Task execution intervals are large, for example, once a week * 実行負荷が小さい場合。例えば単純な処理など。 * 自動検出処理のデータ処理量が少ない場合。 * 自動検出処理の実行間隔が長い場合。例えば、1週間に一度など。 An [[:en:documentation:08_technical_reference:06_anexo_agent_plugins|agent plugin]] will be used when: [[:ja:documentation:08_technical_reference:06_anexo_agent_plugins|エージェントプラグイン]]は次のような場面で利用すべきです。 * 情報収集において多くの処理がある場合。 * 自動検出処理で高い負荷がかかる場合。 * 自動検出処理の実行間隔が通常のエージェントの実行間隔に近い場合。例えば、5分間隔など。 ===== 開発における標準化 ===== In order that all plugins would be the more standard possible, and that they have similar features, you should consider the following aspects: すべてのプラグインを可能な限り標準化し、同様の機能を持たせるには、次の点を考慮する必要があります。 ==== プラグインと拡張のバージョン管理 ==== In Pandora FMS we follow a system of versions for the plugins that has the following format: Pandora FMS では、次の形式のプラグインのバージョンシステムに従います。 v1r1 Being: ここで: * vX: plugin version, the step of one version to another is made when a new important functionality is added or an error that makes impossible the correct working of the plugin is corrected.The first version is the v1. * rY: Plugin revisión, * vX: プラグインのバージョンです。新しい重要な機能が追加されたり、プラグインが正常動作しないような不具合が修正されたりしたときに、あるバージョンから別のバージョンへあげられます。最初のバージョンは v1 です。 * rY: プラグインのリビジョンです。 The change to one revision to another is done when any bug is fixed or a minor feature is implemented. The first revision is the r1. el paso de una revisión a otra se produce cuando se arregla algún bug o se implementa una feature menor. La primera revisión es la r1. あるリビジョンから別のリビジョンへの変更は、バグが修正されたとき、またはマイナーな機能が実装されたときに行われます。 最初のリビジョンは r1 です。 Always that there would be a change to a new version, should be started by the first revision, that is, if we have a plugin in the version v1r5 and we want to get a higher number of version, then we will have v2r1. 常に最初のリビジョンから開始し、新しいバージョンへ変更していく必要があります。つまり、バージョン v1r5 のプラグインに対して、より新しいバージョンを定義したい場合は、v2r1 などになります。 ==== 使い方とプラグインのバージョン ==== All plugins should respond to a call without parameters, or also with an option type -h or --help, showing the command for its execution and the different parameters of it.Besides, it will be necessary to show the version of the plugin. For example: すべてのプラグインは、パラメータなし、またはオプション -h または --help を使用した呼び出しに応答し、実行用のコマンドとそのさまざまなパラメータを表示する必要があります。さらに、プラグインのバージョンを表示する必要があります。 例えば: $ ./myplugin myplugin version: v1r1 Usage myplugin [[ja:documentation:start|Pandora FMS ドキュメント一覧に戻る]]