差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
ja:documentation:pandorafms:technical_reference:01_development_and_extension [2024/09/01 06:39] – [モジュール] junichi | ja:documentation:pandorafms:technical_reference:01_development_and_extension [2024/10/11 23:01] (現在) – [Pandora FMS コードのアーキテクチャ] junichi | ||
---|---|---|---|
行 9: | 行 9: | ||
===== Pandora FMS コードのアーキテクチャ ===== | ===== Pandora FMS コードのアーキテクチャ ===== | ||
- | For a separate and detailed explanation about the Pandora FMS database structure see the article [[en: | + | For a separate and detailed explanation about Pandora FMS database structure see the article [[:en: |
Pandora FMS データベースの構造に関する詳細については、 [[: | Pandora FMS データベースの構造に関する詳細については、 [[: | ||
行 649: | 行 649: | ||
==== ポリシー ==== | ==== ポリシー ==== | ||
- | これらの関数は、指定したポリシーのそれぞれの状態にあるエージェント数を返します。無効化したエージェントやモジュールには使えません。 | + | These functions return the number of agents for each given state and policy. They do not use the disabled agents and modules to calculate the result. |
- | * **policies_agents_critical ($id_policy)**: | + | これらの関数は、指定された状態とポリシーごとにエージェントの数を返します。無効なエージェントとモジュールは結果の計算に使用されません。 |
- | * **policies_agents_ok | + | <code php> |
+ | policies_agents_critical | ||
- | * **policies_agents_unknown ($id_policy)**: | + | </ |
- | * **policies_agents_warning ($id_policy)**: | + | Returns the number of agents with critical status that belong to a given policy. |
- | ==== OS ==== | + | 指定されたポリシーに属する、障害状態のエージェント数を返します。 |
- | これらの関数は、OS に基づいたエージェントの状態を返します。無効化したエージェントやモジュールには使えません。 | + | ---- |
- | * **os_agents_critical | + | <code php> |
+ | policies_agents_ok | ||
- | * **os_agents_ok($id_os)**: | + | </ |
- | * **os_agents_warning ($id_os)**: 指定した OS で障害状態のエージェント数を返します。 | + | Returns the number of agents with normal status that belong to a given policy. |
- | * **os_agents_unknown ($id_os)**: | + | 指定されたポリシーに属する、正常状態のエージェント数を返します。 |
- | ===== 開発 ===== | + | ---- |
- | ほとんどの拡張は、サーバプラグイン、Unix エージェントプラグイン、コンソール拡張といったそれぞれの章で説明しています。この章では、Pandora FMS との連携および、Windows エージェントのソースからのコンパイル方法について説明します。今後も、特定の章に属さない開発に関わる内容については、この章に記載していきます。 | + | <code php> |
+ | policies_agents_unknown ($id_policy) | ||
- | ==== Pandora FMS プロジェクトへの協力 ==== | + | </ |
- | このプロジェクトは、プロジェクトを支えるボランティアの開発者によって成り立っています。新たな開発者、ドキュメント作成者や、その他協力したいと考えている方は、常に歓迎です。まず最初は、メーリングリストやフォーラムに参加いただくのが良いです。 | + | Returns the number of agents with unknown status that belong to a given policy. |
+ | 指定されたポリシーに属する不明状態のエージェント数を返します。 | ||
+ | ---- | ||
- | ==== バグ / エラー ==== | + | <code php> |
+ | policies_agents_warning ($id_policy) | ||
- | 不具合報告は、Pandora FMS の拡張の助けになります。なお、不具合報告を送信する前に、我々の不具合に関するデータベースを確認し、同様の報告がすでにあがっていないかを確認してください。不具合報告は、我々のプロジェクトページ http:// | + | </code> |
- | ==== メーリングリスト ==== | + | Returns the number of agents with warning status that belong to a given policy. |
- | メーリングリストは、簡単に最新情報をメールで受け取るには良い手段です。ユーザ向けのお知らせを送信する public メーリングリスト (流量は少ないです) と、技術的な議論を行う develop メーリングリストを用意しています。また、SVN システムから自動的に通知される変更情報を受け取るためのメーリングリスト (ほぼ毎日) があります。 | + | 指定されたポリシーに属する警告状態のエージェント数を返します。 |
- | ===== Windows エージェントのソースからのコンパイル ===== | + | ==== OS ==== |
- | ==== 最新ソースの入手 ==== | + | **These functions calculate the statistics for the agents based on the Operating Systems they belong to. They do not use disabled agents or modules.** |
- | 我々のリポジトリから最新のソースを入手するには、Subversion クライアントが必要です。そして、次のように実行します。 | + | **これらの関数は、エージェントが属するオペレーティング システムに基づいてエージェントの統計を計算します。無効なエージェントやモジュールは使用しません。** |
- | svn co https:// | + | <code php> |
+ | os_agents_critical ($id_os) | ||
- | ==== Windows ==== | + | </ |
- | ソースからビルドするには、MinGW tools を含む最新の Dev-Cpp IDE 版が必要です。[[http:// | + | Returns the number of agents in critical state that belong to the given Operating System. |
- | '' | + | 指定されたオペレーティングシステムに属する、障害状態のエージェント数を返します。 |
- | ソースからのビルドで問題を見つけた場合は、メール (ramon.novoa@artica.es) もしくは [[http:// | + | ---- |
- | ==== Linux でのクロスコンパイル ==== | + | <code php> |
+ | os_agents_ok($id_os) | ||
- | Linux で Pandora FMS Windows エージェントをクロスコンパイルするには、次のようにします。 | + | </ |
- | === Linux への MinGW のインストール === | + | Returns the number of agents in normal state that belong to the given Operating System. |
- | Ubuntu/ | + | 指定されたオペレーティングシステムに属する、正常状態のエージェント数を返します。 |
- | sudo aptitude install mingw32 | + | ---- |
- | SUSE または RPM 管理の環境の場合 | + | <code php> |
+ | os_agents_warning | ||
- | http:// | + | </code> |
- | === エージェントに必要な追加ライブラリのインストール === | + | Returns the number of agents in warning status that belong to the given Operating System. |
- | * win32api | + | 指定されたオペレーティングシステムに属する警告状態のエージェント数を返します。 |
- | * odbc++ | + | |
- | * curl | + | |
- | * openssl | + | |
- | * zlib | + | |
- | * Boost C++ libraries (http:// | + | |
- | 例えば、Openssl パッケージをインストールするには次のようにします。 | + | ---- |
- | http:// | + | <code php> |
+ | os_agents_unknown ($id_os) | ||
- | openssl-0.9.8e-1cm.DevPak | + | </ |
- | openssl-0.9.8e-1cm.DevPak を展開します。 | + | Returns the number of agents in unknown state that belong to the given Operating System. |
- | tar jxvf openssl-0.9.8e-1cm.DevPak | + | 指定されたオペレーティングシステムに属する不明状態のエージェント数を返します。 |
- | ライブラリおよびインクルードファイルを MinGW のあるクロスコンパイル環境にコピーします。 | + | ===== 開発 ===== |
- | < | + | Most of the extensions have been described as independent annexes, specialized for server plugin creation, Unix agent plugins, and Web Console extensions. This chapter describes how to collaborate in Pandora FMS and how to compile the Windows agent from the sources. |
- | cp lib/*.a / | + | |
- | cp -r include/* / | + | |
- | </ | + | |
- | 依存関係やライブラリの問題は、ご自身で解決する必要があります。 | + | ほとんどの拡張は、サーバプラグイン、Unix エージェントプラグイン、コンソール拡張といったそれぞれの章で説明しています。この章では、Pandora FMS との連携および、Windows エージェントのソースからのコンパイル方法について説明します。 |
- | これらを簡単にできるように、Pandora FMS の公式ダウンロードサイトに必要なライブラリとインクルードファイルを tar で固めたファイルを // | + | |
- | という名前で置いてあります。 | + | |
- | === コンパイルおよびリンク === | + | ==== Pandora FMS プロジェクトへの協力 ==== |
- | コンパイラおよび、インクルードファイル、ライブラリのインストール後、Pandora FMS エージェントのソースディレクトリへ行き、以下を実行します。 | + | This project is maintained by volunteer developers with their contributions. New developers, documentation writers, or people who want to help are always welcome. A good way to get started is by subscribing to our mailing lists and/or [[https:// |
- | | + | このプロジェクトはボランティア開発者の貢献によって維持されています。新しい開発者、ドキュメント作成者、または協力したい人はいつでも歓迎します。始めるには、メーリングリストや [[https:// |
- | これで、実行可能な .exe ファイルが生成されます。 | + | ==== バグ ==== |
- | ===== 外部 API ===== | + | Inform about possible errors helps us improve Pandora FMS. Please, before forwarding a bug report [[https:// |
- | Pandora FMS には、他のアプリケーションとの連携をとり、Pandora FMS から情報を取得したり Pandora FMS に情報を提供するための外部 API があります。これに関するドキュメントは、補足資料の Pandora FMS 外部 API にあります。 | + | 考えられるエラーを報告することは、Pandora FMS の改善に役立ちます。バグレポートを送信する前に、[[https:// |
- | ===== Pandora FMS XML データファイルフォーマット ===== | + | ==== メーリングリスト ==== |
+ | |||
+ | Mailing lists are a great way to keep up to date by email. We have a public mailing list for users and announcements (with low traffic) and a development mailing list for technical discussions and (sometimes daily) development notifications via our GIT (Code Version Control System) automatic notification system. | ||
+ | |||
+ | メーリング リストは、電子メールで最新情報を入手するのに最適な方法です。ユーザーとお知らせ用の公開メーリング リスト (トラフィックは少ない) と、技術的な議論や (場合によっては毎日の) GIT (コード バージョン コントロール システム) 自動通知システム経由の開発通知用の開発メーリング リストがあります。 | ||
+ | |||
+ | |||
+ | ===== Windows エージェントのソースからのコンパイル ===== | ||
+ | |||
+ | ==== 最新ソースの入手 | ||
+ | |||
+ | To get the latest version of the code it is essential to download the sources from the code repository [[http:// | ||
+ | |||
+ | 最新バージョンのコードを入手するには、公式の Pandora FMS リポジトリが公開されているコードリポジトリ [[http:// | ||
+ | |||
+ | |||
+ | ===== Pandora FMS API ===== | ||
+ | |||
+ | There is a Pandora FMS external API to be able to link third party applications with Pandora FMS, both to obtain information from Pandora FMS and to introduce information inside Pandora FMS. All this documentation is in the [[en: | ||
+ | |||
+ | Pandora FMS 外部 API を使用すると、サードパーティのアプリケーションを Pandora FMS にリンクして、Pandora FMS から情報を取得したり、Pandora FMS 内に情報を取り込んだりすることができます。このドキュメントはすべて [[ja: | ||
+ | |||
+ | ===== XML データファイルフォーマット ===== | ||
+ | |||
+ | Knowing the Pandora FMS data XML format can help to improve agent plugins, create customized agents or simply send customized XML files to the Pandora FMS data server. | ||
Pandora FMS の XML データファイルのフォーマットを理解することで、エージェントプラグインの拡張や、独自エージェントの作成、Pandora FMS データサーバへの独自 XML ファイルの送信などができるようになります。 | Pandora FMS の XML データファイルのフォーマットを理解することで、エージェントプラグインの拡張や、独自エージェントの作成、Pandora FMS データサーバへの独自 XML ファイルの送信などができるようになります。 | ||
+ | |||
+ | Like any XML document, the data file must begin with an XML declaration: | ||
すべての XML ドキュメントど同じように、データファイルは次のような XML の宣言で始まります。 | すべての XML ドキュメントど同じように、データファイルは次のような XML の宣言で始まります。 | ||
- | <?xml version=' | + | <code xml> |
+ | <?xml version=' | ||
+ | |||
+ | </ | ||
+ | |||
+ | Next comes the **agent_data** element that defines the agent that sends the data. It supports the following attributes: | ||
次に、エージェントが送るデータを定義する **agent_data** 要素が来ます。次に示す属性に対応しています。 | 次に、エージェントが送るデータを定義する **agent_data** 要素が来ます。次に示す属性に対応しています。 | ||
- | * // | + | |
- | * //group//: Name of the group the agent belongs | + | * //group//: Name of the group to which the agent belongs (it must exist in the Pandora FMS database). If it is left empty and there is no default group configured in the server, the agent will not be created. |
- | * // | + | * // |
- | * // | + | * // |
* // | * // | ||
- | * // | + | * // |
- | * // | + | * // |
- | * // | + | * // |
- | * // | + | * // |
- | * // | + | * // |
- | * // | + | * // |
* // | * // | ||
* // | * // | ||
* // | * // | ||
- | * // | + | * // |
- | * // | + | * // |
* // | * // | ||
行 808: | 行 839: | ||
< | < | ||
+ | |||
+ | A **module** element is then required for each module, and the following elements can be nested to define the module: | ||
そして、モジュールごとに、**module** という要素が必要です。モジュールの定義のために、次の要素を入れることができます。 | そして、モジュールごとに、**module** という要素が必要です。モジュールの定義のために、次の要素を入れることができます。 | ||
行 813: | 行 846: | ||
* **name**: Module name. | * **name**: Module name. | ||
* **description**: | * **description**: | ||
- | * **tags**: Tags associated | + | * **tags**: Tags associated |
- | * **type**: Module type (it must exist in Pandora FMS database). | + | * **type**: Module type (must exist in Pandora FMS database). |
* **data**: Module data. | * **data**: Module data. | ||
- | * **max**: | + | * **max**: |
- | * **min**: | + | * **min**: |
- | * **post_process**: | + | * **post_process**: |
- | * **module_interval**: | + | * **module_interval**: |
- | * **min_critical**: | + | * **min_critical**: |
- | * **max_critical**: | + | * **max_critical**: |
- | * **min_warning**: | + | * **min_warning**: |
- | * **max_warning**: | + | * **max_warning**: |
- | * **disabled**: | + | * **disabled**: |
- | * **min_ff_event**: | + | * **min_ff_event**: |
- | * **status**: Module status (NORMAL, WARNING or CRITICAL). | + | * **status**: Module status (NORMAL, WARNING or CRITICAL). |
- | * **datalist**: | + | * **datalist**: |
- | * **unit**: Module unit. Supports the _Timeticks_ | + | * **unit**: Module unit. Supports the '' |
* **timestamp**: | * **timestamp**: | ||
* **module_group**: | * **module_group**: | ||
- | * **custom_id**: | + | * **custom_id**: |
* **str_warning**: | * **str_warning**: | ||
* **str_critical**: | * **str_critical**: | ||
- | * **critical_instructions**: | + | * **critical_instructions**: |
- | * **warning_instructions**: | + | * **warning_instructions**: |
- | * **unknown_instructions**: | + | * **unknown_instructions**: |
* **critical_inverse**: | * **critical_inverse**: | ||
- | * **warning_inverse**: | + | * **warning_inverse**: |
* **quiet**: Activates the Quiet mode of the module [0/1]. | * **quiet**: Activates the Quiet mode of the module [0/1]. | ||
* **module_ff_interval**: | * **module_ff_interval**: | ||
行 844: | 行 877: | ||
* **crontab**: | * **crontab**: | ||
* **min_ff_event_normal**: | * **min_ff_event_normal**: | ||
- | * **min_ff_event_warning**: | + | * **min_ff_event_warning**: |
- | * **min_ff_event_critical**: | + | * **min_ff_event_critical**: |
* **ff_timeout**: | * **ff_timeout**: | ||
- | * **each_ff**: | + | * **each_ff**: |
* **module_parent**: | * **module_parent**: | ||
- | * **ff_type**: | + | * **ff_type**: |
+ | * **min_warning_forced**: | ||
+ | * **max_warning_forced**: | ||
+ | * **min_critical_forced**: | ||
+ | * **max_critical_forced**: | ||
+ | * **str_warning_forced**: | ||
+ | * **str_critical_forced**: | ||
* **name**: モジュールの名前。 | * **name**: モジュールの名前。 | ||
行 890: | 行 929: | ||
* **module_parent**: | * **module_parent**: | ||
* **ff_type**: | * **ff_type**: | ||
+ | * **min_warning_forced**: | ||
+ | * **max_warning_forced**: | ||
+ | * **min_critical_forced**: | ||
+ | * **max_critical_forced**: | ||
+ | * **str_warning_forced**: | ||
+ | * **str_critical_forced**: | ||
- | Pandora FMS バージョン 749 から、しきい値を強制するための新たなトークンが追加されました。 | + | <WRAP center round important 90%> |
- | | + | These tokens will only work for **dataserver plugins**. |
- | * **max_warning_forced**: | + | |
- | * **min_critical_forced**: | + | |
- | * **max_critical_forced**: | + | |
- | * **str_warning_forced**: | + | |
- | * **str_critical_forced**: | + | |
- | <WRAP center round important 60%> | ||
- | これらのトークンは、**データサーバプラグイン** のみで動作します。 | ||
</ | </ | ||
- | その他の要素は、モジュールの拡張情報として Pandora FMS のデータベースに保存されます。 | + | <WRAP center round important 90%> |
- | {{ : | + | これらのトークンは、**データサーバプラグイン** のみで動作します。 |
- | モジュールは、少なくとも **name**, **type**, および **data** の要素を持たなければいけません。 | + | </ |
- | 例: | + | Any other element will be saved as extended information of the module in the Pandora FMS database. A module must have at least one element **name**, **type** and **data**, for example: |
- | < | + | その他の要素は、モジュールの拡張情報として Pandora FMS データベースに保存されます。モジュールには、少なくとも 1 つの要素 **name**、**type**、**data** が必要です。例: |
+ | |||
+ | その他の要素は、モジュールの拡張情報として Pandora FMS のデータベースに保存されます。 | ||
+ | |||
+ | < | ||
< | < | ||
< | < | ||
行 919: | 行 961: | ||
< | < | ||
</ | </ | ||
+ | |||
</ | </ | ||
+ | |||
+ | There can be any number of elements in an XML data file before closing the **agent_data** tag. | ||
XML データファイルは任意の数のモジュール要素を持つことができます。最後に、**agent_data** タグをクローズするのを忘れないでください。 | XML データファイルは任意の数のモジュール要素を持つことができます。最後に、**agent_data** タグをクローズするのを忘れないでください。 | ||
+ | |||
+ | There is a special case of multi-item XML, based on a list of data. This applies only to string data. The XML would look something like this: | ||
アイテムリストによる、複数の XML データを含む特別なケースがあります。これは、文字列タイプの場合にのみ有効です。XML は次のようになります。 | アイテムリストによる、複数の XML データを含む特別なケースがあります。これは、文字列タイプの場合にのみ有効です。XML は次のようになります。 | ||
- | < | + | < |
< | < | ||
- | < | + | < |
- | < | + | < |
< | < | ||
< | < | ||
< | < | ||
- | </ | + | </ |
</ | </ | ||
+ | |||
</ | </ | ||
+ | |||
+ | A time stamp can be specified for each value: | ||
タイムスタンプは、それぞれの値ごとに定義できます。 | タイムスタンプは、それぞれの値ごとに定義できます。 | ||
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | < |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | </ | + | </ |
- | </ | + | </ |
</ | </ | ||
- | さらに、使用量の単位と閾値の定義を含んだ例を見てみましょう。 | + | [[ja: |
- | < | + | ===== (OBSOLETE) ===== |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | </ | + | |
- | < | + | ==== Windows ==== |
- | < | + | |
- | < | + | ソースからビルドするには、MinGW tools を含む最新の Dev-Cpp IDE 版が必要です。[[http:// |
- | < | + | |
- | < | + | '' |
- | < | + | |
- | <data>< | + | ソースからのビルドで問題を見つけた場合は、メール |
- | </module> | + | |
+ | ==== Linux でのクロスコンパイル ==== | ||
+ | |||
+ | Linux で Pandora FMS Windows エージェントをクロスコンパイルするには、次のようにします。 | ||
+ | |||
+ | === Linux への MinGW のインストール === | ||
+ | |||
+ | Ubuntu/Debian の場合: | ||
+ | |||
+ | sudo aptitude install mingw32 | ||
+ | |||
+ | SUSE または RPM 管理の環境の場合 (手動での Zypper の利用) は、以下の RUL より: | ||
+ | |||
+ | http:// | ||
+ | |||
+ | === エージェントに必要な追加ライブラリのインストール === | ||
+ | |||
+ | * win32api | ||
+ | * odbc++ | ||
+ | * curl | ||
+ | * openssl | ||
+ | * zlib | ||
+ | * Boost C++ libraries (http:// | ||
+ | |||
+ | 例えば、Openssl パッケージをインストールするには次のようにします。 | ||
+ | |||
+ | http:// | ||
+ | |||
+ | openssl-0.9.8e-1cm.DevPak | ||
+ | |||
+ | openssl-0.9.8e-1cm.DevPak を展開します。 | ||
+ | |||
+ | tar jxvf openssl-0.9.8e-1cm.DevPak | ||
+ | |||
+ | ライブラリおよびインクルードファイルを MinGW のあるクロスコンパイル環境にコピーします。 | ||
+ | |||
+ | <code> | ||
+ | cp lib/*.a / | ||
+ | cp -r include/* / | ||
</ | </ | ||
+ | |||
+ | 依存関係やライブラリの問題は、ご自身で解決する必要があります。 | ||
+ | これらを簡単にできるように、Pandora FMS の公式ダウンロードサイトに必要なライブラリとインクルードファイルを tar で固めたファイルを // | ||
+ | という名前で置いてあります。 | ||
+ | |||
+ | === コンパイルおよびリンク === | ||
+ | |||
+ | コンパイラおよび、インクルードファイル、ライブラリのインストール後、Pandora FMS エージェントのソースディレクトリへ行き、以下を実行します。 | ||
+ | |||
+ | ./configure --host=i586-mingw32msvc && make | ||
+ | |||
+ | これで、実行可能な .exe ファイルが生成されます。 | ||