目次

外部 API

Pandora FMS ドキュメント一覧に戻る

Pandora FMS 外部 API

Pandora FMS 外部 API は、(/include/api.php に対して HTTP アクセスすることにより) リモート操作に利用します。 これは、Pandora FMS 外から操作するアプリケーションを作成できるように、Pandora FMS に用意されている手法です。基本的に、アプリケーションからの操作で、指定したフォーマットのパラメータで値を受け渡します。

API.php の呼び出しは、次のように単純です。

http://<Pandora FMS コンソールのインストールパス>/include/api.php<パラメータ>

API は次のパラメータのみ受け取ることができます。

...other=pears|melons|watermelon&other_mode=url_encode_separator_|

任意の区切り文字を使用できます。このドキュメントでは、| 文字(%7C パーセントエンコード)を優先的に使用しています。API チェッカー がどのように動くかも確認してください。

セキュリティ

API は、アクセス元、パスワードおよび、ユーザ資格情報を介してアクセスを認証します。

アクセス元による

現時点では、セキュリティはアクセスする IP アドレスリストに基づいています。

テキストボックスに * を入力すると、IP アドレスによる ACL チェックは省略され、セキュリティはプロトコルと環境に委ねられます。

API パスワードによる

API アクセスのパスワードも設定することができます。(API パスワード(API password))

ユーザ資格情報による

ユーザ名とパスワードによるものです。さらに、バージョン 768 以降からは、Bearer トークンによる認証が可能です。

ユーザ名とパスワードによる

API へアクセスするには、Pandora FMS の正しいユーザ名とパスワードを与える必要があります。

API 呼び出しではパスワードは暗号化されていません。SSL 接続を使用することにより、第三者から盗み見られることを防いでください。API アクセスでは、SSL/HTTPS を使用することで POST リクエストを暗号化できます。

戻り値

API へのアクセスができなかった場合は、単純に “auth error” という文字が出力されます。

このドキュメントでは、API パスワードが 1234 で、アクセスユーザが admin、そのパスワードが pandora とします。

呼び出し書式:

.../include/api.php?op=get&op2=plugins&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora

アクセス条件:

API チェッカー

管理メニューの 管理ツール(Admin tools)API チェッカー(API checker) からアクセスします。

バージョン 768 以降: HTTP ヘッダー で各ユーザによって個別に生成され bearer トークン を送信することにより、API トークン で認証することができます。

セキュリティ処理の流れ

次の 3つの要素で実装されています。

以下に処理の流れを示します。

関数例

以下に示すのは、関数の例です。

function apiextension_get_groupmodules($group_name) {
    $group_id = group_id_from_name($group_name);
    if($group_id == false) {
       echo 'Group doesnt exist';
       return;
    }

    $number_of_modules = group_modules($group_id);
    echo $number_of_modules;
}
呼び出し例

この呼び出し例では、“Servers” グループのモジュール数を取得します。

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=extension&ext_name=module_groups&ext_function=groupmodules&id=Servers&apipass=1234&user=admin&pass=pandora

API 呼び出し

Pandora FMS に対して読み出し書き込みかによって、2つの種類に分けられます。

例外があります: 情報取得 呼出

bearer トークンによる認証

バージョン 758 以降: 各ユーザによって個別に生成された HTTP headers a bearer トークンHTTP ヘッダ で送信することにより API トークン で認証することができます。詳細は、ユーザ編集 を参照してください。

bearer トークンに基づく認証により、Pandora FMS に登録された各ユーザは、1 対 1 の対応で独自の識別子を生成できます。この bearer トークンは、HTTP ヘッダーに挿入する必要があります。つまり、API の URL の一部ではありません。 送信メカニズムは、Pandora FMS API にアクセスするアプリケーションにて対応します。

バージョン 768 以降: API トークンの隣に警告アイコンが表示された場合は、php.conf ファイルを設定してください。

以下の例では、コマンドラインプログラムである cURL バージョン 7.68 を使っています。

BEARER="Authorization: Bearer 811a0c1889f3aa62ef481ccd173ea5ec"
URL="http://192.168.7.117/pandora_console/include/api.php"
API_QUERY="?op=get&op2=test"
curl -k -H "$BEARER" $URL$API_QUERY && echo ""

情報取得

Pandora コンソールのバージョンを返します。get test と似ていますが、API 接続のチェックをしません。

これは、Pandora FMS のインストールパスの確認と、認証前にバージョンを確認するのに便利です。

返される情報はログイン画面から確認することができるものであるため、セキュリティ上の脆弱性にはなりません。

http://127.0.0.1/pandora_console/include/api.php?info=version

例えば、Pandora FMS v7.0NG.768 - PC230120 MR60 といった内容が返ります。

GET

データを読み出します。

get test

書式: パラメータ無し

以下の例では、OK を返します。

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=test

応答サンプル: OK,v7.0NG.751,PC201215

get license

ユーザ権限のアクセスレベルに応じて、Pandora FMS のライセンス状態を返します。

書式:

例 ( 呼び出し書式を参照):

/include/api.php?op=get&op2=license&return_type=json&apipass=1234&user=admin&pass=pandora

コミュニティ 版では、次のような応答を返します。

 {
  "type":"array",
  "data":{
   "license_mode":"PANDORA-FREE",
  }
 }

get all_agents

他のパラメータのフィルタに従って、エージェントフィルタのリストを返します。

書式:

例 (呼出書式を参照):

この例では、OS ID が 1 の全エージェントを返します。(CSV フォーマット)

/pandora_console/include/api.php?op=get&op2=all_agents&return_type=csv&other=1||||||0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

この例では、id_group が 2 であるすべてのエージェントを返します。(JSON フォーマット)

/pandora_console/include/api.php?op=get&op2=all_agents&return_type=json&other=|2|||||0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

この例では、状態が障害のすべてのエージェントを返します。(CSV フォーマット)

/pandora_console/include/api.php?op=get&op2=all_agents&return_type=csv&other=||critical||||0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

この例では、別名に pa が含まれるすべてのエージェントを返します。(CSV フォーアット)

/pandora_console/include/api.php?op=get&op2=all_agents&return_type=csv&other=|||pa|||0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

この例では、関連付けられたポリシーが 2 で再帰ですべてのエージェントを返します。(CSV フォーマット)

/pandora_console/include/api.php?op=get&op2=all_agents&return_type=csv&other=||||2||1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

この例では、OS ID が 1、id_group が 2、状態が障害、別名に pa が含まれ、関連付けられたポリシーが 2 のすべてのエージェントを返します。(@ 区切り文字での CSV フォーマット)

/pandora_console/include/api.php?op=get&op2=all_agents&return_type=csv&other=1|2|critical|pa|2|@|0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

get license_remaining

= 7.0NG 752

Pandora FMS ライセンスおよびユーザのアクセス権限に応じた、残りのエージェントまたはモジュール数を確認します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=license_remaining&return_type=json&apipass=1234&user=admin&pass=pandora

get module_last_value

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_last_value&id=63&other=error_value|0&other_mode=url_encode_separator_|
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_last_value&id=62

get agent_module_name_last_value

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=agent_module_name_last_value&id=miguel-portatil&id2=cpu_user

get agent_module_name_last_value_alias

= 7.0NG

モジュールの最新の値を返します。このモジュールは、パラメータ id で渡されるエージェントの別名と、パラメータ id2 で渡されるモジュール名でフィルタされます。other パラメータで、アプリケーションが利用するエラーコードおよび、範囲を超えたモジュールの値を追加することができます。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=agent_module_name_last_value_alias&id=miguel-portatil&id2=cpu_user

get module_value_all_agents

モジュール名を指定すると、そのモジュール名を含むエージェントのリストを返します。 結果は、セミコロン (;) で区切られた、エージェントID、エージェントの別名、要求されたモジュールの値、およびエージェント名を返します。例:

653;agente network;0.00000;a8c83b348451040dc91c1327303adf8945aefce6ac59ab9bf856c9f4e0cf6c6f

書式:

(書式を参照):

Host Alive というモジュールがある全エージェントの一覧:

.../include/api.php?op=get&op2=module_value_all_agents&id=Host%20Alive&apipass=1234&user=admin&pass=pandora

get agent_modules

数値 ID で指定したエージェントのモジュール一覧を返します。

書式:

次のように、セパレータを設定することが必要です。

other_mode=url_encode_separator_< セパレータ >

例 ( 書式を参照):

.../include/api.php?op=get&op2=agent_modules&return_type=csv&other=14&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get module_id

エージェントのモジュール ID を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_id&id=5&other=Host%20Alive&apipass=1234&user=admin&pass=pandora

get module_custom_id

モジュール ID をパラメータをとして渡し、特定のエージェントモジュールの カスタムID の値を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_custom_id&id=5&apipass=1234&user=admin&pass=pandora

get locate_agent

エージェントが存在するサーバ ID を取得し、すべての結果を csv で出力します。

書式:

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

get policies

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=policies&return_type=csv&other=&other_mode=url_encode_separator_|

get tree_agents

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=tree_agents&return_type=csv&other=;
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=tree_agents&return_type=csv&other=;|%20|type_row,group_id,agent_alias&other_mode=url_encode_separator_|

get module_data

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_data&id=17&other=;|604800|20121201T13:40|20171215T13:40&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get graph_module_data

モジュールのグラフを画像ファイルで返します。このグラフは、Pandora の静的グラフと同じ手法で生成されます。グラフの幅、高さ、期間、ラベル、開始日(データの終わりがグラフに表示される最後になります)をパラメータに指定する必要があります。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=graph_module_data&id=17&other=604800|555|245|pepito|2009-12-07&other_mode=url_encode_separator_|

get events

other パラメータでフィルタしたイベントの一覧を返します。

書式:

(書式を参照):

メタコンソールで、ノード ID が 5ncm (ネットワーク設定管理) イベントの取得:

…include/api.php?op=get&op2=events&user=admin&pass=pandora&return_type=json&apipass=1234&other_mode=url_encode_separator_|&other=|||||||||||||||ncm&id=5

get all_alert_templates

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=all_alert_templates&return_type=csv&other=;

get module_groups

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_groups&return_type=csv&other=;

get plugins

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=plugins&return_type=csv&other=;

get tags

書式:

(書式を参照):

この例では、システムの全てのタグをセミコロンで区切った CSV フォーマットで返します。

/include/api.php?op=get&op2=tags&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora

get module_from_conf

= 5.0 (エンタープライズ版のみ)

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_from_conf&apipass=1234&user=admin&pass=pandora&id=9043&id2=example_name

モジュールが見つからない場合は、空の文字列を返します。

get total_modules

グループの全モジュール。

書式:

例 (書式を参照)

Networking モジュールグループの全モジュール数の取得:

.../include/api.php?op=get&op2=total_modules&id=2&apipass=1234&user=admin&pass=pandora

Pandora FMS インストール時のデフォルトでは、以下の モジュールグループ があります。

  1. General.
  2. Networking.
  3. Application.
  4. System.
  5. Miscellaneous.
  6. Performance.
  7. Database.
  8. Enviromental.
  9. Users.

グループ ID が 0 または、省力した場合は、全モジュール数が返ります。

.../include/api.php?op=get&op2=total_modules&apipass=1234&user=admin&pass=pandora

get total_agents

グループの全エージェント

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=total_agents&id=2&apipass=1234&user=admin&pass=pandora

get agent_name

指定した ID のエージェント名

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora

get agent_alias

= 7.0NG

指定した ID のエージェントの別名を取得します。

書式:

ノード:

http://localhost/pandora_console/include/api.php?op=get&op2=agent_alias&id=1&apipass=1234&user=admin&pass=pandora

メタコンソール:

http://localhost/pandora_console/enterprise/meta/include/api.php?op=get&op2=agent_alias&id=1&id2=1&apipass=1234&user=admin&pass=pandora

get module_name

指定した ID のモジュール名

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=module_name&id=1&apipass=1234&user=admin&pass=pandora

get alert_action_by_group

指定したグループにおよびアクションにおいて、実行された全アラート

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=alert_action_by_group&id=0&id2=3&apipass=1234&user=admin&pass=pandora

get alert_actions

アラートアクションの一覧を取得します。

書式:

JSON フォーマットでアラートアクションの一覧を取得する (書式を参照):

.../include/api.php?op=get&op2=alert_actions&return_type=json&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

CSV フォーマットでアラートアクションの一覧を取得する (書式を参照):

.../include/api.php?op=get&op2=alert_actions&return_type=csv&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get alert_actions_meta

この機能はメタコンソールのみです。

メタコンソールからノードのアラートアクション一覧を取得します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=alert_actions_meta&apipass=1234&user=admin&pass=pandora&other=nodo|Create|&other_mode=url_encode_separator_|&return_type=json

get all_alert_commands

全アラートコマンドを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=all_alert_commands&return_type=csv&other=$&apipass=1234&user=admin&pass=pandora

get event_info

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=event_info&id=80&apipass=1234&user=admin&pass=pandora

get tactical_view

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=tactical_view&apipass=1234&user=admin&pass=pandora

get pandora_servers

バージョン 5.0 かそれ以降

書式:

Example

http://localhost/pandora_console/include/api.php?op=get&op2=pandora_servers&return_type=csv&apipass=1234&user=admin&pass=pandora

次の順番で値が返ります。

get custom_field_id

= 5.0

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=custom_field_id&other=mycustomfield&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get gis_agent

= 5.0

エージェントの最新の gis データを返します。

書式:

http://localhost/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=gis_agent&id=1

get special_days

= 5.1

特別日一覧を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=special_days

get module_properties

= 5.1SP2

モジュールのプロパティ一覧を返します。出力する項目は other で指定できます。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_properties&id=6233&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_properties&id=1103&return_type=csv&other=;|%20|module_id_agent_module,module_id_module_type,module_name,module_last_try,module_state&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get module_properties_by_name

