差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
ja:documentation:pandorafms:technical_reference:02_annex_externalapi [2026/02/04 08:09] – [API チェッカー] junichija:documentation:pandorafms:technical_reference:02_annex_externalapi [2026/11/06 22:36] (現在) – [セキュリティ処理の流れ] junichi
行 365: 行 365:
  
 テキストボックスに ''*'' を入力すると、IP アドレスによる ACL チェックは省略され、セキュリティはプロトコルと環境に委ねられます。 テキストボックスに ''*'' を入力すると、IP アドレスによる ACL チェックは省略され、セキュリティはプロトコルと環境に委ねられます。
 +
 +<wrap #ks2_1_2 />
  
 === API パスワードによる === === API パスワードによる ===
  
-You can also set a password for API actions (·**API password**).+A password can also be set (//token// <wrap :en>**API password**</wrap>) to perform API actions. 
 + 
 +API 操作を実行するためのパスワード(//トークン// <wrap :ja>**API パスワード(API password**</wrap>))も設定可能です。
  
-API アクセスのパスワードも設定することができます。(**API パスワード(API password)**)+  * ''apipass'': For practical purposes throughout this documentation, ''1234'' is used for the PFMS API 1.0. **A strong password must always be used**: It must contain uppercase and lowercase letters, including a number and a symbol, all mixed randomly. //Through the Web Console, you will be notified in a timely manner to change the default password created during the Pandora FMS installation//.
  
-   * ''apipass'': By default, and used in this documentation, ''1234''.+  * ''apipass'': 本ドキュメント全体において、説明用として PFMS API 1.0 用のパスワードとして ''1234'' を使用しています。**本番環境では必ず強力なパスワードを使用してください**。パスワードには、大文字、小文字、数字、記号をランダムに組み合わせて含める必要があります。//Pandora FMS のインストール時に作成されたデフォルトパスワードを変更するよう、Web コンソールを通じて適宜通知が行われます//。
  
-  * ''apipass'': デフォルトかつこのドキュメントでは、''1234'' が使われています。+<wrap #ks2_1_3 />
  
 === ユーザ資格情報による === === ユーザ資格情報による ===
行 441: 行 445:
   * ユーザ ''admin'' が存在し、そのパスワードが ''pandora''   * ユーザ ''admin'' が存在し、そのパスワードが ''pandora''
  
-==== API チェッカー ==== +<wrap #ks2_2 />
- +
-<WRAP left round box 50%> +
- +
-<wrap :en>**Management → {{:wiki:pfms-management-admin_tools-icon.svg?nolink&21x21}} Admin tools → API checker**</wrap> menu. +
- +
-</WRAP> +
-\\ \\ \\ \\ \\  +
- +
-<WRAP left round box 50%> +
- +
-<wrap :ja>**管理(Management) → {{:wiki:pfms-management-admin_tools-icon.svg?nolink&21x21}} 管理ツール(Admin tools) → APIチェッカー(API checker)**</wrap> メニュー。 +
- +
-</WRAP> +
-\\ \\ \\ \\ \\  +
- +
-{{  :wiki:pfms-admin_tools-api_checker_2.png  }} +
- +
-  * <wrap :en>**Credentials**</wrap>: +
- +
-  * <wrap :ja>**資格情報**</wrap>: +
- +
-<WRAP center round info 90%> +
- +
-The <wrap :en>**API password**</wrap>, <wrap :en>**User**</wrap>, and <wrap :en>**Password**</wrap> fields are used to query using user credentials. Starting from PFMS version 768, it is recommended to authenticate using <wrap :en>**API Token**</wrap>, which is sent in the [[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers|HTTP headers]] as a //[[https://www.rfc-editor.org/rfc/rfc6750#page-3|bearer token]]// generated by each user for their own private and individual use. See “[[:en:documentation:pandorafms:management_and_operation:11_managing_and_administration#ks1_1_1|Edit my user]]” for more details. +
- +
-</WRAP> +
- +
-<WRAP center round info 90%> +
- +
-<wrap :ja>**API パスワード(API password)**</wrap>、<wrap :ja>**ユーザ(User)**</wrap>、および <wrap :ja>**パスワード(Password)**</wrap> フィールドは、ユーザ認証情報を使用してクエリを実行するために使用されます。PFMS バージョン 768 以降では、<wrap :ja>**API トークン(API Token)**</wrap> を使用して認証することが推奨されています。API トークンは、各ユーザが自身のプライベートおよび個人使用のために生成する //[[https://www.rfc-editor.org/rfc/rfc6750#page-3|ベアラートークン]]// として [[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers|HTTP ヘッダー]] で送信されます。詳細については、「[[:ja:documentation:pandorafms:management_and_operation:11_managing_and_administration#ks1_1_1|ユーザの編集]]」を参照してください。 +
- +
-</WRAP> +
- +
-The IP address defaults to ''127.0.0.1''. If you want to query using the real IP address of the PFMS Server, you must take into account the [[#ks2_1_1|allowed IP addresses]]. +
- +
-IPアドレスのデフォルトは ''127.0.0.1'' です。PFMS サーバの実際の IP アドレスを使用してクエリを実行する場合は、[[#ks2_1_1|許可されたIPアドレス]]を考慮する必要があります。 +
- +
-{{  :wiki:pfms-admin_tools-api_checker-credentials_2.png  }} +
- +
-  * <wrap :en>**Call parameters**</wrap>: +
- +
-  * <wrap :ja>**呼び出しパラメータ(Call parameters)**</wrap>: +
- +
-See the [[#ks2|query syntax]]. +
- +
-[[#ks2|クエリ書式]]を参照してください。 +
- +
-{{  :wiki:pfms-admin_tools-api_checker-call_parameters_2.png  }} +
- +
-  * <wrap :en>**Custom URL**</wrap>: +
- +
-  * <wrap :ja>**カスタム URL(Custom URL)**</wrap>: +
- +
-It will display the URL of the query performed. Although it allows editing, the changes will not be applied if the <wrap :en>**Call**</wrap> button is pressed. +
- +
-実行されたクエリの URL が表示されます。編集は可能ですが、<wrap :ja>**呼び出し(Call)**</wrap>ボタンを押しても変更は適用されません。 +
- +
-{{  :wiki:pfms-admin_tools-api_checker-custom_url_2.png  }} +
- +
-  * <wrap :en>**Result**</wrap>: +
- +
-Returns the result of the query. If an ''auth error'' is obtained, you should review [[#ks2_1_5|the parameters and conditions]]. +
- +
-クエリの結果を返します。「認証エラー(auth error)」が発生した場合は、[[#ks2_1_5|パラメータと条件]]を確認してください。 +
- +
-{{  :wiki:pfms-admin_tools-api_checker-result_2.png  }} +
- +
-<wrap #ks2_3 />+
  
 ==== セキュリティ処理の流れ ==== ==== セキュリティ処理の流れ ====
行 529: 行 465:
 {{  :wiki:api_access.svg?400  }} {{  :wiki:api_access.svg?400  }}
  
- +<wrap #ks2_3 />
- +
  
 ==== API 呼び出し ==== ==== API 呼び出し ====
行 609: 行 543:
  
   * 接続をデバッグする場合は、''-v'' パラメータを利用します。(バージョンを表示する ''-V'' と混同しないでください。)   * 接続をデバッグする場合は、''-v'' パラメータを利用します。(バージョンを表示する ''-V'' と混同しないでください。)
 +
 +<wrap #ks2_4_2 />
  
 === 情報取得 === === 情報取得 ===
行 3033: 行 2969:
 パラメータで渡したデータで、エージェントを更新します。 パラメータで渡したデータで、エージェントを更新します。
  
-書式:+[[#ks2|Call syntax]]:
  
-  * ''op=set'' (required)+[[#ks2|書式]]: 
 + 
 +  * ''op=set'' (required) 
   * ''op2=update_agent'' (required)   * ''op2=update_agent'' (required)
   * ''id=''<id_agent> (required)   * ''id=''<id_agent> (required)
-  * ''other=''<serialized parameters> (required). They are agent configuration and data, serialized in the following order: +  * ''other=''<serialized parameters> (required). They are agent configuration and data, serialized in the following order:  
-    * <agent_alias> + 
-    * <ip_address> +  - <agent_alias> 
-    * <id_parent> +  - <ip_address> 
-    * <id_group> +  - <id_parent> 
-    * <cascade_protection> +  - <id_group> 
-    * <cascade_protection_module> +  - <cascade_protection> 
-    * <interval_sec> +  - <cascade_protection_module> 
-    * <id_os> +  - <interval_sec> 
-    * <name_server> +  - <id_os> 
-    * <custom_id> +  - <name_server> 
-    * <learning_mode> +  - <custom_id> 
-    * <disabled> +  - <learning_mode> 
-    * <description> +  - <disabled> 
-    * <os_version>+  - <description> 
 +  - <os_version>
  
   * ''op=set'' (必須)   * ''op=set'' (必須)
行 3058: 行 2997:
   * ''id=''<エージェントID> (必須)   * ''id=''<エージェントID> (必須)
   * ''other=''<連続パラメータ> (必須) エージェントの設定データで次の順番で設定します。   * ''other=''<連続パラメータ> (必須) エージェントの設定データで次の順番で設定します。
-      * <エージェントの別名> 
-      * <ipアドレス> 
-      * <親ID> 
-      * <グループID> 
-      * <関連障害検知抑制> 
-      * <関連障害検知抑制モジュール> 
-      * <間隔(秒)> 
-      * <OSのID> 
-      * <サーバ名> 
-      * <カスタムID> 
-      * <学習モード> 
-      * <無効化> 
-      * <説明> 
-      * <OSバージョン> 
  
-**Example (see [[:en:documentation:08_technical_reference:02_annex_externalapi#pandora_fms_external_api|call syntax]]**):+  - <エージェントの別名> 
 +  - <ipアドレス> 
 +  - <親ID> 
 +  - <グループID> 
 +  - <関連障害検知抑制> 
 +  - <関連障害検知抑制モジュール> 
 +  - <間隔(秒)> 
 +  - <OSのID> 
 +  - <サーバ名> 
 +  - <カスタムID> 
 +  - <学習モード> 
 +  - <無効化> 
 +  - <説明> 
 +  - <OSバージョン>
  
-**例 ([[:ja:documentation:08_technical_reference:02_annex_externalapi#外部_api| 書式]]を参照):**+**Example (see [[#ks2|call syntax]]**): 
 + 
 +**例 ([[#ks2|書式]]を参照):**
  
 <code bash> <code bash>
-.../include/api.php?op=set&op2=update_agent&id=5&other=agent_name%7C1.1.1.1%7C0%7C4%7C0%7C0%7C30%7C8%7Clocalhost.localdomain%7C%7C0%7C0%7Cla%20description|Ubuntu&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora +.../include/api.php?op=set&op2=update_agent&id=5&other=agent_name%7C1.1.1.1%7C0%7C4%7C0%7C0%7C30%7C8%7Clocalhost.localdomain%7C%7C0%7C0%7Cla%20description|Ubuntu&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora 
 </code> </code>
  
 == set update_agent_field == == set update_agent_field ==
  
-This call updates the field(s) of one or more Agents (the latter if it uses aliases and there are several matching ones.+Updates one or more fields of an agent (or multiple agents if ''agent_alias'' is used) with the data passed as parameters.
  
-この呼び出しは、1つもしくは、(別名を利用し一致するエージェントが複数ある場合は) 複数のエージェントのフィールドを更新します。+1つもしくは、(''agent_alias'' を利用し一致するエージェントが複数ある場合は) 複数のエージェントのフィールドを更新します。
  
-Call syntax:+[[#ks2|Call syntax]]: 
 + 
 +[[#ks2|書式]]:
  
   * op=set (required)   * op=set (required)
行 3109: 行 3050:
   * <disabled>   * <disabled>
   * <description>   * <description>
- 
-書式: 
  
   * op=set (必須)   * op=set (必須)
-  * op2=update_agent (必須)+  * op2=update_agent_field (必須)
   * id=<id_agent> or <alias> (必須), <alias> id2 パラメータに依存します。   * id=<id_agent> or <alias> (必須), <alias> id2 パラメータに依存します。
   * id2= <id_agente> の場合 0 (オプション), <alias> の場合 1 (必須)   * id2= <id_agente> の場合 0 (オプション), <alias> の場合 1 (必須)
行 3138: 行 3077:
 エージェント名を利用する場合: エージェント名を利用する場合:
  
-<code> +<code bash> 
-http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_agent_field&id=1&other=id_os,1|alias,pandora|direccion,192.168.10.16|id_parent,1cascade_protection,1|cascade_protection_module,1|intervalo,5||modo|3|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora +.../include/api.php?op=set&op2=update_agent_field&id=3&other=id_os,1|direccion,192.168.10.15|id_parent,2|cascade_protection,1|cascade_protection_module,40|intervalo,5||modo|3|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
 </code> </code>
  
行 3146: 行 3084:
  
 別名を利用する場合。別名を含む全エージェントを編集します: 別名を利用する場合。別名を含む全エージェントを編集します:
 +
 <code> <code>
- +.../include/api.php?op=set&op2=update_agent_field&id=pandora&id2=1&other=id_os,1|alias,pandora|direccion,192.168.10.16|id_parent,1cascade_protection,1|cascade_protection_module,1|intervalo,5||modo|3|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
-http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_agent_field&id=pandora&id2=1&other=id_os,1|alias,pandora|direccion,192.168.10.16|id_parent,1cascade_protection,1|cascade_protection_module,1|intervalo,5||modo|3|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora +
 </code> </code>
- 
  
 == set delete_agent == == set delete_agent ==
行 3189: 行 3125:
 </code> </code>
  
-== set apply_module_template == 
- 
-モジュールテンプレートをエージェントへ適用します。 
- 
-モジュールテンプレートは、ネットワークモジュールを集めたものです。このテンプレートは、直接エージェントに適用することができ、モジュールを一つ一つ追加する必要はありません。 
- 
-書式: 
- 
-  * op=set (必須) 
-  * op2=apply_module_template (必須) 
-  * id<id_template> (必須) 適用されるテンプレートの ID 
-  * id2<id_agente> (必須) モジュールが作成されるエージェントの ID 
- 
-**例** 
-<code> 
- 
-http://127.0.0.1/pandora_console/include/api.php?op=set&op2=apply_module_template&id=2&id2=2&apipass=1234&user=admin&pass=pandora 
- 
-</code> 
  
 == set create_network_module == == set create_network_module ==
行 7646: 行 7563:
 == set create_alerts_policy == == set create_alerts_policy ==
  
->= 7.0. 725+To create standard or external alerts in a monitoring policy.
  
-ポリシーアラートを作成します。+監視ポリシーで標準アラートまたは外部アラートを作成します。
  
-  * 存在するポリシー ID を指定する必要があります。 +[[#ks2|Call syntax]]:
-  * 通常のタイプの場合、ポリシーモジュールIDを指定する必要があります。 +
-  * 存在するテンプレートIDを指定する必要があります。 +
-  * 外部かどうかを 0(通常)、1(外部) で設定します。デフォルトは、通常の 0 です。 +
-  * 外部タイプ(1) の場合は、名前を指定する必要があります。+
  
-0(失敗) または、ポリシーに追加したアラートID(成功) を返します。+[[#ks2|書式]]:
  
-書式:+**To create [[:en:documentation:pandorafms:complex_environments_and_optimization:02_policy#ks4_6|standard alerts]]**:
  
-  * op=set +**[[:ja:documentation:pandorafms:complex_environments_and_optimization:02_policy#ks4_6|標準アラート]]を作成するには**:
-  * op2=create_alerts_policy +
-  * id=ポリシーID +
-  * id2=ポリシーモジュールID +
-  * other=ポリシーモジュールID|テンプレートID|0 または 1|モジュール名 +
-  * other_mode=url_encode_separator_| +
-  * return_type=(string, csv, json).+
  
-**例** +  * ''op=set'' (required). 
-<code>+  * ''op2=create_alerts_policy'' (required). 
 +  * ''id='' A policy identifier that must exist (required). 
 +  * ''return_type'' Output format (optional): STRING, CSV o JSON. 
 +  * ''other_mode=url_encode_separator_|''. 
 +  * ''other='' With the following fields properly delimited:
  
-http://localhost/pandora_console/include/api.php?op=set&op2=create_alerts_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=2&other=0|2|1|cpu%20load&other_mode=url_encode_separator_|+  * ''op=set'' (必須)。 
 +  * ''op2=create_alerts_policy'' (必須)。 
 +  * ''id='' ポリシー識別子 (必須)。 
 +  * ''return_type'' 出力形式 (オプション):STRING、CSV、または JSON。 
 +  * ''other_mode=url_encode_separator_|''。
  
 +  - Existing module ID (required).
 +  - A template identifier that must exist (required).
 +  - ''0'' It is explicitly stated that this is a standard alert (optional); this parameter can also be omitted, as the default value is zero.
 +  - This parameter is omitted when creating a standard alert, as it will be generated using the name of the existing module identifier provided.
 +
 +  - 既存のモジュールID(必須)。
 +  - 必ず存在するテンプレート識別子(必須)。
 +  - ''0'' は、これが標準アラートであることを明示的に示しています(オプション)。デフォルト値はゼロなので、このパラメータは省略できます。
 +  - 標準アラートを作成する場合、このパラメータは省略されます。指定された既存のモジュール識別子の名前を使用してアラートが生成されるためです。
 +
 +**To create [[:en:documentation:pandorafms:complex_environments_and_optimization:02_policy#ks4_7|external alerts]]**:
 +
 +**[[:ja:documentation:pandorafms:complex_environments_and_optimization:02_policy#ks4_7|外部アラート]]を作成するには**:
 +
 +  * ''op=set'' (required).
 +  * ''op2=create_alerts_policy'' (required).
 +  * ''id='' A policy identifier that must exist (required).
 +  * ''return_type'' Output format (optional): STRING, CSV o JSON.
 +  * ''other_mode=url_encode_separator_|''.
 +  * ''other='' With the following fields properly delimited:
 +
 +  * ''op=set'' (必須)。
 +  * ''op2=create_alerts_policy'' (必須)。
 +  * ''id='' ポリシー識別子 (必須)。
 +  * ''return_type'' 出力形式 (オプション):STRING、CSV、またはJSON。
 +  * ''other_mode=url_encode_separator_|''。
 +  * ''other='' 以下のフィールドを適切に区切り文字で区切ってください。
 +
 +  - ''0'' Since the external alert does not require an existing module to be generated (optional).
 +  - A template identifier that must exist (required).
 +  - ''1'' It is explicitly stated that this is an external alert (mandatory).
 +  - Module name for the external alert (required).
 +
 +  - ''0'' 外部アラートは既存のモジュールを生成する必要がないため(オプション)。
 +  - 必ず存在しなければならないテンプレート識別子(必須)。
 +  - ''1'' これが外部アラートであることを明示的に指定する(必須)。
 +  - 外部アラートのモジュール名(必須)。
 +
 +**Result**:
 +
 +**結果**:
 +
 +Returns '0' (//false//) or the identifier of the alert added to the policy (//true//).
 +
 +'0' (//false//) またはポリシーに追加されたアラートの識別子 (//true//) を返します。
 +
 +**Example of a standard alert (see [[#ks2|call syntax]]):**
 +
 +**標準アラートの例([[#ks2|書式]]を参照):**
 +
 +<code bash>
 +…/include/api.php?op=set&op2=create_alerts_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=7&other=39|1|0|&other_mode=url_encode_separator_|
 +</code>
 +
 +**Example of an external alert (see [[#ks2|call syntax]]):**
 +
 +**外部アラートの例([[#ks2|書式]]を参照):**
 +
 +<code bash>
 +…/include/api.php?op=set&op2=create_alerts_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=8&other=0|1|1|ESET%20logd&other_mode=url_encode_separator_|
 </code> </code>
  
  • ja/documentation/pandorafms/technical_reference/02_annex_externalapi.1770192586.txt.gz
  • 最終更新: 2026/02/04 08:09
  • by junichi