| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
| ja:documentation:pandorafms:technical_reference:02_annex_externalapi [2024/11/09 23:18] – [get agent_module_name_last_value_alias] junichi | ja:documentation:pandorafms:technical_reference:02_annex_externalapi [2025/09/12 23:08] (現在) – junichi |
|---|
| <WRAP center round info 90%> | <WRAP center round info 90%> |
| |
| Through the [[#ks1_4|web interface]] you can generate and copy the necessary codes, with their parameters and mandatory fields, of all the commands of this PFMS API 2.0. See [[#ks1_6|schemas]] for more details. | Through the [[#ks1_4|web interface]] you can generate and copy the necessary codes, with their parameters and required fields, of all the commands of this PFMS API 2.0. See [[#ks1_6|schemas]] for more details. |
| |
| </WRAP> | </WRAP> |
| <WRAP center round tip 90%> | <WRAP center round tip 90%> |
| |
| In this schema, the mandatory parameters have the property set to ''nullable: false''. | In this schema, the required parameters have the property set to ''nullable: false''. |
| |
| </WRAP> | </WRAP> |
| |
| * [[:en:documentation:08_technical_reference:02_annex_externalapi#by_origin|Filtering by IP address]]: Only the listed IP addresses will be able to access the API. | * [[:en:documentation:08_technical_reference:02_annex_externalapi#by_origin|Filtering by IP address]]: Only the listed IP addresses will be able to access the API. |
| * [[:en:documentation:08_technical_reference:02_annex_externalapi#by_api_password|Global password for the API]]: If defined, it is mandatory to use it in all calls. | * [[:en:documentation:08_technical_reference:02_annex_externalapi#by_api_password|Global password for the API]]: If defined, it is required to use it in all calls. |
| * [[:en:documentation:08_technical_reference:02_annex_externalapi#by_user_credentials|User and password]]: User of type [[:en:documentation:01_understanding:03_glossary#superadmin|superadmin]] and valid in the Web Console. Your permissions will be used for each requested operation. **From version NG 768 onwards** it is also possible to access by [[:en:documentation:08_technical_reference:02_annex_externalapi#authentication_by_bearer_token|bearer token]]. | * [[:en:documentation:08_technical_reference:02_annex_externalapi#by_user_credentials|User and password]]: User of type [[:en:documentation:01_understanding:03_glossary#superadmin|superadmin]] and valid in the Web Console. Your permissions will be used for each requested operation. **From version NG 768 onwards** it is also possible to access by [[:en:documentation:08_technical_reference:02_annex_externalapi#authentication_by_bearer_token|bearer token]]. |
| |
| == get locate_agent == | == get locate_agent == |
| |
| エージェントが存在するサーバ ID を取得し、すべての結果を csv で出力します。 | <WRAP center round info 90%> |
| |
| 書式: | This command only works in [[:en:documentation:pandorafms:command_center:01_introduction|Command Center]]. |
| |
| * op=get (必須) | </WRAP> |
| * op2=locate_agent (必須) | |
| * return_type=<csv> (必須) 出力フォーマット | |
| * id=id_agent (必須) | |
| * other_mode=other_mode=url_encode_separator_<separator> (必須) | |
| |
| **例** | <WRAP center round info 90%> |
| |
| <code> | このコマンドは [[:ja:documentation:pandorafms:command_center:01_introduction|コマンドセンター]] でのみ動作します。 |
| http://127.0.0.1/pandora_console/include/api.php?op=get&op2=locate_agent&return_type=csv&apipass=1234&user=admin&pass=pandora&id=Pepito&other_mode=url_encode_separator_%7C | |
| | </WRAP> |
| | |
| | Gets the ID of the server where the agent is located, and prints the whole result as a CSV file. You can search by both name and agent ID. |
| | |
| | エージェントが存在するサーバの ID を取得し、結果全体をCSVファイルとして出力します。名前とエージェント ID の両方で検索できます。 |
| | |
| | **[[#ks2|Call syntax]]**: |
| | |
| | **[[#ks2|書式]]**: |
| | |
| | * ''op=get'' (required). |
| | * ''op2=locate_agent'' (required). |
| | * ''return_type=csv'' (required) Output format. |
| | * ''id='' id_agent or agent_name (required) |
| | * ''other_mode=other_mode=url_encode_separator_''< separator > (required) |
| | |
| | * ''op=get'' (必須) |
| | * ''op2=locate_agent'' (必須) |
| | * ''return_type=csv'' (必須) 出力フォーマット |
| | * ''id='' エージェント ID もしくはエージェント名(必須) |
| | * ''other_mode=other_mode=url_encode_separator_'' < separator > (必須) |
| | |
| | **Example (see [[#ks2|call syntax]])**: |
| | |
| | **例 ([[#ks2|書式]]を参照)**: |
| | |
| | <code bash> |
| | …/include/api.php?op=get&op2=locate_agent&return_type=csv&apipass=1234&user=admin&pass=pandora&id=MySQLagent&other_mode=url_encode_separator_| |
| |
| </code> | </code> |
| == get special_days == | == get special_days == |
| |
| >= 5.1 | Returns a list with special days. It allows to specify a field separator, being these: |
| |
| 特別日一覧を返します。 | 特別日のリストを返します。次のデータを表示するためのフィールド区切り文字を指定できます: |
| |
| 書式: | - Numerical ID of the special day. |
| | - Numerical ID of the calendar to which this special day belongs. |
| | - Numerical ID of the group to which the special day belongs. |
| | - Date of the special day in the format ''YYYY-MM-DD''. |
| | - Numeric ID of the same day of the week configured for that special day. |
| | - Description of the special day. |
| |
| * op=get (必須) | - 特別日の数値 ID。 |
| * op2=special_days (必須) | - この特別日が属するカレンダーの数値 ID。 |
| * other=<csvセパレータ> (オプション) CSVのセパレータ | - 特別日が属するグループの数値 ID。 |
| | - 特別日の日付 (形式は ''YYYY-MM-DD'')。 |
| | - その特別日に設定されている同じ曜日の数値 ID。 |
| | - 特別日の説明。 |
| |
| **例** | [[#ks2|Call syntax]]: |
| |
| <code> | [[#ks2|書式]]: |
| http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=special_days | |
| | * ''op=get'' (required). |
| | * ''op2=special_days'' (required). |
| | * ''other=''< csv separator > (optional). |
| | |
| | * ''op=get'' (必須) |
| | * ''op2=special_days'' (必須) |
| | * ''other=''<csvセパレータ> (オプション) |
| | |
| | **Example (see [[#ks2|call syntax]]):** |
| | |
| | **例 ([[#ks2|書式]]を参照):** |
| | |
| | <code bash> |
| | …/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=special_days |
| |
| </code> | </code> |
| * ''op=set'' (required). | * ''op=set'' (required). |
| * ''op2=create_plugin_module'' (required). | * ''op2=create_plugin_module'' (required). |
| * ''id=''< agent_name > (required). It should be an agent name. | * ''id=''< agent_name > (required) it should be an agent name. |
| * ''other=''< serialized parameters > (required). They are module configuration and data, serialized in the following order: | * ''other=''< serialized parameters > (required). They are module configuration and data, serialized in the following order: |
| |
| |
| 例 ([[#pandora_fms_外部_api|書式を参照]]): | 例 ([[#pandora_fms_外部_api|書式を参照]]): |
| | |
| | * Example without macro: |
| | |
| | * マクロ無しの例: |
| |
| <code bash> | <code bash> |
| …/include/api.php?op=set&op2=create_plugin_module&id=example&other=prueba|0|1|2|0|0||0|0||0|0|127.0.0.1|0||0|300|0|0|0|0|plugin%20module%20from%20api|4|2|admin|pass|-p%20max&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora | …/include/api.php?op=set&op2=create_plugin_module&id=pandora.internals&other=module_plugin_test_|0|1|2|0|0||0|0||0|0|127.0.0.1|0||0|300|0|0|0|0|plugin%20module%20from%20api|4|2|admin|pass|-p%20max||||||||||||2001&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora |
| | |
| | </code> |
| | |
| | * Example with macro: |
| | |
| | * マクロありの例 |
| | |
| | To use the **DNS plugin** that is installed by default in PFMS (**Management → Servers → Plugins** menu ) and whose identifier is ''2'', the **dig** tool (included in **dnsutils**) must be installed in the PFMS server and **//connected to the internet//**. |
| | |
| | PFMS にデフォルトでインストールされ (**管理(Management) → サーバ(Servers) → プラグイン(Plugins)** メニュー)、識別子が ''2'' である **DNS プラグイン** を使用するには、**dig** ツール (**dnsutils** に含まれています) を PFMS サーバにインストールし、**//インターネットに接続//** する必要があります。 |
| | |
| | It can be tested by executing in a command terminal on the PFMS server the following statement (it should return ''1'' for a successful result, ''0'' if domain/address is not matched and ''-1'' for any error that prevents it from working): |
| | |
| | これは、PFMS サーバのコマンドターミナルで次のステートメントを実行することによってテストできます (成功した場合は ''1''、ドメイン/アドレスが一致しない場合は ''0''、動作を妨げるエラーの場合は ''-1'' が返されます)。 |
| | |
| | <code bash> |
| | /usr/share/pandora_server/util/plugin/dns_plugin.sh -d pandorafms.com -i 172.66.40.150 -s 8.8.8.8 |
| |
| </code> | </code> |
| JSON ドキュメントの内容は、次のプロパティを持つ複数のオブジェクトで構成されるオ ブジェクトである必要があります。 | JSON ドキュメントの内容は、次のプロパティを持つ複数のオブジェクトで構成されるオ ブジェクトである必要があります。 |
| |
| * ''macro'': Macro name. It should be //_field1_//, //_field2_//, …, //_fieldN_//. | * ''macro'': Name of the macro. Must be //_field1_//, //_field2_//, …, //_fieldN_//. |
| * ''desc'': Descriptive macro name. | * ''desc'': Descriptive name of the macro. |
| * ''help'': Macro description. | * ''help'': Macro detailed description. |
| * ''value'': Macro value. | * ''value'': Macro value. |
| * ''hide'': Set to ''1'' to hide the macro value (useful for storing passwords). | * ''hide'': Set to ''1'' to hide the macro value (useful for storing passwords). |
| |
| * ''macro'': マクロ名。//_field1_//, //_field2_//, …, //_fieldN_// である必要があります。 | * ''macro'': マクロ名。//_field1_//, //_field2_//, …, //_fieldN_// である必要があります。 |
| * ''hide'': マクロ値を非表示にするには、''1'' に設定します (パスワードの保存に役立ちます)。 | * ''hide'': マクロ値を非表示にするには、''1'' に設定します (パスワードの保存に役立ちます)。 |
| |
| Example: | For this example it will be verified that the domain ''pandorafms.com'' uses at least one IP address ''172.66.40.150'': |
| |
| 例: | この例では、ドメイン ''pandorafms.com'' が少なくとも 1 つの IP アドレス ''172.66.40.150'' を使用していることが検証されます。 |
| | |
| <file> | |
| |
| | <file | plugin_fields.json> |
| { | { |
| "1": { | "1": { |
| "macro": "_field1_", | "macro": "_field1_", |
| "desc": "Target IP", | "desc": "Target IP", |
| "help": "", | "help": "", |
| "value": "192.168.0.1", | "value": "172.66.40.150" |
| "hide": "" | }, |
| }, | "2": { |
| "2": { | "macro": "_field2_", |
| "macro": "_field2_", | "desc": "Domain to check", |
| "desc": "Port", | "help": "For example pandorafms.com", |
| "help": "", | "value": "pandorafms.com" |
| "value": "80", | }, |
| "hide": "" | "3": { |
| } | "macro": "_field3_", |
| | "desc": "DNS Server to check", |
| | "help": "For example 8.8.8.8", |
| | "value": "8.8.8.8" |
| | }, |
| | "4": { |
| | "macro": "_field4_", |
| | "desc": "Optional parameters", |
| | "help": "", |
| | "value": "" |
| | } |
| } | } |
| |
| </file> | </file> |
| | |
| | The previous file must be converted to base 64 with: |
| | |
| | 前のファイルは次のようにして Base 64 に変換する必要があります。 |
| | |
| | <code bash> |
| | PLUGIN_FIELDS=$(base64 plugin_fields.json -w 0) |
| | |
| | </code> |
| | |
| | And the previous variable should be used in a complete URL to add a module in the default agent, ''pandora.internals'', in the module group ''Networking'' and with critical inverse to ''0'': |
| | |
| | また、前の変数は、完全な URL で使用して、デフォルトエージェントのモジュール ''pandora.internals'' をモジュールグループ ''Networking'' に追加し、障害値を ''0'' に反転する必要があります。 |
| | |
| | <code bash> |
| | curl '…/include/api.php?op=set&op2=create_plugin_module&id=pandora.internals&other=dns_module||2|2||||1|||||pandorafms.com|0||0|300|0|0|0|0|dns_plugin|2|||||'$PLUGIN_FIELDS'|W10=|||||1|||||&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora' |
| | |
| | </code> |
| |
| == set create_data_module == | == set create_data_module == |
| - < min > | - < min > |
| - < max > | - < max > |
| - < post_process > ( {{:wiki:icono-modulo-enterprise.png?23x23|Enterprise version}}only for [[:en:documentation:pandorafms:installation:05_configuration_agents#module_postprocess|Software Agents]] with remote configuration enabled). | - < post_process > ( Only for [[:en:documentation:pandorafms:installation:05_configuration_agents#module_postprocess|EndPoints]] with remote configuration enabled). |
| - < [[:en:documentation:pandorafms:installation:05_configuration_agents#module_interval|module_interval]] > | - < [[:en:documentation:pandorafms:installation:05_configuration_agents#module_interval|module_interval]] > |
| - < min_warning > | - < min_warning > |
| - < 最小 > | - < 最小 > |
| - < 最大 > | - < 最大 > |
| - < 保存倍率 > ( {{:wiki:icono-modulo-enterprise.png?23x23|Enterprise 版}}([[:ja:documentation:pandorafms:installation:05_configuration_agents#module_postprocess|ソフトウエアエージェント]] でリモート設定が有効な場合のみ) | - < 保存倍率 > ([[:ja:documentation:pandorafms:installation:05_configuration_agents#module_postprocess|エンドポイント]] でリモート設定が有効な場合のみ) |
| - < [[:ja:documentation:pandorafms:installation:05_configuration_agents#module_interval|モジュールの間隔]] > | - < [[:ja:documentation:pandorafms:installation:05_configuration_agents#module_interval|モジュールの間隔]] > |
| - < 警告の最小値 > | - < 警告の最小値 > |
| |
| * op=set (required) | * op=set (required) |
| * op2=add_agent_policy_by_id (mandatory) | * op2=add_agent_policy_by_id (required) |
| * id=<id_policy> (required). It must be a policy Id. | * id=<id_policy> (required). It must be a policy Id. |
| * other=<serialized parameters> (required). These are agent configuration and data, serialized in the following order: | * other=<serialized parameters> (required). These are agent configuration and data, serialized in the following order: |
| |
| { | { |
| name: <value>, // mandatory | name: <value>, // required |
| id_module: <value>, // mandatory | id_module: <value>, // required |
| id_tipo_modulo: <value>, // mandatory | id_tipo_modulo: <value>, // required |
| configuration_data: <value>, | configuration_data: <value>, |
| description: <value>, | description: <value>, |
| |
| { | { |
| name: <value>, // mandatory | name: <value>, // required |
| id_module: <value>, // mandatory | id_module: <value>, // required |
| id_tipo_modulo: <value>, // mandatory | id_tipo_modulo: <value>, // required |
| configuration_data: <value>, | configuration_data: <value>, |
| description: <value>, | description: <value>, |