= 5.1SP2

モジュールのプロパティ一覧を返します。出力する項目は other で指定できます。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_properties_by_name&id=my_agent&id2=my_module&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_properties_by_name&id=my_agent&id2=my_module&return_type=csv&other=;|%20|module_id_agent_module,module_id_module_type,module_type,module_name,module_last_try,module_state&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get module_properties_by_alias

= 7.0NG

モジュールプロパティの一覧を返します。一覧はパラメータでフィルタできます。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_properties_by_alias&id=pandorafms&id2=Memory_Used&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora

get module_graph

base64 でエンコードされたモジュールグラフを返します。

書式:

バージョン NG 752 以降では、追加のパラメータがあります。必須項目っとそのセパレータ | または、その エスケープ文字 %7C に注意してください。

バージョン NG 752 未満:

http://localhost/pandora_console/include/api.php?op=get&op2=module_graph&id=5&other=3600%7C1&other_mode=url_encode_separator_%7C&apipass=1234&api=1&user=admin&pass=pandora

バージョン NG 752 以上:

http://localhost/pandora_console/include/api.php?op=get&op2=module_graph&id=2&other=3600%7C1%7C1%7C500%7C&other_mode=url_encode_separator_%7C|&apipass=1234&api=1&user=admin&pass=pandora

get all_planned_downtimes

= 5.1

フィルタにマッチした計画停止の一覧を返します。

op=get (必須) op2=all_planned_downtimes (必須) return_type=csv または json (必須) other=<連続パラメータ> (オプション) 計画停止をフィルタするためのパラメータ列:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=all_planned_downtimes&other=test|0|quiet|periodically|weekly&other_mode=url_encode_separator_|&return_type=json&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=all_planned_downtimes&other=test|0|quiet|periodically|weekly&other_mode=url_encode_separator_|&return_type=csv&apipass=1234&user=admin&pass=pandora

get planned_downtimes_items

= 5.1

フィルタにマッチした計画停止のアイテム一覧を返します。

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=planned_downtimes_items&other=test|0|quiet|periodically|weekly&other_mode=url_encode_separator_|&return_type=json&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=planned_downtimes_items&other=test|0|quiet|periodically|weekly&other_mode=url_encode_separator_|&return_type=csv&apipass=1234&user=admin&pass=pandora

get id_group_agent_by_name

= 5.1

エージェントのグループ ID を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=id_group_agent_by_name&other_mode=url_encode_separator_|&other=192.168.50.40

get id_group_agent_by_alias

= 7.0NG

エージェントのグループ ID を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=id_group_agent_by_alias&other_mode=url_encode_separator_%7C&other=pandorafms

get group_agent_by_name

= 5.1

エージェントのグループ名を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=group_agent_by_name&other_mode=url_encode_separator_|&other=192.168.50.40

get group_agent_by_alias

= 7.0NG

エージェントのグループ名を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=group_agent_by_alias&other_mode=url_encode_separator_%7C&other=pandorafms

get group_id_by_name

= 7.0NG

名前からグループ ID を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=group_id_by_name&other=Servers

get get_timezone

= 7.0NG

Pandora に設定されているタイムゾーンを返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=timezone

get cluster_status

= 7.0

ID ごとのクラスタ状態を返します。

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=cluster_status&id=1&apipass=1234&user=admin&pass=pandora

get cluster_id_by_name

= 7.0

名前からクラスタの ID を返します。

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=cluster_id_by_name&id=paco&apipass=1234&user=admin&pass=pandora

get agents_id_name_by_cluster_id

= 7.0

クラスタ ID から、ID ⇒ クラスタエージェント名を返します。

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=agents_id_name_by_cluster_id&id=1&apipass=1234&user=admin&pass=pandora

get agents_id_name_by_cluster_name

= 7.0

クラスタ名から、ID ⇒ クラスタエージェント名を返します。

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=agents_id_name_by_cluster_name&id=paco&apipass=1234&user=admin&pass=pandora

get modules_id_name_by_cluster_id

= 7.0

クラスタ ID から、ID ⇒ クラスタエージェントの全モジュール名を返します。

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=modules_id_name_by_cluster_id&id=1&apipass=1234&user=admin&pass=pandora

get modules_id_name_by_cluster_name

= 7.0

クラスタ名から、ID ⇒ クラスタエージェントの全モジュール名を返します。

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=modules_id_name_by_cluster_name&id=paco&apipass=1234&user=admin&pass=pandora

get cluster_items

= 7.0

クラスタ ID から、アイテムID ⇒ (name,id,module_agent,type,pcrit,pwarn) のフォーマットで json オブジェクトの要素を返します。

pcrit: アクティブ・アクティブの場合は障害状態のパーセンテージ、アクティブ・スタンバイの場合は 1 または 0

pwarn: アクティブ・アクティブの場合は警告状態のパーセンテージ、アクティブ・スタンバイの場合は null

 http://127.0.0.1/pandora_console/include/api.php?op=get&op2=cluster_items&id=1&apipass=1234&user=admin&pass=pandora

get policy

= 7.0NG. 725

ポリシーから全データを返します。ポリシー ID が指定されていない場合は、全ポリシーから全データを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=policy&apipass=1234&user=admin&pass=pandora&return_type=json.

get collections_policy

= 7.0NG. 725

ポリシーの全コレクションを返します。ポリシー ID が指定されていない場合は、全ポリシーの全コレクションを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=collections_policy&apipass=1234&user=admin&pass=pandora&return_type=json.

get plugins_policy

= 7.0NG. 725

ポリシーの全プラグインを返します。ポリシー ID が指定されていない場合は、全ポリシーの全プラグインを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=plugins_policy&apipass=1234&user=admin&pass=pandora&return_type=json.

get inventory_policy

= 7.0NG. 725

ポリシーのインベントリモジュールを返します。ポリシー ID が指定されていない場合は、全ポリシーの全インベントリモジュールを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=inventory_policy&apipass=1234&user=admin&pass=pandora&return_type=json&id=2

get unlinking_policy

= 7.0NG. 725

ポリシーの全未リンクモジュールを返します。ポリシー ID が指定されていない場合は、全ポリシーの全未リンクモジュールを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=unlinking_policy&apipass=1234&user=admin&pass=pandora&return_type=json.

get alerts_policy

= 7.0NG. 725

次の点を考慮して、ポリシーのアラートを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=alerts_policy&apipass=1234&user=admin&pass=pandora&return_type=json&id2=2.

get alerts_actions_policy

= 7.0NG. 725

以下を考慮して、ポリシーのアラートの全アクションを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=alerts_actions_policy&apipass=1234&user=admin&pass=pandora&return_type=json&id=1&id2=3

get agents_policy

= 7.0NG. 725

ポリシーの全エージェントを返します。ポリシー ID が指定されていない場合は、全ポリシーの全エージェントを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=agents_policy&apipass=1234&user=admin&pass=pandora&return_type=json.

get groups_policy

= 7.0NG. 725

ポリシーの全グループを返します。ポリシー ID が指定されていない場合は、全ポリシーの全グループを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=groups_policy&apipass=1234&user=admin&pass=pandora&return_type=json&id=2
get queue_policy
= 7.0NG. 725

ポリシーのキューを返します。ポリシー ID が指定されていない場合は、全ポリシーの全キューを返します。

書式:

http://localhost/pandora_console/include/api.php?op=get&op2=queue_policy&apipass=1234&user=admin&pass=pandora&return_type=json
get traps
= 7.0NG. 728

指定されたソーストラップを返します。また、タイムスタンプやその他のデータをフィルタリングすることもできます。

書式:

https://localhost/pandora_console/include/api.php?op=get&op2=traps&other=1537128000%7C9000%7C0%7C1%7C.1.2.3.6.4&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
get event_responses

Pandora FMS でユーザがアクセスするイベント応答の一覧を返します。

書式:

この例では、csv フォーマットで全システムイベント応答を返します。

http://localhost/pandora_console/include/api.php?op=get&op2=event_responses&return_type=csv&apipass=1234&user=admin&pass=pandora
get users

Pandora FMS のユーザ一覧を返します。

書式:

この例では、全ユーザを CSV フォーマットで返します。

http://localhost/pandora_console/include/api.php?op=get&op2=users&return_type=csv&apipass=1234&user=admin&pass=pandora&other_mode=url_encode_separator_&

get list all user

この機能はメタコンソールのみです。

全 Pandora FMS ユーザ一覧を出力します。

書式:

Json または CSV にて返すことができます。この戻り値は URL を介して指定します。 応答タイプのみの指定で、その他変数は使用しません。

http://localhost/pandora_console/include/api.php?op=get&op2=list_all_user&return_type=json&apipass=1234&user=admin&pass=pandora

get info user name

この機能はメタコンソールのみです。

ユーザデータの一覧を返します。

書式:

指定のユーザに関するすべての情報を取得します。 Json または CSV にて返すことができます。この戻り値は URL を介して指定します。 応答タイプのみの指定で、その他変数は使用しません。

http://localhost/pandora_console/include/api.php?op=get&op2=info_user_name&return_type=json&other=admin&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get user_profiles_info

Pandora FMS のユーザプロファイル一覧を返します。

書式:

この例では、全システムユーザプロファイルを json フォーマットで返します。

http://localhost/pandora_console/include/api.php?op=get&op2=user_profiles_info&return_type=csv&apipass=1234&user=admin&pass=pandora&other_mode=url_encode_separator_&

get migrate_agent

= 7.21 メタコンソールのみ

エージェントマイグレーションキューに、指定のエージェントが存在するかを確認します。

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=migrate_agent&apipass=1234&user=admin&pass=pandora&id=2&return_type=json

get language

= 7.0NG 730

Pandora FMS に設定されている言語を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=language

get session_timeout

= 7.0NG 730

Pandora FMS に設定されたセッションタイムアウトを返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=session_timeout

get groups

= 7.0NG 732

存在するグループを返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=groups&other=;%7C1%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

get filter user group

この機能はメタコンソールのみです。

フィルタリングを行ったユーザグループを取得します。

書式:

Json または CSV にて返すことができます。この戻り値は URL を介して指定します。 2つの変数(グループIDまたは有効化)の 1つは空ですが、少なくとも 1つは入力する必要があることに注意してください。

2つの変数(グループIDまたは Enabled)のうちいずれかが空でも構いませんが、少なくとも一つは指定する必要があることに注意してください。

http://localhost/pandora_console/include/api.php?op=get&op2=filter_user_group&return_type=json&other=0|0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

get inventory_modules

Pandora インベントリモジュールの一覧を返します。

書式:

この例では、全インベントリの情報を json フォーマットで返します。

http://localhost/pandora_console/include/api.php?op=get&op2=inventory_modules&return_type=json&apipass=1234&user=admin&pass=pandora

get inventory_modules_by_name

エージェント名を用いてエージェントからインベントリモジュールを取得します。

書式:

http://localhost/pandora_console/include/api.phpop=get&op2=inventory_modules_by_name&id=name&return_type=csv&apipass=1234&user=admin&pass=pandora

get inventory_modules_by_alias

エージェントの別名を用いて、エージェントからインベントリモジュールを取得します。

書式:

http://localhost/pandora_console/include/api.phpop=get&op2=inventory_modules_by_alias&id=alias&return_type=csv&apipass=1234&user=admin&pass=pandora

get inventory_module_data

エージェント名とモジュールを用いて、インベントリモジュールからデータを取得します。

書式:

http://127.0.0.1/pandora_console/include/api.phpop=get&op2=inventory_module_data&id=e14ae3b959b08a1fb7a057281401a08063cf04eb714efa5fbf1cf4043cfa1314&id2=Routes&other=,%7C20191010T13:40%7C20191211T13:40%7C0&return_type=csv&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

get list_collections

Pandora の全コレクションの一覧を返します。

書式:

この例では、全コレクションの情報を json フォーマットで返します。

http://localhost/pandora_console/include/api.php?op=get&op2=list_collections&apipass=1234&user=admin&pass=pandora

get list_collection_files

コレクション内の全ファイル一覧を返します。コレクション ID を指定しなかった場合、全コレクションの全ファイルを返します。

書式:

この例では、コレクション内の全ファイル名を json フォーマットで返します。

http://localhost/pandora_console/include/api.php?op=get&op2=list_collection_files&id=1&apipass=1234&user=admin&pass=pandora

get all_event_filters

存在するイベントフィルタの一覧を返します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=all_event_filters&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora

get event_mcid

ノードの ID および、ノードのイベント ID を用いて、メタコンソールでのイベント ID を返します。

この機能はメタコンソールのみです。

書式:

http://172.16.0.3/pandora_console/include/api.php?op=get&op2=event_mcid&return_type=json&id=0&id2=0&apipass=1234&user=admin&pass=pandora

get is_centralized

ノードが中央管理されているか(1)、そうでないか(0)を返します。 ノードが存在しない場合は、その旨を通知するテキスト文字列が返されます。メタコンソールおよびノードで直接使用することができます。

書式:

ノードでの例:

 http://localhost/pandora_console/include/api.php?op=get&op2=is_centralized&apipass=1234&user=admin&pass=pandora

メタコンソールでの例:

http://localhost/pandora_console/include/api.php?op=get&op2=is_centralized&id=3&apipass=1234&user=admin&pass=pandora

SET

データを送信します。

set new_agent

パラメータで指定した内容で新たなエージェントを作成します。

書式:

ノード での呼び出し例:

.../include/api.php?op=set&op2=new_agent&other=agent_api|1.1.1.1|0|4|0|0|300|10|pandorafms|8|10||description|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

メタコンソール での呼び出し例:

.../include/api.php?op=set&op2=new_agent&id=1&other=agent_api|1.1.1.1|0|4|0|0|300|10|pandorafms|8|10||description|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_agent

パラメータで渡したデータで、エージェントを更新します。

書式:

例 (書式を参照):

.../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

set update_agent_field

この呼び出しは、1つもしくは、(別名を利用し一致するエージェントが複数ある場合は)複数のエージェントのフィールドを更新します。

書式:

エージェント名を利用する場合:

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

別名を利用する場合。別名を含む全エージェントを編集します:

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

set delete_agent

指定した名前のエージェントを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_agent&id=agente_erroneo

set create_module_template

id に指定したテンプレート、other に指定したエージェント、モジュール ID から、アラートを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_module_template&id=1&other=1|10&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set apply_module_template

モジュールテンプレートをエージェントへ適用します。

モジュールテンプレートは、ネットワークモジュールを集めたものです。このテンプレートは、直接エージェントに適用することができ、モジュールを一つ一つ追加する必要はありません。

書式:

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

set create_network_module

指定のパラメータでネットワークモジュールを作成します。

書式:

  1. < モジュール名 >
  2. < 無効化 >
  3. < モジュールタイプID >
  4. < モジュールグループID >
  5. < 警告の最小値 >
  6. < 警告の最大値 >
  7. < 警告の文字列 >
  8. < 障害の最小値 >
  9. < 障害の最大値 >
  10. < 障害の文字列 >
  11. < 連続抑制回数 >
  12. < データの保存 >
  13. < 対象IP >
  14. < TCPポート >
  15. < SNMPコミュニティ >
  16. < SNMP OID >
  17. < モジュール間隔 >
  18. < データ保存倍率 >
  19. < 最小 >
  20. < 最大 >
  21. < カスタムID >
  22. < 説明 >
  23. < 不明イベントの有効化 >
  24. < モジュールマクロ > それぞれのマクロのプロパティを一つのオブジェクトにまとめて base 64 エンコードした JSON 文字列でなければいけません。JSON プロパティの書式は、“<macro name>”: “<macro value>” でなければいけません。
  25. < 個別状態変化の利用 >
  26. < 正常移行時連続抑制回数 >
  27. < 警告移行時連続抑制回数 >
  28. < 障害移行時連続抑制回数 >
  29. < 障害条件の反転 >
  30. < 警告状態の反転 >
  31. < ff_type >
  32. < 不明の無視 > 0 もしくは 1
  33. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

/include/api.php?op=set&op2=create_network_module&id=example&other=test|0|7|1|10|15|0|16|18|0|15|0|127.0.0.1|0||0|180|0|0|0|0|latency%20ping&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set create_plugin_module

指定のパラメータでプラグインモジュールを作成します。

書式:

  1. < モジュール名 >
  2. < 無効化 >
  3. < モジュールタイプID >
  4. < モジュールグループID >
  5. < 警告の最小値 >
  6. < 警告の最大値 >
  7. < 警告の文字列 >
  8. < 障害の最小値 >
  9. < 障害の最大値 >
  10. < 障害の文字列 >
  11. < 連続抑制回数 >
  12. < データの保存 >
  13. < 対象IP >
  14. < TCPポート >
  15. < SNMPコミュニティ >
  16. < SNMP OID >
  17. < モジュール間隔 >
  18. < 保存倍率 >
  19. < 最小値 >
  20. < 最大値 >
  21. < カスタムID >
  22. < 説明 >
  23. < プラグインID >
  24. < プラグインユーザ >
  25. < プラグインパスワード >
  26. < プラグインパラメータ >
  27. < 不明イベントの有効化 >
  28. < マクロ > base 64 でエンコードされた JSON 文字列である必要があります。
  29. < モジュールマクロ > これは、マクロごとに 1 つのプロパティを持つオブジェクトで構成される、base64 でエンコードされた JSON ドキュメントである必要があります。 JSON プロパティの形式は、“<macro name>”: “<macro value>” である必要があります。
  30. < 個別状態変化の利用 >
  31. < 正常移行時連続抑制回数 >
  32. < 警告移行時連続抑制回数 >
  33. < 障害移行時連続抑制回数 >
  34. < 障害条件の反転 >
  35. < 警告条件の反転 >
  36. < ff_type >
  37. < エージェント別名の利用 > 0 または 1
  38. < 不明の無視 > 0 または 1
  39. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

/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

JSON ドキュメントの内容は、次のプロパティを持つ複数のオブジェクトで構成されるオブジェクトである必要があります。

例:

{
 "1": {
   "macro": "_field1_",
   "desc": "Target IP",
   "help": "",
   "value": "192.168.0.1",
   "hide": ""
 },
 "2": {
   "macro": "_field2_",
   "desc": "Port",
   "help": "",
   "value": "80",
   "hide": ""
 }
}

set create_data_module

指定したパラメータでモジュールを作成します。

このコマンドにてデータベースにモジュールデータを追加できますが、モジュールに関連づけられたエージェントの設定ファイルの編集はできません。

書式:

  1. <モジュール名>
  2. <無効化>
  3. <モジュールタイプID>
  4. <説明>
  5. <モジュールグループID>
  6. <最小値>
  7. <最大値>
  8. <データ保存倍率>
  9. <モジュールの間隔>
  10. <警告の最小値>
  11. <警告の最大値>
  12. <警告の文字列>
  13. <障害の最小値>
  14. <障害の最大値>
  15. <障害の文字列>
  16. <データの保存>
  17. <不明イベントの有効化>
  18. <モジュールマクロ> それぞれのマクロのプロパティを一つのオブジェクトにまとめて base 64 エンコードした JSON 文字列でなければいけません。JSON プロパティの書式は、“<macro name>”: “<macro value>” でなければいけません。
  19. <連続抑制回数>
  20. <個別状態変化の利用>
  21. <正常移行時連続抑制回数>
  22. <警告移行時連続抑制回数>
  23. <障害移行時連続抑制回数>
  24. <連続抑制タイムアウト>
  25. <障害条件の反転>
  26. <警告条件の反転>
  27. <ff_type>
  28. <不明の無視> 0 または 1
  29. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

/include/api.php?op=set&op2=create_data_module&id=test&other=test%202|0|1|data%20module%20from%20api|1|10|20|10.50|180|10|15||16|20||0|0|0|0|0|0|0|0|0|0|0|1|1&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set create_SNMP_module

SNMP モジュールを作成します。

書式:

  1. <モジュール名>
  2. <無効化>
  3. <モジュールタイプID>
  4. <モジュールグループID>
  5. <警告の最小値>
  6. <警告の最大値>
  7. <警告の文字列>
  8. <障害の最小値>
  9. <障害の最大値>
  10. <障害の文字列>
  11. <連続抑制回数>
  12. <データの保存>
  13. <対象IP>
  14. <モジュールのポート>
  15. <SNMPバージョン>
  16. <SNMPコミュニティ>
  17. <SNMP OID>
  18. <モジュールの間隔>
  19. <データ保存倍率>
  20. <最小値>
  21. <最大値>
  22. <カスタムID>
  23. <説明>
  24. <SNMPv3 暗号化手法 [AES|DES]>
  25. <SNMPv3 暗号化パスワード>
  26. <SNMPv3 セキュリティレベル [authNoPriv|authPriv|noAuthNoPriv]>
  27. <SNMPv3 認証手法 [MD5|SHA]>
  28. <SNMPv3 認証ユーザ>
  29. <SNMPv3 認証パスワード>
  30. <不明イベントの有効化>
  31. <個別状態変化の利用>
  32. <正常移行時連続抑制回数>
  33. <警告移行時連続抑制回数>
  34. <障害移行時連続抑制回数>
  35. <ff_type>
  36. <不明の無視> 0 または 1
  37. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

例 1 (SNMP v3, 暗号化手法: AES, 暗号化パスワード: example_priv_passw, セキュリティレベル: authNoPriv, 認証手法:MD5, 認証ユーザ: pepito_user, 認証パスワード: example_priv_passw)

/include/api.php?op=set&op2=create_snmp_module&id=example&other=prueba|0|15|1|10|15||16|18||15|0|127.0.0.1|60|3|public|.1.3.6.1.2.1.1.1.0|180|0|0|0|0|SNMP%20module%20from%20API|AES|example_priv_passw|authNoPriv|MD5|pepito_user|example_auth_passw&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

例 2 (SNMP v1)

/include/api.php?op=set&op2=create_snmp_module&id=example&other=prueba2|0|15|1|10|15||16|18||15|0|127.0.0.1|60|1|public|.1.3.6.1.2.1.1.1.0|180|0|0|0|0|SNMP&20module&20from&20API&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_network_module

ネットワークモジュールを更新します。

書式:

  1. <エージェントID>
  2. <無効化>
  3. <モジュールグループID>
  4. <警告の最小値>
  5. <警告の最大値>
  6. <警告文字列>
  7. <障害の最小値>
  8. <障害の最大値>
  9. <障害文字列>
  10. < min_ff_even >
  11. <連続抑制回数>
  12. <データの保存>
  13. <対象のIPO>
  14. <モジュールのポート>
  15. <SNMPコミュニティ>
  16. <SNMP OID>
  17. <モジュールの間隔>
  18. <データ保存倍率>
  19. <最小値>
  20. <最大値>
  21. <カスタムID>
  22. <説明>
  23. <イベントタイプの無効化>
  24. <モジュールマクロ> それぞれのマクロのプロパティを一つのオブジェクトにまとめて base 64 エンコードした JSON 文字列でなければいけません。JSON プロパティの書式は、“<macro name>”: “<macro value>” でなければいけません。
  25. <個別状態変化の利用>
  26. <正常移行時連続抑制回数>
  27. <警告移行時連続抑制回数>
  28. <障害移行時連続抑制回数>
  29. <障害条件の反転>
  30. <警告条件の反転>
  31. <ff_type>
  32. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

/include/api.php?op=set&op2=update_network_module&id=132&other=|0|6|2|10|15||16|18||7|0|127.0.0.1|0||0|300|30.00|0|0|0|latency%20ping%20modified%20by%20the%20Api|||||||||||2020&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_plugin_module

プラグインモジュールを更新します。

書式:

  1. <エージェントID>
  2. <無効化>
  3. <モジュールグループID>
  4. <警告の最小値>
  5. <警告の最大値>
  6. <警告文字列>
  7. <障害の最小値>
  8. <障害の最大値>
  9. <障害文字列>
  10. <連続抑制回数>
  11. <データの保存>
  12. <対象IP>
  13. <モジュールのポート>
  14. <SNMPコミュニティ>
  15. <SNMP OID>
  16. <モジュールの間隔>
  17. <データ保存倍率>
  18. <最小値>
  19. <最大値>
  20. <カスタムID>
  21. <説明>
  22. <プラグインID>
  23. <プラグインユーザ>
  24. <プラグインパスワード>
  25. <プラグインパラメータ>
  26. <イベントタイプの無効化>
  27. <マクロ> base 64 でエンコードされた文字列でなければいけません。
  28. <モジュールマクロ> それぞれのマクロのプロパティを一つのオブジェクトにまとめ base 64 でエンコードした JSON 文字列でなければいけません。JSON プロパティの書式は、“<macro name>”: “<macro value>” でなければいけません。
  29. <個別状態変化の利用>
  30. <正常移行時連続抑制回数>
  31. <警告移行時連続抑制回数>
  32. <障害移行時連続抑制回数>
  33. <障害条件の反転>
  34. <警告条件の反転>
  35. <リンクポリシー>
  36. <ff_type>
  37. <不明の無視> 0 または 1
  38. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

…/include/api.php?op=set&op2=update_plugin_module&id=2343&other=44|0|2|0|0||0|0||0|0|127.0.0.1|0||0|300|0|0|0|0|pluginmodule%20from%20api|2|admin|pass|-p%20max&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

内容は、次のプロパティで表すオブジェクトを一つにまとめたものでなければいけません。

JSON マクロフォーマットの例:

{
 "1": {
   "macro": "_field1_",
   "desc": "Target IP",
   "help": "",
   "value": "192.168.0.1"
 },
 "2": {
   "macro": "_field2_",
   "desc": "Port",
   "help": "",
   "value": "80"
 }
}

状態スケーリングを使用した別の例:

/include/api.php?op=set&op2=update_plugin_module&id=135&other=|0|2|0|0||0|0||0|0|127.0.0.1|0||0|300|0|0|0|0|plugin%20module%20from%20api|2|admin|pass|-p%20max|||||||||||||2020&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora"

set update_data_module

これによりデータベースにモジュールデータを追加することはできますが、該当モジュールに関するエージェントの設定ファイルを変更することはできません。

ローカルモジュールを更新します。

書式:

  1. < エージェントID >
  2. < 無効化 > 無効化の場合は 1変更なし0
  3. < 説明 >
  4. < モジュールグループID > get_module_groups を参照。
  5. < 最小 >
  6. < 最大 >
  7. < 保存倍率 > ( Enterprise 版(ソフトウエアエージェント でリモート設定が有効な場合のみ)
  8. < 警告の最小値 >
  9. < 警告の最大値 >
  10. < 警告文字列 >
  11. < 障害の最小値 >
  12. < 障害の最大値 >
  13. < 障害文字列 >
  14. < データの保存 > 0 に設定するとモジュールのデータは、tagente_datos に保存されません。tagent_estado のみ更新されます。
  15. < 無効化イベント > JSON フォーマット。例: {“going_unknown”:1}
  16. < モジュールマクロ > これは、マクロごとに 1 つのプロパティを持つオブジェクトで構成された、base64 でエンコードされた JSON ドキュメントである必要があります。JSON プロパティのフォーマット: “<macro name>”: “<macro value>”
  17. < 連続抑制回数 > モジュールの監視結果が何回連続で変化したらモジュールの状態を変更するかの値。(連続抑制回数 )
  18. < 個別状態変化の利用 >
  19. < 正常移行時連続抑制回数 >
  20. < 警告移行時連続抑制回数 >
  21. < 障害移行時連続抑制回数 >
  22. < 連続抑制タイムアウト >
  23. < 障害条件の反転 >
  24. < 警告条件の反転 >
  25. < 関連ポリシー >
  26. < 連続抑制カウンタの維持 >
  27. < 不明の無視 > 0 または 1

例 (書式を参照):

.../include/api.php?op=set&op2=update_data_module&id=123&other=44|0|data%20module%20modified%20from%20API|6|0|0|50.00|300|10|15||16|18||0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_data_module_policy

ポリシーのデータモジュールを更新し、新たなモジュールの ID を返します。

書式:

  1. <ポリシーモジュールID>
  2. <説明>
  3. <モジュールグループID>
  4. <最小>
  5. <最大>
  6. <事前処理>
  7. <モジュールの間隔>
  8. <警告の最小値>
  9. <警告の最大値>
  10. <障害の最小値>
  11. <障害の最大値>
  12. <障害の文字列>
  13. <データの保存>
  14. <設定データ>
  15. <disabled_types_event>
  16. <モジュールマクロ> (バージョン 5以降) 各マクロに対して 1つのプロパティを持つオブジェクトによって形成された、base64 でエンコードされた JSON ドキュメントである必要があります。JSON フォーマットは、<マクロ名>:<マクロ値> のようになっている必要があります。
  17. <不明の無視> 0 または 1

例 (書式を参照):

.../include/api.php?op=set&op2=update_data_module_policy&id=1&other=10|data%20module%20updated%20by%20Api|2|0|0|50.00|10|20|180||21|35||1|module_begin%0dmodule_name%20pandora_process%0dmodule_type%20generic_data%0dmodule_exec%20ps%20aux%20|%20grep%20pandora%20|%20wc%20-l%0dmodule_end&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_SNMP_module

SNMP モジュールを更新します。

書式:

  1. <エージェントID>
  2. <無効化>
  3. <モジュールグループID>
  4. <警告の最小値>
  5. <警告の最大値>
  6. <警告文字列>
  7. <障害の最小値>
  8. <障害の最大値>
  9. <障害文字列>
  10. <連続抑制回数>
  11. <データの保存>
  12. <対象のIP>
  13. <モジュールのポート>
  14. <SNMPバージョン>
  15. <SNMPコミュニティ>
  16. <SNMP OID>
  17. <モジュールの間隔>
  18. <データ保存倍率>
  19. <最小値>
  20. <最大値>
  21. <カスタムID>
  22. <説明>
  23. <snmp3 暗号化方式 [AES|DES]>
  24. <snmp3 暗号化パスワード>
  25. <snmp3 セキュリティレベル [authNoPriv|authPriv|noAuthNoPriv]>
  26. <snmp3 認証方式 [MD5|SHA]>
  27. <snmp3 認証ユーザ>
  28. <snmp3 認証パスワード>
  29. <イベントタイプの無効化>
  30. <個別状態変化の利用>
  31. <正常移行時連続抑制回数>
  32. <警告移行時連続抑制回数>
  33. <障害移行時連続抑制回数>
  34. <リンクポリシー>
  35. <ff_type>
  36. <不明の無視> 0 または 1
  37. < 警告の間隔数 > モジュールが警告状態に留まる連続間隔の最大数を指定することにより、状態のスケーリングを可能にします。 この値を超えると、モジュールは障害状態にエスカレートします。

例 (書式を参照):

例 (SNMPバージョン: 3、snmp3暗号化方式: AES、snmp3暗号化パスワード: example_priv_passw、snmp3セキュリティレベル: authNoPriv、snmp3認証方式:MD5、snmp3認証ユーザ: pepito_user、snmp3認証パスワード: example_priv_passw)

/include/api.php?op=set&op2=update_snmp_module&id=33432&other=44|0|6|20|25||26|30||15|1|127.0.0.1|60|3|public|.1.3.6.1.2.1.1.1.0|180|50.00|10|60|0|SNMP%20module&20modified%20by%20API|AES|example_priv_passw|authNoPriv|MD5|example_user|example_auth_passw&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

状態スケーリングと SNMP v1 を使用した別の例:

/include/api.php?op=set&op2=update_snmp_module&id=137&other=|0|6|20|25||26|30||15|1|127.0.0.1|60|1|public|.1.3.6.1.2.1.1.1.0|180|50.00|10|60|||||||||||2020&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora"

状態スケーリングと SNMP v3 を使用した別の例:

/include/api.php?op=set&op2=update_snmp_module&id=138&other=|0|6|20|25||26|30||15|1|127.0.0.1|60|3|public|.1.3.6.1.2.1.1.1.0|180|50.00|10|60|0|SNMP%20module%20modified%20by%20API|AES|example_priv_passw|authNoPriv|MD5|example_user|example_auth_passw|||||||||2020&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora"

set apply_policy

ひとつもしくは複数のエージェントに、ID を指定してポリシーを適用します。

書式:

http://192.168.70.102/pandora_console/include/api.php?op=set&op2=apply_policy&id=22&id2=3e&other=0 |1&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set apply_all_policies

Pandora 内にある全ポリシーを適用します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=apply_all_policies&apipass=1234&user=admin&pass=pandora

set add_network_module_policy

指定したパラメータで、ポリシーにネットワークモジュールを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_network_module_policy&id=1&other=network_module_policy_example_name |6|network%20module%20created%20by%20Api|2|0|0|50.00|180|10|20||21|35||1|15|0|66|||0&other_mode=url_encode_separator_|

set add_plugin_module_policy

指定したパラメータで、ポリシーにプラグインモジュールを追加します。

書式:

{
 "1": {
   "macro": "_field1_",
   "desc": "Target IP",
   "help": "",
   "value": "192.168.0.1"
 },
 "2": {
   "macro": "_field2_",
   "desc": "Port",
   "help": "",
   "value": "80"
 }
}

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_plugin_module_policy&id=1&other=example%20plugin%20module%20name|0|1|2|0|0||0|0||15|0|66|||300|50.00|0|0|0|plugin%20module%20from%20api|2|admin|pass|-p%20max&other_mode=url_encode_separator_|

set add_data_module_policy

指定したパラメータで、ポリシーにローカルモジュールを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_data_module_policy&id=1&other=data_module_policy_example_name~2~data%20module%20created%20by%20Api~2~0~0~50.00~10~20~180~~21~35~~1~module_begin%0dmodule_name%20pandora_process%0dmodule_type%20generic_data%0dmodule_exec%20ps%20aux%20|%20grep%20pandora%20|%20wc%20-l%0dmodule_end&other_mode=url_encode_separator_~

set add_SNMP_module_policy

指定したパラメータで、ポリシーに SNMP モジュールを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_snmp_module_policy&id=1&other=example%20SNMP%20module%20name|0|15|2|0|0||0|0||15|1|66|3|public|.1.3.6.1.2.1.1.1.0|180|50.00|10|60|0|SNMP%20module%20modified%20by%20API|AES|example_priv_passw|authNoPriv|MD5|pepito_user|example_auth_passw&other_mode=url_encode_separator_|

set add_agent_policy_by_id

エージェント ID を用いてポリシーにエージェントを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_agent_policy_by_id&id=2&other=1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_agent_policy_by_id&id=2&other=1%7C1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set add_agent_policy_by_name

エージェント名を用いてポリシーへエージェントを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_agent_policy_by_name&id=4&other=e76774025b24057cc71df514f27027c43484c3af766ed40f259a86a4fd568f9d&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set remove_agent_from_policy_by_id

エージェント ID を用いて、ポリシーからエージェントを削除します。

書式:

必須

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=remove_agent_from_policy_by_id&id=2&other=2&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=remove_agent_from_policy_by_id&id=4&other=1%7C1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set remove_agent_from_policy_by_name

エージェント名を用いて、ポリシーからエージェントを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=remove_agent_from_policy_by_name&id=4&other=e76774025b24057cc71df514f27027c43484c3af766ed40f259a86a4fd568f9d&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set new_network_component

新たなネットワークコンポーネントを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_network_component&id=example_network_component_name&other=7|network%20component%20created%20by%20Api|300|30|10|public|3||1|10|20|str|21|30|str1|10|50.00|12&other_mode=url_encode_separator_|

set new_plugin_component

新たなプラグインコンポーネントを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_plugin_component&id=example_plugin_component_name&other=2|plugin%20component%20created%20by%20Api|300|30|10|66|3|2|example_user|example_pass|-p%20max||1|10|20|str|21|30|str1|10|50.00|12&other_mode=url_encode_separator_|

set new_snmp_component

新たな SNMP コンポーネントを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_snmp_component&id=example_snmp_component_name&other=16|SNMP%20component%20created%20by%20Api|300|30|10|3||1|10|20|str|21|30|str1|15|50.00|3|.1.3.6.1.2.1.2.2.1.8.2|public|example_auth_user|example_auth_pass|66|AES|example_priv_pass|MD5|authNoPriv|12&other_mode=url_encode_separator_|

set new_local_component

新たなローカルコンポーネントを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_local_component&id=example_local_component_name&other=local%20component%20created%20by%20Api~5~12~module_begin%0dmodule_name%20example_local_component_name%0dmodule_type%20generic_data%0dmodule_exec%20ps%20|%20grep%20pid%20|%20wc%20-l%0dmodule_interval%202%0dmodule_end&other_mode=url_encode_separator_~

set create_alert_template

アラートテンプレートを作成します。

書式:

例1 (状態: regexp =~ /pp/、アクション: Mail to XXX、最大アラート数: 10、最小アラート数: 0、優先度: 警告、グループ: database):

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_alert_template&id=example&other=regex|template%20based%20in%20regexp|1||||pp|1||||10|0|||||||||||||3|8&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

例2 (状態: 値が5と10の間以外、最大値: 10.00、最小値: 5.00、開始時間: 00:00:00、終了時間: 15:00:00、優先度: 障害、グループ: Servers):

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_alert_template&id=template_min_max&other=max_min|template%20based%20in%20range|1||||||10|5||||00:00:00|15:00:00|||||||||||4|2&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_alert_template

アラートテンプレートを更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_alert_template&id=18&other=example_template_with_changed_name|onchange|changing%20from%20min_max%20to%20onchange||||||1||||5|1|||1|1|0|1|1|0|0|1|field%20recovery%20example%202|field%20recovery%20example%203|1|8&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set delete_alert_template

アラートテンプレートと、テンプレートで使われているアラートを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_alert_template&id=38

set delete_module_template

モジュールテンプレートを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_module_template&id=38

set delete_module_template_by_names

モジュールテンプレートを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_module_template_by_names&id=sample-agent&id2=test&other=memfree&apipass=1234&user=admin&pass=pandora

set stop_dowtime

計画停止を停止します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=stop_downtime&id=1

set new_user

Pandora FMS に新たなユーザを作成します。

書式:

上記の 13 個のフィールドのいずれかを指定しない場合は、セパレーターを入力するだけです (呼び出し書式 を参照)。

(書式を参照):

.../include/api.php?op=set&op2=new_user&id=id_nu&other=John%20J.%20Doe|John|Doe|Jay|1234|johndoe@example.com|5555555|en||30|||-1|&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

Set update_user

指定した ID のユーザを指定したパラメータで更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_user&id=example_user_name&other=example_fullname||example_lastname||example_new_passwd|example_email||example_language|example%20comment|1|30|&other_mode=url_encode_separator_|

set delete_user

ID で指定したユーザを削除します。

書式:

(書式を参照):

../include/api.php?op=set&op2=delete_user&id=md&apipass=1234&user=admin&pass=pandora

Set delete_user_permissions

この機能はメタコンソールのみです。

ユーザのパーミッションを削除します。

書式:

ユーザのパーミッションを削除します。 Json または CSV にて返すことができます。この戻り値は URL を介して指定します。

http://localhost/pandora_console/include/api.php?op=set&op2=delete_user_permission&return_type=json&other=2&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

Set add_permission_user_group

この機能はメタコンソールのみです。

ユーザグループへパーミッションを追加します。

書式:

Json または CSV にて返すことができます。この戻り値は URL を介して指定します。

no_hierarchy が空の場合、値が 0 になることに注意してください。

既存のプロファイルを変更する場合は、profile_user テーブルのプロファイルIDが使用されることに注意してください。

http://localhost/pandora_console/include/api.php?op=set&op2=add_permission_user_to_group&return_type=json&other=admin|0|1|1|20&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set enable_disable_user

ユーザを無効化・有効化します。

書式:

例1 (ユーザ 'example_name' を無効化)

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=enable_disable_user&id=example_name&other=0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

例2 (ユーザ 'example_name' を有効化)

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=enable_disable_user&id=example_name&other=1&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set meta_synch_user

Template:メタコンソール ノードへメタコンソールユーザを同期します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=meta_synch_user&apipass=1234&user=admin&pass=pandora&other=name1,name2|nodo1|0|||&other_mode=url_encode_separator_|

set create_group

グループを作成します。

書式:

例1 (親グループ: Servers)

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_group&id=example_group_name&other=applications|2&other_mode=url_encode_separator_|

例2 (親グループなし)

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_group&id=example_group_name2&other=computer|&other_mode=url_encode_separator_|

例3 (パスワード “1234” かつ、グループ内のエージェント数制限 3 でエージェントグループを作成)

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_group&id=example_group_name&other=applications|2|||||||3|1234&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_group

グループの設定を更新します。

書式:

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_group&id=example_group_id&other=New%20Name|application|2|new%20description|1|0|custom%20id||&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set delete_group

グループを削除します。

書式:

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_group&id=303&apipass=1234&user=admin&pass=pandora

set add_user_profile

ユーザにプロファイルを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_user_profile&id=md&other=12|4&other_mode=url_encode_separator_|

set delete_user_profile

ユーザのプロファイルを削します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_user_profile&id=md&other=12|4&other_mode=url_encode_separator_|

set new_incident

新たなインシデントを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_incident&other=titulo|descripcion%20texto|Logfiles|2|10|12&other_mode=url_encode_separator_|

set new_note_incident

インシデントにコメントを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_note_incident&id=5&id2=miguel&other=una%20nota%20para%20la%20incidencia

set validate_all_alerts

全アラートを承諾します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=validate_all_alerts

set validate_all_policy_alerts

ポリシーから作成されたアラートを承諾します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=validate_all_policy_alerts

set event_validate_filter

指定したフィルタにマッチするすべてのイベントを承諾します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=event_validate_filter&other_mode=url_encode_separator_|&other=;|2

set event_validate_filter_pro

前述の API と似たものです。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=event_validate_filter_pro&other_mode=url_encode_separator_|&other=;|2

set validate_event_by_id

指定した ID のイベントを承諾します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora

set new_alert_template

テンプレートおよび、エージェントIDおよびモジュール名からモジュールを指定して、新たなアラートを適用します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_alert_template&id=miguel-portatil&id2=test&other_mode=url_encode_separator_|&other=memfree

set alert_actions

アラートにアクションを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=alert_actions&id=miguel-portatil&id2=test&other_mode=url_encode_separator_|&other=memfree|test
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=alert_actions&id=miguel-portatil&id2=test&other_mode=url_encode_separator_|&other=memfree|test|1|3

set alert_commands

アラートにコマンドを追加します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=alert_commands&id=PRUEBA1&other=command|0|Desc|1|des1|val1|des2|val2|des3|val3||val4|des5&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set new_module

新たなモジュールを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_module&id=miguel-portatil&id2=juanito&other_mode=url_encode_separator_|&other=remote_tcp_string|localhost|33|descripcion%20larga

set delete_module

モジュールを削除します。

バージョン 768 以降、削除するモジュール (例: Host Alive ) が別のモジュールの (“関連障害検知抑制” が有効)である場合、 モジュールも削除されます。

書式:

例 (書式を参照):

.../include/api.php?op=set&op2=delete_module&id=example&id2=example2&apipass=1234&user=admin&pass=pandora&other_mode=url_encode_separator_|

simulate パラメータ

このパラメータを利用する場合は、以下を利用する必要があります。

other_mode=url_encode_separator_< セパレータ >

エージェントが存在し、そのモジュールも存在するかどうかを確認したい場合は、最終的な削除を実行する前にsimulate パラメータを使用できます。 テスト呼び出しが正しくない場合、Pandora FMS API 1.0 は次のメッセージを返します: Parameter error.

例 (書式を参照):

.../include/api.php?op=set&op2=delete_module&id=agent_name_example&id2=module_name_example&other=simulate&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set enable_alert

エージェントのアラートを有効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=enable_alert&id=garfio&id2=Status&other=Warning%20condition

set enable_alert_alias

エイリアスでエージェントのアラートを有効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=enable_alert_alias&id=nova&id2=CPU%20Load&other=critical%20condition&apipass=1234&user=admin&pass=pandora

set disable_alert

エージェントのアラートを無効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=garfio&id2=Status&other=Warning%20condition

set disable_alert_alias

エージェントのアラートを無効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert_alias&id=nova&id2=CPU%20Load&other=critical%20condition&apipass=1234&user=admin&pass=pandora

set enable_module_alerts

enable_alert と同じです。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=enable_module_alerts&id=garfio&id2=Status

set disable_module_alerts

disable_alert と同じです。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=disable_module_alerts&id=garfio&id2=Status

set enable_module

モジュールを有効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=enable_module&id=garfio&id2=Status

set disable_module

モジュールを無効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=disable_module&id=garfio&id2=Status

set create_network_module_from_component

コンポーネントから新たなネットワークモジュールを作成します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=create_network_module_from_component&id=garfio&id2=OS%20Total%20process&apipass=1234&user=admin&pass=pandora

set module_data

モジュールに値を追加します。この機能は、サーバに送信するデータを含む XML を生成します。このデータはデータベースを更新するためのものです。

この API 呼び出しは、XML ファイルの生成を制御し、そのプロセスの状態をメッセージで表示します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=module_data&id=14&other_mode=url_encode_separator_|&other=123|now&apipass=1234&user=admin&pass=pandora

XML ファイルの生成が成功しても、データがデータベースに保存されることは保証されません。

set new_module_group

新たなモジュールグループを作成します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=new_module_group&id=Module_group_name&apipass=1234&user=admin&pass=pandora

set module_group_synch

Template:メタコンソール メタコンソールからモジュールグループを同期します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=module_group_synch&other=server_name1|server_name2|server_name3&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set add_module_in_conf

= 5.0 (エンタープライズ版のみ)

ローカルモジュールに設定を追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_module_in_conf&apipass=1234&user=admin&pass=pandora&id=9043&id2=example_name&other=bW9kdWxlX2JlZ2luCm1vZHVsZV9uYW1lIGV4YW1wbGVfbmFtZQptb2R1bGVfdHlwZSBnZW5lcmljX2RhdGEKbW9kdWxlX2V4ZWMgZWNobyAxOwptb2R1bGVfZW5k

成功すると '0'、エラー時は '-1'、すでに存在する場合は '-2' を返します。

set delete_module_in_conf

= 5.0 (エンタープライズ版のみ)

ローカルモジュールの設定を削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_module_in_conf&user=admin&pass=pandora&id=9043&id2=example_name

成功すると '0'、エラー時は '-1' を返します。

set update_module_in_conf

= 5.0 (エンタープライズ版のみ)

ローカルモジュールの設定を更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_module_in_conf&apipass=1234&user=admin&pass=pandora&id=9043&id2=example_name&other=bW9kdWxlX2JlZ2luCm1vZHVsZV9uYW1lIGV4YW1wbGVfbmFtZQptb2R1bGVfdHlwZSBnZW5lcmljX2RhdGEKbW9kdWxlX2V4ZWMgZWNobyAxOwptb2R1bGVfZW5k

変更が無い場合は '1'、成功すると '0'、エラー時は '-1'、存在しない場合は '-2' を返します。

set module_custom_id

モジュール ID とカスタム ID の値をパラメータとして渡すことにより、カスタムID の値を設定または削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=module_custom_id&id=5&id2=1521&apipass=1234&user=admin&pass=pandora

set create_event

Pandora 内に新たなイベントを作成します。

この機能は、Metaconsole でも使えます。

書式:

(書式を参照):

作成するイベントの JSON は次の通りとします。

{"Answer to the Ultimate Question of Life, the Universe, and Everything": 42}

上記を base64 でエンコードし、次のように呼び出しに含めます。

../include/api.php?op=set&op2=create_event&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora&other=Event_name|0|1|0|admin|alert_fired|4|1|||||comment|admin||tags|eyJBbnN3ZXIgdG8gdGhlIFVsdGltYXRlIFF1ZXN0aW9uIG9mIExpZmUsIHRoZSBVbml2ZXJzZSwgYW5kIEV2ZXJ5dGhpbmciOiA0Mn0=||12

set add_event_comment

イベントにコメントを追加します。

これはメタコンソールでも利用できます。

書式:

メタコンソールで利用するには、“string” の後に “true” をパラメータで指定してください。

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_event_comment&id=event_id&other=string&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_event_comment&id=event_id&other=string|true&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set update_event

API を通してイベントを更新します。

この機能は、メタコンソールでも利用できます。

書式:

設定可能フィールド

http://192.168.80.190/pandora_console/include/api.php?op=set&op2=event&apipass=pandora&user=admin&pass=pandora&id=175&other_mode=url_encode_separator_|&other=estado,2|evento,Updated event|custom_data,eyJmaWVsZDEiOiJ2YWx1ZTEiLCJmaWVsZDIiOiJ2YWx1ZTIifQo=
http://192.168.80.35/pandora_console/include/api.php?op=set&op2=event&apipass=1234&user=admin&pass=pandora&id=315132&other_mode=url_encode_separator_|&other=estado,0|owner_user,operator|evento,Updated event

set create_netflow_filter

(>= 5.0)

新たな netflow フィルタを作成します。

書式:

http://127.0.0.1/pandora/include/api.php?op=set&op2=create_netflow_filter&apipass=1234&user=admin&pass=pandora&other=Filter%20name|9|host%20192.168.50.3%20OR%20host%20192.168.50.4%20or%20HOST%20192.168.50.6|dstport|kilobytes&other_mode=url_encode_separator_|

set create_custom_field

= 5.0

新たなカスタムフィールドを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_custom_field&other=mycustomfield|0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set create_tag

= 5.0

新たなタグを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_tag&other=tag_name|tag_description|tag_url|tag_email&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set enable_disable_agent

エージェントを有効化/無効化します。

書式:

例1 (エージェント 'example_id' を無効化)

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=enable_disable_agent&id=example_id&other=0&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

例2 (エージェント 'example_id' を有効化)

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=enable_disable_agent&id=example_id&other=1&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set gis_agent_only_position

= 5.0

エージェントに、新たな GIS 位置情報を追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=set&op2=gis_agent_only_position&id=582&other_mode=url_encode_separator_|&other=2%7C1%7C0

set gis_agent

= 5.0

エージェントに gis データを追加します。

書式:

http://127.0.0.1/pandora5/include/api.php?apipass=1234&user=admin&pass=pandora&op=set&op2=gis_agent&id=582&other_mode=url_encode_separator_|&other=2%7C2%7C0%7C0%7C0%7C2000-01-01+01%3A01%3A01%7C0%7C666%7Caaa%7Cbbb%7Cccc

set reset_agent_counts

エージェントのモジュールおよびアラートカウントを更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=reset_agent_counts&apipass=1234&user=admin&pass=pandora&id=All

set create_special_day

= 5.1

新たな特別日を追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=set&op2=create_special_day&other_mode=url_encode_separator_|&other=2014-05-03|Sunday|desc|0

set update_special_day

= 5.1

定義済の特別日の設定を更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=set&op2=update_special_day&id=1&other_mode=url_encode_separator_|&other=2014-05-03|Sunday|desc|0

set delete_special_day

= 5.1

特別日を削除。

書式:

http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=set&op2=delete_special_day&id=1

set pagerduty_webhook

= 5.1

Pandora FMS アラートと PagerDuty 通知を接続します。PagerDuty サービスの webhooks オプションを、PagerDuty からアラートを承諾した場合の動作に対して、あらかじめ PagerDuty にリンクさせた Pandora FMS のアラートの承諾に設定します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=pagerduty_webhook&apipass=1234&user=admin&pass=pandora&id=alert

set tag_user_profile

= 6

ユーザのプロファイルにタグを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=tag_user_profile&apipass=1234&user=admin&pass=pandora&id=1&id2=2&other_mode=url_encode_separator_|&other=122|3

set tag

= 6

pandora にタグを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=tag&apipass=1234&user=admin&pass=pandora&id=test&other_mode=url_encode_separator_|&other="a test"|http://www.artica.es|[email protected]|01189998819991197253

set add_tag_module

= 6

モジュールにタグを追加します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_tag_module&apipass=1234&user=admin&pass=pandora&id=1&id2=2

set remove_tag_module

= 6

モジュールのタグを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=remove_tag_module&apipass=1234&user=admin&pass=pandora&id=1&id2=2

set planned_downtimes_created

= 5.1

計画停止を作成します

書式:

この呼び出しが正しく動作するためには、日付のフォーマットは MM/DD/YYYY である必要があります。

一回:

http://localhost/pandora_console/include/api.php?op=set&op2=planned_downtimes_created&apipass=1234&user=admin&pass=pandora&id=testing&other=testing|11/05/2018|11/16/2018|0|1|1|1|1|1|1|1|12:06:00|19:06:00|1|31|quiet|once|weekly|admin&other_mode=url_encode_separator_|

繰り返し:

http://localhost/pandora_console/include/api.php?op=set&op2=planned_downtimes_created&apipass=1234&user=admin&pass=pandora&id=testing&other=testing|11/05/2018|11/16/2018|0|1|1|1|1|1|1|1|12:06:00|19:06:00|1|31|quiet|periodically|weekly|admin&other_mode=url_encode_separator_|

set planned_downtimes_additem

= 5.1

計画停止に対象エージェント(および対象モジュール)を追加します

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=planned_downtimes_additem&apipass=1234&user=admin&pass=pandora&id=123&other=1;2;3;4%7CStatus;Unkown_modules%20&other_mode=url_encode_separator_|

set planned_downtimes_deleted

= 5.1

計画停止を削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=planned_downtimes_deleted&apipass=1234&user=admin&pass=pandora&id=10

set create_synthetic_module

= 5.1SP4

新たな統合モジュールを作成します。

書式:

演算設定の場合で、エージェントとモジュール名を指定して演算タイプを指定しない場合: <エージェント名;モジュール名>、値を指定する場合: <演算タイプ;値>. それ以外: <エージェント名;演算タイプ;モジュール名> または <演算タイプ;値>
 平均: <エージェント名;演算タイプ;モジュール名> または <演算タイプ;値>
  演算: ADD, SUB, MUL, DIV
  平均: AVG のみ

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_synthetic_module&apipass=1234&user=admin&pass=pandora&id=test&other=Test|arithmetic|Agent%20Name;Module%20Name|Agent%20Name2;ADD;Module%20Name2&other_mode=url_encode_separator_|
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_synthetic_module&apipass=1234&user=admin&pass=pandora&id=pepito&other=prueba|average|Agent%20Name;AVG;Name%20Module|Agent%20Name2;AVG;Name%20Module2&other_mode=url_encode_separator_|

set create_service

= 7

新たなサービスを作成します。

書式:

<警告モジュールアラートテンプレートID>;<障害モジュールアラートテンプレートID>;<障害モジュールSLAアラートテンプレートID>;

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_service&return_type=json&other=test1%7CDescripcion%7C12%7C1%7C0.5%7C1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set update_service

= 7

サービスを更新します。

書式:

<警告モジュールアラートテンプレートID>;<障害モジュールアラートテンプレートID>;<障害モジュールSLAアラートテンプレートID>;

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_service&return_type=json&id=1&other=test2%7CDescripcion2%7C%7C%7C0.6%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set add_element_service

= 7

サービスに要素を追加します。

書式:

json の構造は次の通りです。

[
  {
    "type": "agent",
    "id": 2,
    "description": "Test1",
    "weight_critical": 0,
    "weight_warning": 0,
    "weight_unknown": 0,
    "weight_ok": 0
  },
  {
    "type": "module",
    "id": 1,
    "description": "Test2",
    "weight_critical": 0,
    "weight_warning": 0,
    "weight_unknown": 0,
    "weight_ok": 0
  },
  {
    "type": "service",
    "id": 3,
    "description": "Test3",
    "weight_critical": 0,
    "weight_warning": 0,
    "weight_unknown": 0,
    "weight_ok": 0
  }
]

それぞれのタイプで、ID フィールドは異なるものを参照します。

- タイプが agent の場合は、エージェント ID です。

- タイプが module の場合は、エージェントモジュール ID です。

- タイプが service の場合は、追加したいサービス ID です。

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_element_service&return_type=json&id=6&other=W3sidHlwZSI6ImFnZW50IiwiaWQiOjIsImRlc2NyaXB0aW9uIjoiamlqaWppIiwid2VpZ2h0X2NyaXRpY2FsIjowLCJ3ZWlnaHRfd2FybmluZyI6MCwid2VpZ2h0X3Vua25vd24iOjAsIndlaWdodF9vayI6MH0seyJ0eXBlIjoibW9kdWxlIiwiaWQiOjEsImRlc2NyaXB0aW9uIjoiSG9sYSBxdWUgdGFsIiwid2VpZ2h0X2NyaXRpY2FsIjowLCJ3ZWlnaHRfd2FybmluZyI6MCwid2VpZ2h0X3Vua25vd24iOjAsIndlaWdodF9vayI6MH0seyJ0eXBlIjoic2VydmljZSIsImlkIjozLCJkZXNjcmlwdGlvbiI6ImplamVqZWplIiwid2VpZ2h0X2NyaXRpY2FsIjowLCJ3ZWlnaHRfd2FybmluZyI6MCwid2VpZ2h0X3Vua25vd24iOjAsIndlaWdodF9vayI6MH1d&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set metaconsole_synch

= 7

ライセンスキーをメタコンソールへ追加し、ノードへ同期します。

http://127.0.0.1/pandora_console/enterprise/meta/include/api.php?op=set&op2=metaconsole_synch&id=LICENSEKEY&apipass=1234&user=admin&pass=pandora

set migrate_agent

= 7.21 メタコンソールのみ

選択したエージェントをエージェントマイグレーションキューへ追加します。

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=migrate_agent&apipass=1234&user=admin&pass=pandora&id=2&other=nova|fringe|0&other_mode=url_encode_separator_|&return_type=string

set new_cluster

= 7.0

エージェントのクラスタを作成します。

異なるノードを監視するためのエージェントとアイテムを持つ監視クラスタを作成します。

書式:

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=new_cluster&other=nombre_cluster%7CAA%7Cdescripcion%7C12&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set add_cluster_agent

= 7.0

エージェントをクラスタに追加します。

書式:

json の構造は次の通りです。

[
  {
    "id": 5,
    "id_agent": 2
  },
  {
    "id": 5,
    "id_agent": 3
  }
]

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_cluster_agent&other=WwogIHsKICAgICJpZCI6IDUsCiAgICAiaWRfYWdlbnQiOiAyCiAgfSwKICB7CiAgICAiaWQiOiA1LAogICAgImlkX2FnZW50IjogMwogIH0KXQ==&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set add_cluster_item (アクティブ/アクティブ)

= 7.0

クラスタに、アクティブ/アクティブ アイテムを追加します。

書式:

json の構造は次の通りです。

[
  {
    "name": "Swap_Used",
    "id_cluster": 5,
    "type": "AA",
    "critical_limit": 80,
    "warning_limit": 60
  },
  {
    "name": "TCP_Connections",
    "id_cluster": 5,
    "type": "AA",
    "critical_limit": 80,
    "warning_limit": 60
  }
]

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_cluster_item&other=WwogIHsKICAgICJuYW1lIjogIlN3YXBfVXNlZCIsCiAgICAiaWRfY2x1c3RlciI6IDUsCiAgICAidHlwZSI6ICJBQSIsCiAgICAiY3JpdGljYWxfbGltaXQiOiA4MCwKICAgICJ3YXJuaW5nX2xpbWl0IjogNjAKICB9LAogIHsKICAgICJuYW1lIjogIlRDUF9Db25uZWN0aW9ucyIsCiAgICAiaWRfY2x1c3RlciI6IDUsCiAgICAidHlwZSI6ICJBQSIsCiAgICAiY3JpdGljYWxfbGltaXQiOiA4MCwKICAgICJ3YXJuaW5nX2xpbWl0IjogNjAKICB9Cl0=&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set add_cluster_item (アクティブ/スタンバイ)

= 7.0

クラスタに、アクティブ/スタンバイのアイテムを追加します。

書式:

json の構造は次の通りです。

[
  {
    "name": "DiskUsed_/proc/kcore",
    "id_cluster": 5,
    "type": "AP",
    "is_critical": 1
  },
  {
    "name": "DiskUsed_/proc/sched_debug",
    "id_cluster": 5,
    "type": "AP",
    "is_critical": 1
  }
]

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=add_cluster_item&other=WwogIHsKICAgICJuYW1lIjogIkRpc2tVc2VkXy9wcm9jL2tjb3JlIiwKICAgICJpZF9jbHVzdGVyIjogNSwKICAgICJ0eXBlIjogIkFQIiwKICAgICJpc19jcml0aWNhbCI6IDEKICB9LAogIHsKICAgICJuYW1lIjogIkRpc2tVc2VkXy9wcm9jL3NjaGVkX2RlYnVnIiwKICAgICJpZF9jbHVzdGVyIjogNSwKICAgICJ0eXBlIjogIkFQIiwKICAgICJpc19jcml0aWNhbCI6IDEKICB9Cl0=&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set delete_cluster

= 7.0

クラスタを削除します。

書式:

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_cluster&id=7&apipass=1234&user=admin&pass=pandora

set delete_cluster_agents

= 7.0

クラスタからエージェントを削除します。

書式:

json の構造は次のようになっている必要があります。

[
  {
    "id": 5,
    "id_agent": 2
  },
  {
    "id": 5,
    "id_agent": 3
  }
]

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_cluster_agents&other=WwogIHsKICAgICJpZCI6IDUsCiAgICAiaWRfYWdlbnQiOiAyCiAgfSwKICB7CiAgICAiaWQiOiA1LAogICAgImlkX2FnZW50IjogMwogIH0KXQ==&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set delete_cluster_item

= 7.0

クラスタからアイテムを削除します。

書式:

 http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_cluster_item&id=9&apipass=1234&user=admin&pass=pandora

set create_policy

= 7.0. 725

ポリシーを作成します。 ポリシー名を指定する必要があります。複数設定はできません。また、グループ ID がデータベースに存在する必要があります。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=create_policy&apipass=1234&user=admin&pass=pandora&other=name%20Policy|11|this%20description&other_mode=url_encode_separator_|&return_type=json

set update_policy

= 7.0. 725

ポリシーを更新します。 ポリシー名は複数指定できません。また、グループ ID がデータベースに存在する必要があります。0(失敗した場合)または、更新したポリシーID(成功した場合)を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=update_policy&apipass=1234&user=admin&pass=pandora&id=17&other=policy2|11|this%20description&other_mode=url_encode_separator_|&return_type=json

set delete_policy

= 7.0. 725

ポリシーを削除します。存在するポリシー ID を指定する必要があります。0(失敗した場合) または、1(成功した場合) を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_policy&apipass=1234&user=admin&pass=pandora&id=10&return_type=json

set add_collections_policy

= 7.0. 725

ポリシーにコレクションを追加します。存在するポリシー ID と、コレクションの名前または短い名前を指定する必要があります。いずれも必須です。 0(失敗した場合) または、ポリシーへ追加したコレクション ID (成功した場合) を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=add_collections_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=4&id2=apache_plugin

set remove_collections_policy

= 7.0. 725

ポリシーのコレクションに削除予約を設定します。

0(失敗) または 1(成功) を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=remove_collections_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=4&id2=2&other=1.

set create_plugins_policy

= 7.0. 725

ポリシーにプラグインを追加します。

0(失敗) または、ポリシーへ追加したプラグイン ID (成功)を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=create_plugins_policy&apipass=1234&user=admin&pass=pandora&return_type=json&id=2&id2=echo%201

set delete_plugins_policy

= 7.0. 725

ポリシーからプラグインを削除します。

0(失敗) または 1(成功) を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_plugins_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=2&id2=1&other=1

set linking_policy

= 7.0. 725

ポリシーに未リンクのモジュールをリンクします。

0(失敗) または 1(成功) を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=linking_policy&apipass=1234&user=admin&pass=pandora&return_type=json&id=28

set create_alerts_policy

= 7.0. 725

ポリシーアラートを作成します。

0(失敗) または、ポリシーに追加したアラートID(成功) を返します。

書式:

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_|

set update_alerts_policy

= 7.0. 725

ポリシーアラートを更新します。

0(失敗) もしくは、ポリシーで更新したアラートID(成功)を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=update_alerts_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=7&other=1|1&other_mode=url_encode_separator_|

set delete_alerts_policy

= 7.0. 725

ポリシーからアラートを削除します。

0(失敗) または 1(成功) を返します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_alerts_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=7&id2=1

set create_alerts_actions_policy

= 7.0. 725

ポリシーアラートにアクションを追加します。

0(失敗) または、ポリシーアラートに追加したアクションID(成功) を返します。

書式:

http://172.16.0.2/pandora_console/include/api.php?op=set&op2=create_alerts_actions_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=1&id2=4&other=5|2&other_mode=url_encode_separator_|

set delete_alerts_actions_policy

= 7.0. 725

ポリシーアラートからアクションを削除します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_alerts_actions_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=1&id2=4

set remove_agents_policy

= 7.0. 725

ポリシーからエージェントを削除します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=remove_agents_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=5&id2=2

set add_groups_policy

= 7.0. 725

ポリシーのグループを追加します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=add_groups_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=7&id2=12

set remove_groups_policy

= 7.0. 725

ポリシーからグループを削除します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=remove_groups_policy&apipass=1234&user=admin&pass=pandora&return_type=string&id=5&id2=2

set create_os

= 7.0. 727

パラメータで渡したデータで OS を作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_os&other=os_name%7Cos_description%7Cos_icon.png&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set update_os

= 7.0. 727

パラメータで渡したデータで OS を更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?id=107&op=set&op2=update_os&other=os_name_to_update%7Cos_description_to_update%7Cos_icon_to_update.png&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set disabled_and_standby

= 7.0. 728

エージェントを無効化し、またリモート設定がある場合はスタンバイモードにします。

書式:

http://127.0.0.1/pandora_console/include/api.php?id=2&op=set&op2=disabled_and_standby&other=1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora
http://127.0.0.1/pandora_console/include/api.php?id=2&id2=1&op=set&op2=disabled_and_standby&other=1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set validate_traps

= 7.0. 728

トラップの承諾をします。

https://127.0.0.1/pandora_console/include/api.php?op=set&op2=validate_traps&id=1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set delete_traps

= 7.0. 728

トラップを削除します。

http://127.0.0.1/pandora_console/include/api.php?id=2&op=set&op2=delete_traps&id=1&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set access_process

= 7.0NG. 728

この機能により、Pandora FMS のシステム監査ログにおける、3つ目のレコードのアプリケーションへのアクセスを管理できます。 アプリケーションに登録されたアクションの一つの処理を実行するために異なるパラメータを用い、管理者ユーザによる同時アクセスを回避します。オプションで、管理者以外のユーザーへのアクセスを禁止することもできます。

書式:

アプリケーションにアクセスしようとしているユーザーの ID です。このデータは監査で記録およびチェックされ、アプリケーションを介したユーザのアクセス、終了、閲覧、またはナビゲーションをフィルタリングします。

login: アプリケーションへのアクセスを要求するために使用されます。 テキスト文字列 “free” を削除して Pandora FMS 監査ログにアクセスを登録するか、または以前にシステムにアクセスしたがまだログアウトしていない別のユーザーが監査レコードに含まれている場合は、テキスト文字列 “denied” を返します。 管理者のみのアクセスパラメータが有効になっていて、ユーザが無効になっている場合も、denied を返します。

logout: 他のユーザが再びアクセスを許可されるように、アプリケーションからのユーザのログアウトしたことをログに記録します。

browse: このユーザがまだアクセスしているのか、アプリケーションからログアウトさせられたのかをチェックするため、外部アプリケーションのすべてのページで使用する必要があります。

exclude: 現在登録されているユーザをログアウトさせ、別のユーザーのアクセスを user_id パラメータに登録します。

アクセス元のアプリケーションの IP アドレス。 これは Pandora FMS 監査で登録およびチェックされ、アプリケーション内のユーザのアクセス状況をチェックします。

アクセスするアプリケーションの名前。これは Pandora FMS 監査で登録およびチェックされ、アプリケーション内のユーザのアクセス状況をチェックします。

非管理者ユーザのアクセスを禁止します。

例 (適応環境が必要)

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=access_process&other=1%7Clogin%7C192.168.50.25%7Cexternal_app%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set create_event_response

新たなイベント応答を作成します。

書式:

例 ( 書式を参照):

/include/api.php?op=set&op2=create_event_response&other=response|description%20response|touch|command|0|650|400|0|response|0|90&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set update_event_response

既存のイベント応答を編集します。イベント応答の編集にはそれが所属するグループにユーザがアクセスできる権限を持っている必要があります。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=update_event_response&id=5&other=response|description%20response|touch|command|0|650|400|0|response|0|90&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set delete_event_response

イベント応答を削除します。イベント応答の削除にはそれが所属するグループにユーザがアクセスできる権限を持っている必要があります。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_event_response&id=7&apipass=1234&user=admin&pass=pandora

set create_user_profile_info

新たなユーザプロファイルを作成します。

書式:

IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM.

どの権限を有効化すべきかは、こちらを参照してください。

この例では、Pandora にリードオンリーのプロファイルを作成します。初期設定済の Operator (read) のプロファイルと同じです。

http://localhost/pandora_console/include/api.php?op=set&op2=create_user_profile_info&return_type=json&other=API_profile%7C1%7C0%7C0%7C1%7C0%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C1%7C0%7C0%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set update_user_profile_info

既存のユーザプロファイルを更新します。

書式:

IR|IW|IM|AR|AW|AD|LW|LM|UM|DM|ER|EW|EM|RR|RW|RM|MR|MW|MM|VR|VW|VM|PM.

どの権限を有効化すべきかは、こちらを参照してください。

以下の例では、API_profile_updated という名前の ID 6 のプロファイルに対して、エージェントに関してすべての権限(参照、書き込み、管理)を与えています。また、イベントの参照権限を削除しています。

http://localhost/pandora_console/include/api.php?op=set&op2=update_user_profile_info&return_type=json&id=6&other=API_profile_updated%7C%7C%7C%7C1%7C1%7C1%7C%7C%7C%7C%7C0%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set delete_user_profile_info

ユーザプロファイルを削除します。また該当のプロファイルのユーザへの割り当ても削除します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_user_profile_info&return_type=json&id=8&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set create_event_filter

イベントフィルタを作成します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=create_event_filter&id=test&other=%7C%7Cerror%7C4%7C%7C%7C1%7C%7C12%7C%7C%7C2018-12-09%7C2018-12-13%7C[%226%22]%7C[%2210%22,%226%22,%223%22]%7C1%7C10%7C%7C%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set update_event_filter

イベントフィルタを更新します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=update_event_filter&id=195&other=new_name%7C%7C%7Calert_recovered%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set delete_event_filter

イベントフィルタを削除します。

書式:

http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_event_filter&id=38&apipass=1234&user=admin&pass=pandora

set create_inventory_module

新たなインベントリモジュールを作成します。

書式:

この例では、Linux システムから kernel-name および nodename というデータを収集する OS というインベントリモジュールを作成します。

http://localhost/pandora_console/include/api.php?op=set&op2=create_inventory_module&return_type=json&other=OS%7COS_name_description%7C1%7C/bin/bash%7CIyEvYmluL2Jhc2gKZWNobyB1bmFtZSAtbiAtcw==%7Ckernelname;nodename%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set update_inventory_module

インベントリモジュールを更新します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=update_inventory_module&return_type=json&id=42&other=OS_easy%7COS_name_description%7C1%7C/bin/bash%7CIyEvYmluL2Jhc2gKZWNobyB1bmFtZSAtbiAtcw==%7Ckernelname;nodename%7C0&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set delete_inventory_module

インベントリモジュールを削除します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_inventory_module&return_type=json&id=42&other_mode=url_encode_separator_%7C&apipass=1234&user=admin&pass=pandora

set create_collection

コレクションを作成します。

書式:

連続パラメータのセパレータを渡すために、次のように 'other_mode' が必要です: other_mode=url_encode_separator_<separator>

http://localhost/pandora_console/include/api.php?op=set&op2=create_collection&other=test_plugin|test_p|0|test&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set delete_collection

コレクションを削除します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=delete_collection&id=15&apipass=1234&user=admin&pass=pandora

set enable_disable_discovery_task

自動検出タスク一覧 にあるタスクを有効化または無効化します。

書式:

http://localhost/pandora_console/include/api.php?op=set&op2=enable_disable_discovery_task&id=1&other=1&other_mode=url_encode_separator_|&apipass=1234&user=admin&pass=pandora

set create_module_policy_json

JSON 形式で作成された定義を使用して、モジュールをターゲットポリシーに追加します。

書式:

{
name: <value>, // mandatory
id_module: <value>, // mandatory
id_tipo_modulo: <value>, // mandatory
configuration_data: <value>,
description: <value>,
unit: <value>,
max: <value>,
min: <value>,
module_interval: <value>,
ip_target: <value>,
tcp_port: <value>,
tcp_send: <value>,
tcp_rcv: <value>,
snmp_community: <value>,
snmp_oid: <value>,
id_module_group: <value>,
flag: <value>,
disabled: <value>,
id_export: <value>,
plugin_user: <value>,
plugin_pass: <value>,
plugin_parameter: <value>,
id_plugin: <value>,
post_process: <value>,
prediction_module: <value>,
max_timeout: <value>,
max_retries: <value>,
custom_id: <value>,
history_data: <value>,
min_warning: <value>,
max_warning: <value>,
str_warning: <value>,
min_critical: <value>,
max_critical: <value>,
str_critical: <value>,
min_ff_event: <value>,
custom_string_1: <value>,
custom_string_2: <value>,
custom_string_3: <value>,
custom_integer_1: <value>,
custom_integer_2: <value>,
pending_delete: <value>,
critical_instructions: <value>,
warning_instructions: <value>,
unknown_instructions: <value>,
critical_inverse: <value>,
warning_inverse: <value>,
id_category: <value>,
module_ff_interval: <value>,
quiet: <value>,
cron_interval: <value>,
macros: <value>,
disabled_types_event: {
"going_unknwon": 1, // Disable going unknown events.
},
module_macros: <value>,
min_ff_event_normal: <value>,
min_ff_event_warning: <value>,
min_ff_event_critical: <value>,
ff_type: <value>,
each_ff: <value>,
ff_timeout: <value>,
dynamic_interval: <value>,
dynamic_max: <value>,
dynamic_min: <value>,
dynamic_next: <value>,
dynamic_two_tailed: <value>,
prediction_sample_window: <value>,
prediction_samples: <value>,
prediction_threshold: <value>,
cps: <value>,
}

base64 へ変換する前の JSON フォーマット:

{
  "id_tipo_modulo": 1,
  "id_modulo": 10,
  "name": "sample module",
  "description": "Module created by API",
  "configuration_data": "module_begin\nmodule_name sample module\nmodule_type generic_data\nmodule_exec echo 1\nmodule_end",
  "min_warning": 2,
  "max_warning": 5,
  "min_critical": 5,
  "max_critical": 7
}

base64 へのエンコード後:

http://localhost/pandora_console/include/api.php?op=set&op2=create_module_policy_json&id=1&other=ewogICJpZF90aXBvX21vZHVsbyI6IDEsCiAgImlkX21vZHVsbyI6IDEwLAogICJuYW1lIjogInNhbXBsZSBtb2R1bGUiLAogICJkZXNjcmlwdGlvbiI6ICJNb2R1bGUgY3JlYXRlZCBieSBBUEkiLAogICJjb25maWd1cmF0aW9uX2RhdGEiOiAibW9kdWxlX2JlZ2luXG5tb2R1bGVfbmFtZSBzYW1wbGUgbW9kdWxlXG5tb2R1bGVfdHlwZSBnZW5lcmljX2RhdGFcbm1vZHVsZV9leGVjIGVjaG8gMVxubW9kdWxlX2VuZCIsCiAgIm1pbl93YXJuaW5nIjogMiwKICAibWF4X3dhcm5pbmciOiA1LAogICJtaW5fY3JpdGljYWwiOiA1LAogICJtYXhfY3JpdGljYWwiOiA3Cn0=&apipass=pandora&user=admin&pass=pandora

set update_module_policy_json

JSON 形式で作成された定義を使用して、ターゲットポリシーの既存の モジュールを更新します。

書式:

{
name: <value>, // mandatory
id_module: <value>, // mandatory
id_tipo_modulo: <value>, // mandatory
configuration_data: <value>,
description: <value>,
unit: <value>,
max: <value>,
min: <value>,
module_interval: <value>,
ip_target: <value>,
tcp_port: <value>,
tcp_send: <value>,
tcp_rcv: <value>,
snmp_community: <value>,
snmp_oid: <value>,
id_module_group: <value>,
flag: <value>,
disabled: <value>,
id_export: <value>,
plugin_user: <value>,
plugin_pass: <value>,
plugin_parameter: <value>,
id_plugin: <value>,
post_process: <value>,
prediction_module: <value>,
max_timeout: <value>,
max_retries: <value>,
custom_id: <value>,
history_data: <value>,
min_warning: <value>,
max_warning: <value>,
str_warning: <value>,
min_critical: <value>,
max_critical: <value>,
str_critical: <value>,
min_ff_event: <value>,
custom_string_1: <value>,
custom_string_2: <value>,
custom_string_3: <value>,
custom_integer_1: <value>,
custom_integer_2: <value>,
pending_delete: <value>,
critical_instructions: <value>,
warning_instructions: <value>,
unknown_instructions: <value>,
critical_inverse: <value>,
warning_inverse: <value>,
id_category: <value>,
module_ff_interval: <value>,
quiet: <value>,
cron_interval: <value>,
macros: <value>,
disabled_types_event: {
"going_unknwon": 1, // Disable going unknown events.
},
module_macros: <value>,
min_ff_event_normal: <value>,
min_ff_event_warning: <value>,
min_ff_event_critical: <value>,
ff_type: <value>,
each_ff: <value>,
ff_timeout: <value>,
dynamic_interval: <value>,
dynamic_max: <value>,
dynamic_min: <value>,
dynamic_next: <value>,
dynamic_two_tailed: <value>,
prediction_sample_window: <value>,
prediction_samples: <value>,
prediction_threshold: <value>,
cps: <value>,
}

base64 へ変換する前の JSON フォーマット:

{
  "id_tipo_modulo": 1,
  "id_modulo": 1,
  "name": "name edited",
  "description": "Module created by API",
  "configuration_data": "module_begin\nmodule_name sample module\nmodule_type generic_data\nmodule_exec echo 1\nmodule_end",
  "min_warning": 3,
  "max_warning": 6,
  "min_critical": 6,
  "max_critical": 8
}

base64 へのエンコード後:

http://localhost/pandora_console/include/api.php?op=set&op2=update_module_policy_json&id=1&id2=43&other=ewogICJpZF90aXBvX21vZHVsbyI6IDEsCiAgImlkX21vZHVsbyI6IDEsCiAgIm5hbWUiOiAibmFtZSBlZGl0ZWQiLAogICJkZXNjcmlwdGlvbiI6ICJNb2R1bGUgY3JlYXRlZCBieSBBUEkiLAogICJjb25maWd1cmF0aW9uX2RhdGEiOiAibW9kdWxlX2JlZ2luXG5tb2R1bGVfbmFtZSBzYW1wbGUgbW9kdWxlXG5tb2R1bGVfdHlwZSBnZW5lcmljX2RhdGFcbm1vZHVsZV9leGVjIGVjaG8gMVxubW9kdWxlX2VuZCIsCiAgIm1pbl93YXJuaW5nIjogMywKICAibWF4X3dhcm5pbmciOiA2LAogICJtaW5fY3JpdGljYWwiOiA2LAogICJtYXhfY3JpdGljYWwiOiA4Cn0=&apipass=pandora&user=admin&pass=pandora

set event_custom_id

イベントにカスタム ID を設定します。

書式:

例 (書式 を参照):

/include/api.php?op=set&op2=event_custom_id&id=110&id2=9999&apipass=1234&user=admin&pass=pandora

Pandora API を呼び出すためのいくつかの言語での例です。

PHP

<?php
$ip = '192.168.70.110';
$pandora_url = '/pandora5';
$apipass = '1234';
$user = 'admin';
$password = 'pandora';
$op = 'get';
$op2 = 'all_agents';
$return_type = 'csv';
$other = '';
$other_mode = '';

$url = "http://" . $ip . $pandora_url . "/include/api.php";

$url .= "?";
$url .= "apipass=" . $apipass;
$url .= "&user=" . $user;
$url .= "&pass=" . $password;
$url .= "&op=" . $op;
$url .= "&op2=" . $op2;
if ($id !== '') {
    $url .= "&id=" . $id;
}
if ($id2 !== '') {
    $url .= "&id2=" . $id2;
}
if ($return_type !== '') {
    $url .= "&return_type=" . $return_type;
}
if ($other !== '') {
    $url .= "&other_mode=" . $other_mode;
    $url .= "&other=" . $other;
}

$curlObj = curl_init();
curl_setopt($curlObj, CURLOPT_URL, $url);
curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curlObj);
curl_close($curlObj);

$agents = array();
if (!empty($result)) {
    $lines = explode("\n", $result);
    foreach ($lines as $line) {
        $fields = explode(";", $line);

        $agent = array();
        $agent['id_agent'] = $fields[0];
        $agent['name'] = $fields[1];
        $agent['ip'] = $fields[2];
        $agent['description'] = $fields[3];
        $agent['os_name'] = $fields[4];
        $agent['url_address'] = $fields[5];

        $agents[] = $agent;
    }
}

print_list_agents($agents);

function print_list_agents($agents) {
    echo "<table border='1' style='empty-cells: show;'>";

    echo "<thead>";
    echo "<tr>";
    echo "<th>" . "ID" . "</th>";
    echo "<th>" . "Name" . "</th>";
    echo "<th>" . "IP" . "</th>";
    echo "<th>" . "Description" . "</th>";
    echo "<th>" . "OS" . "</th>";
    echo "<th>" . "URL" . "</th>";
    echo "</tr>";
    echo "</thead>";

    foreach ($agents as $agent) {
        echo "<tr>";
        echo "<td>" . $agent['id_agent'] . "</td>";
        echo "<td>" . $agent['name'] . "</td>";
        echo "<td>" . $agent['ip'] . "</td>";
        echo "<td>" . $agent['description'] . "</td>";
        echo "<td>" . $agent['os_name'] . "</td>";
        echo "<td>" . $agent['url_address'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
}
?>

Python

import pycurl
import cStringIO
import pprint

def main():
    ip = '192.168.70.110'
    pandora_url = '/pandora5'
    apipass = '1234'
    user = 'admin'
    password = 'pandora'
    op = 'get'
    op2 = 'all_agents'
    return_type = 'csv'
    other = ''
    other_mode = ''

    url = "http://" + ip  + pandora_url + "/include/api.php"

    url += "?"
    url += "apipass=" + apipass
    url += "&user="  + user
    url += "&pass=" + password
    url += "&op=" + op
    url += "&op2=" + op2

    buf = cStringIO.StringIO()

    c = pycurl.Curl()
    c.setopt(c.URL, url)
    c.setopt(c.WRITEFUNCTION, buf.write)
    c.perform()

    output = buf.getvalue()
    buf.close()

    lines = output.split("\n")
    agents = []
    for line in lines:
        if not line:
            continue

        fields = line.split(";")
        agent = {}
        agent['id_agent'] = fields[0]
        agent['name'] = fields[1]
        agent['ip'] = fields[2]
        agent['description'] = fields[3]
        agent['os_name'] = fields[4]
        agent['url_address'] = fields[5]

        agents.append(agent)

    for agent in agents:
        print("---- Agent #" + agent['id_agent'] + " ----")
        print("Name: " + agent['name'])
        print("IP: " + agent['ip'])
        print("Description: " + agent['description'])
        print("OS: " + agent['os_name'])
        print("URL: " + agent['url_address'])
        print("")

if __name__ == "__main__":
    main()

Perl

use strict;
use warnings;
use WWW::Curl::Easy;

sub write_callback {
    my ($chunk,$variable) = @_;

    push @{$variable}, $chunk;
    return length($chunk);
}

my $ip = '192.168.70.110';
my $pandora_url = '/pandora5';
my $apipass = '1234';
my $user = 'admin';
my $password = 'pandora';
my $op = 'get';
my $op2 = 'all_agents';
my $return_type = 'csv';
my $other = '';
my $other_mode = '';

my $url = "http://" . $ip  . $pandora_url . "/include/api.php";
$url .= "?";
$url .= "apipass=" . $apipass;
$url .= "&user=" . $user;
$url .= "&pass=" . $password;
$url .= "&op=" . $op;
$url .= "&op2=" . $op2;

my @body;

my $curl = WWW::Curl::Easy->new;
$curl->setopt(CURLOPT_URL, $url);
$curl->setopt(CURLOPT_WRITEFUNCTION, \&write_callback);
$curl->setopt(CURLOPT_FILE, \@body);
$curl->perform();

my $body=join("",@body);
my @lines = split("\n", $body);

foreach my $line (@lines) {
    my @fields = split(';', $line);

    print("\n---- Agent #" . $fields[0] . " ----");
    print("\nName: " .  $fields[1]);
    print("\nIP: " .  $fields[2]);
    print("\nDescription: " . $fields[3]);
    print("\nOS: "  . $fields[4]);
    print("\n");
}

Ruby

require 'open-uri'

ip = '192.168.70.110'
pandora_url = '/pandora5'
apipass = '1234'
user = 'admin'
password = 'pandora'
op = 'get'
op2 = 'all_agents'
return_type = 'csv'
other = ''
other_mode = ''

url = "http://" + ip  + pandora_url + "/include/api.php"

url += "?"
url += "apipass=" + apipass
url += "&user="  + user
url += "&pass=" + password
url += "&op=" + op
url += "&op2=" + op2

agents = []

open(url) do |content|

    content.each do |line|
        agent = {}

        tokens = line.split(";")

        agent[:id_agent] = tokens[0]
        agent[:name] = tokens[1]
        agent[:ip] = tokens[2]
        agent[:description] = tokens[3]
        agent[:os_name] = tokens[4]
        agent[:url_address] = tokens[5]

        agents.push agent
    end
end

agents.each do |agent|
    print("---- Agent #" + (agent[:id_agent] || "") + " ----\n")
    print("Name: " + (agent[:name] || "") + "\n")
    print("IP: " + (agent[:ip] || "") + "\n")
    print("Description: " + (agent[:description] || "") + "\n")
    print("OS: " + (agent[:os_name] || "") + "\n")
    print("URL: " + (agent[:url_address] || "") + "\n")
    print("\n")
end

Lua

require("curl")

local content = ""

function WriteMemoryCallback(s)
    content = content .. s

    return string.len(s)
end

ip = '192.168.70.110'
pandora_url = '/pandora5'
apipass = '1234'
user = 'admin'
password = 'pandora'
op = 'get'
op2 = 'all_agents'
return_type = 'csv'
other = ''
other_mode = ''

url = "http://" .. ip  .. pandora_url .. "/include/api.php"

url = url .. "?"
url = url .. "apipass=" .. apipass
url = url .. "&user=" .. user
url = url .. "&pass=" .. password
url = url .. "&op=" .. op
url = url .. "&op2=" .. op2

if curl.new then c = curl.new() else c = curl.easy_init() end

c:setopt(curl.OPT_URL, url)
c:setopt(curl.OPT_WRITEFUNCTION, WriteMemoryCallback)

c:perform()

for line in string.gmatch(content, "[^\n]+") do
    line = string.gsub(line, "\n", "")

    count = 0
    for field in string.gmatch(line, "[^\;]+") do
        if count == 0 then
            print("---- Agent #" .. field .. " ----")
        end
        if count == 1 then
            print("Name: " .. field)
        end
        if count == 2 then
            print("IP: " .. field)
        end
        if count == 3 then
            print("Description: " .. field)
        end
        if count == 4 then
            print("OS: " .. field)
        end
        if count == 5 then
            print("URL: " .. field)
        end

        count = count + 1
    end
    print("")
end

Brainfuck

[-]>[-]<>+++++++++[<+++++++++>-]<-.
>+++++[<+++++>-]<----.
>++++[<++++>-]<---.
>++++[<---->-]<++.
>+++[<+++>-]<++.

-.>++++++++[<-------->-]<--.
>+++[<--->-]<---.
>++++++++[<++++++++>-]<++++.

+.>++++++++[<-------->-]<-----.
>+++++++++[<+++++++++>-]<----.

++.
--.>+++[<--->-]<+.
>+++[<+++>-]<.
>++[<++>-]<++.
>++[<-->-]<-.
>+++++++++[<--------->-]<++.
>+++++++++[<+++++++++>-]<---.

+.>+++++++++[<--------->-]<++.
>+++++++++[<+++++++++>-]<+++.
>++++[<---->-]<+.
>+++[<+++>-]<.
>+++[<--->-]<++.
>+++[<+++>-]<-.
>+++++++++[<--------->-]<++.
>+++++++++[<+++++++++>-]<+++.
>+++[<--->-]<--.

----.>+++[<+++>-]<-.

+++.
-.>+++++++++[<--------->-]<++.
>+++++++++[<+++++++++>-]<-.
>++++[<---->-]<+.
>++++[<++++>-]<+.
>++++[<---->-]<-.
>++++++++[<-------->-]<-.
>++++++++[<++++++++>-]<++++++++.
>+++[<--->-]<++.

++.
++.>++++[<++++>-]<---.
>++[<-->-]<--.

+++.>++++++++[<-------->-]<---.
>+++[<--->-]<---.
>+++++++++[<+++++++++>-]<-.
>+++[<--->-]<--.
>++++[<++++>-]<---.

---.>+++++++++[<--------->-]<++.
>+++++++++[<+++++++++>-]<+++++.
>+++++[<----->-]<++++.
>+++[<+++>-]<++.
>+++[<--->-]<++.
>++++++++[<-------->-]<-----.
>+++++++++[<+++++++++>-]<----.
>+++[<+++>-]<-.
>++++[<---->-]<--.
>++[<++>-]<+.
>+++[<+++>-]<--.

++++.>+++++++++[<--------->-]<--.
>++++++++[<++++++++>-]<++++++.
>+++[<+++>-]<+++.
>+++[<--->-]<.

++.
--.>+++[<+++>-]<--.
>++[<++>-]<+.
>+++[<--->-]<++.
>++[<++>-]<++.
>++[<-->-]<-.

++++.>++++++++[<-------->-]<-----.

Java (Android)

SourceForge の SVN リポジトリ内の Pandroid イベントビューワーソースコード より、我々のプロジェクト(Pandora Event Viwer)を参照すると、API を通してイベントデータを取得する部分のコードがあります。

/**
     * Performs an http get petition.
     *
     * @param context
     *            Application context.
     * @param additionalParameters
     *            Petition additional parameters
     * @return Petition result.
     * @throws IOException
     *             If there is any problem with the connection.
     */
    public static String httpGet(Context context,
            List<NameValuePair> additionalParameters) throws IOException {
        SharedPreferences preferences = context.getSharedPreferences(
                context.getString(R.string.const_string_preferences),
                Activity.MODE_PRIVATE);

        String url = preferences.getString("url", "") + "/include/api.php";
        String user = preferences.getString("user", "");
        String password = preferences.getString("password", "");
        String apiPassword = preferences.getString("api_password", "");
        if (url.length() == 0 || user.length() == 0) {
            return "";
        }
        ArrayList<NameValuePair> parameters = new ArrayList<NameValuePair>();
        parameters.add(new BasicNameValuePair("user", user));
        parameters.add(new BasicNameValuePair("pass", password));
        if (apiPassword.length()> 0) {
            parameters.add(new BasicNameValuePair("apipass", apiPassword));
        }
        parameters.addAll(additionalParameters);
        Log.i(TAG, "sent: " + url);
        if (url.toLowerCase().contains("https")) {
            // Secure connection
            return Core.httpsGet(url, parameters);
        } else {
            HttpParams params = new BasicHttpParams();
            HttpConnectionParams.setConnectionTimeout(params,
                    CONNECTION_TIMEOUT);
            HttpConnectionParams.setSoTimeout(params, CONNECTION_TIMEOUT);
            DefaultHttpClient httpClient = new DefaultHttpClient(params);
            UrlEncodedFormEntity entity;
            HttpPost httpPost;
            HttpResponse response;
            HttpEntity entityResponse;
            String return_api;
            httpPost = new HttpPost(url);
            entity = new UrlEncodedFormEntity(parameters);
            httpPost.setEntity(entity);
            response = httpClient.execute(httpPost);
            entityResponse = response.getEntity();
            return_api = Core
                    .convertStreamToString(entityResponse.getContent());
            Log.i(TAG, "received: " + return_api);
            return return_api;
        }
    }

API における新規呼び出し拡張

API の新たな呼び出しを開発するには、以下を考慮してください。

Pandora FMS 拡張からの新たな API 呼び出し

…/include/functions_api.php を利用せずに新たな API 呼び出しを作成することができます。それには、Pandora FMS の extension ディレクトリに次の名前でファイルを追加します。

<extension_name>.api.php

そして、標準の API と同じように欲しい関数を作成します。ただし、プリフィックスは、api ではなく、apiextension です。

例えば、module_groups という名前の拡張を <Pandora installation>/extensions/module_groups に作る場合は、module_groups.api.php というファイルを作成する必要があります。

このファイルに、例えば、グループのモジュール数を取得する関数などの欲しい関数を入れます。この関数の名前は、apiextension_get_groupmodules といった名前である必要があります。

関数例

この関数では、独自の関数が使用されています。

function apiextension_get_groupmodules($group_name) {
    $group_id = group_id_from_name($group_name);
    if($group_id == false) {
       echo 'Group doesnt exist';
       return;
    }

    $number_of_modules = group_modules($group_id);
    echo $number_of_modules;
}

呼び出し例

この呼び出し例では、Servers グループのモジュールう数を取得します。

http://127.0.0.1/pandora_console/include/api.php?op=get&op2=extension&ext_name=module_groups&ext_function=groupmodules&id=Servers&apipass=1234&user=admin&pass=pandora

API 関数

API 関数内では、以下の関数を利用できます。

function get_module_last_value($idAgentModule, $trash1, $other=';', $returnType)
{
    $sql = sprintf('SELECT datos FROM tagente_estado WHERE id_agente_modulo = %d', $idAgentModule);
    $value = get_db_value_sql($sql);
    if ($value === false) {
        switch ($other['type']) {
            case 'string':
                switch ($other['data']) {
                    case 'error_message':
                    default:
                        returnError('id_not_found', $returnType);
                    break;
                }
                break;
            case 'array':
                switch ($other['data'][0]) {
                    case 'error_value':
                        returnData($returnType, array('type' => 'string', 'data' => $other['data'][1]));
                        break;
                }
                break;
        }
    }
    else {
        $data = array('type' => 'string', 'data' => $value);
        returnData($returnType, $data);
    }
}

API.php の今後

今後の api.php では次のようなことを考えています。

Pandora FMS ドキュメント一覧に戻る