Pandora FMS 外部 API は、(/include/api.php に対して HTTP アクセスすることにより) リモート操作に利用します。 これは、Pandora FMS 外から操作するアプリケーションを作成できるように、Pandora FMS に用意されている手法です。基本的に、アプリケーションからの操作で、指定したフォーマットのパラメータで値を受け渡します。
API.php の呼び出しは、次のように単純です。
http://<Pandora FMS コンソールのインストールパス>/include/api.php<パラメータ>
API は次のパラメータのみ受け取ることができます。
op
(必須): 最初のパラメータで、操作の種類を指定します。“get”、“set”、“help” のいずれかを指定できます。get
: 値を取得します。set
: 値を設定します。help
: 小さなヘルプを返します。op2
(必須): 処理の名前を指定します。id
(コマンドによる): 1番目のパラメータです。id2
(コマンドによる): 2番目のパラメータです。other
(コマンドによる): 3番目のパラメータです。連続したデータリストの場合もあります。other_mode
(オプション): 連続データのフォーマットです。指定可能な値は次の通りです。url_encode
: 文字列フォーマットです。UrlEncodeurl_encode_separator_
<セパレータ»複数の値を分割する文字を指定します。例えば、次の通りです。...other=pears|melons|watermelon&other_mode=url_encode_separator_|
任意の区切り文字を使用できます。このドキュメントでは、|
文字(%7C
パーセントエンコード)を優先的に使用しています。API チェッカー がどのように動くかも確認してください。
returnType
(コマンドによる): 値の取得フォーマットです。設定可能な値は次の通りです。string
: 英数字として値を返します。csv
: デフォルトで ;
および改行で区切られた CSV で値を返します。csv_head
: csv
と同様ですが、最初にフィールド名を返します。API は、アクセス元、パスワードおよび、ユーザ資格情報を介してアクセスを認証します。
現時点では、セキュリティはアクセスする IP アドレスリストに基づいています。
テキストボックスに *
を入力すると、IP アドレスによる ACL チェックは省略され、セキュリティはプロトコルと環境に委ねられます。
API アクセスのパスワードも設定することができます。(API パスワード(API password))
apipass
: デフォルトかつこのドキュメントでは、1234
が使われています。ユーザ名とパスワードによるものです。さらに、バージョン 768 以降からは、Bearer トークンによる認証が可能です。
API へアクセスするには、Pandora FMS の正しいユーザ名とパスワードを与える必要があります。
user
: 正しい Pandora FMS のユーザで、このドキュメントでは admin
を使っています。pass
: ユーザのパスワードで、このドキュメントでは pandora
を使っています。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
アクセス条件:
*
が設定されている)1234
admin
が存在し、そのパスワードが pandora
管理メニューの 管理ツール(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
バージョン 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 を使っています。
curl -V
で確認します。curl -h
を実行します。-k
および -H
パラメータは、それぞれ HTTPS アクセスで自己証明書でのアクセスの受け入れ、ヘッダ情報を送信するために利用します。get test
を使用しています (あらかじめ用意した自身の bearer トークンに置き換えます)。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 ""
-v
パラメータを利用します。(バージョンを表示する -V
と混同しないでください。)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
といった内容が返ります。
データを読み出します。
書式: パラメータ無し
例
以下の例では、OK を返します。
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=test
応答サンプル: OK,v7.0NG.751,PC201215
ユーザ権限のアクセスレベルに応じて、Pandora FMS のライセンス状態を返します。
書式:
op=get
(必須)op2=license
(必須)return_type=json
(必須)例 ( 呼び出し書式を参照):
…/include/api.php?op=get&op2=license&return_type=json&apipass=1234&user=admin&pass=pandora
コミュニティ 版では、次のような応答を返します。
{ "type":"array", "data":{ "license_mode":"PANDORA-FREE", } }
他のパラメータのフィルタに従って、エージェントフィルタのリストを返します。
書式:
op=get
(必須)op2=all_agents
(必須)return_type=csv
または return_type=json
(必須)other=
<連続パラメータ> (オプション) 検索するエージェントをフィルタするためのパラメータ列:unknown
, warning
, critical
, no_modules
.1
または 0
)例 (呼出書式を参照):
この例では、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
= 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
書式:
例
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
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=agent_module_name_last_value&id=miguel-portatil&id2=cpu_user
= 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
モジュール名を指定すると、そのモジュール名を含むエージェントのリストを返します。 結果は、セミコロン (;
) で区切られた、エージェントID、エージェントの別名、要求されたモジュールの値、およびエージェント名を返します。例:
653;agente network;0.00000;a8c83b348451040dc91c1327303adf8945aefce6ac59ab9bf856c9f4e0cf6c6f
書式:
op=get
(必須)op2=module_value_all_agents
(必須)id=
<エージェント名> (必須)例 (書式を参照):
Host Alive
というモジュールがある全エージェントの一覧:
.../include/api.php?op=get&op2=module_value_all_agents&id=Host%20Alive&apipass=1234&user=admin&pass=pandora
数値 ID で指定したエージェントのモジュール一覧を返します。
書式:
op=get
(必須)op2=agent_modules
(必須)return_type=<csv>
(必須) 出力書式other=
<連続パラメータ> (必須) エージェントでフィルタするためのパラメータ:次のように、セパレータを設定することが必要です。
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
エージェントのモジュール 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
モジュール 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
エージェントが存在するサーバ 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
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=policies&return_type=csv&other=&other_mode=url_encode_separator_|
書式:
例
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_|
書式:
例
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
モジュールのグラフを画像ファイルで返します。このグラフは、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_|
other パラメータでフィルタしたイベントの一覧を返します。
書式:
op=get
(必須)op2=events
(必須)id=
<ノードID> (メタコンソールではオプション、ノードでは不要)return_type=csv
(必須)other_mode=url_encode_separator_|
(オプション)other=
<連続したパラメータ> (オプション) 次の順番でパラメータを指定します:0
から 6
で次の通り:0:メンテナンス
1:情報
2:正常
3:警告
4:障害
5:マイナー
6:メジャー
1
にします。0
、承諾済みは 1
。0
です)。total
: 単純にイベントの総数を返します。たとえば、JSON 形式では、{“type”:“json”,“data”:{“count”:990}}
が配信されます。more_criticity
: 最も重大なイベントの数を返します。JSON 形式でリクエストされた場合の例: {“type”:“json”,“data”:[{“criticity”:“4”,“user_can_manage”:“1”,“user_can_write”:“1”,“server_id”:5,“server_name”:“stod”}]}
.going_unknown
unknown
recon_host_detected
system
error
new_agent
going_up_warning
going_up_critical
going_down_warning
going_down_normal
going_down_critical
going_up_normal
configuration_change
ncm
not_normal
例 (書式を参照):
メタコンソールで、ノード ID が 5
の ncm
(ネットワーク設定管理) イベントの取得:
…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
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=all_alert_templates&return_type=csv&other=;
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=module_groups&return_type=csv&other=;
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=plugins&return_type=csv&other=;
書式:
op=get
(必須)op2=tags
(必須)return_type=csv
または、return_type=json
(必須)other=
< フィールドセパレータ > CSV フォーマットを指定した場合はフィールドセパレータは必須です。指定しないと各フィールドが一緒に返されます。例 (書式を参照):
この例では、システムの全てのタグをセミコロンで区切った CSV フォーマットで返します。
…/include/api.php?op=get&op2=tags&return_type=csv&other=;&apipass=1234&user=admin&pass=pandora
= 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
モジュールが見つからない場合は、空の文字列を返します。
グループの全モジュール。
書式:
op=get
(必須)op2=total_modules
(必須)id=<グループID>
(バージョン 768 までは必須、バージョン 769 以降はオプション)例 (書式を参照)
Networking モジュールグループの全モジュール数の取得:
.../include/api.php?op=get&op2=total_modules&id=2&apipass=1234&user=admin&pass=pandora
Pandora FMS インストール時のデフォルトでは、以下の モジュールグループ があります。
グループ ID が 0
または、省力した場合は、全モジュール数が返ります。
.../include/api.php?op=get&op2=total_modules&apipass=1234&user=admin&pass=pandora
グループの全エージェント
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=total_agents&id=2&apipass=1234&user=admin&pass=pandora
指定した ID のエージェント名
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
= 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
指定した ID のモジュール名
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=module_name&id=1&apipass=1234&user=admin&pass=pandora
指定したグループにおよびアクションにおいて、実行された全アラート
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=alert_action_by_group&id=0&id2=3&apipass=1234&user=admin&pass=pandora
アラートアクションの一覧を取得します。
書式:
op=get
(必須)op2=alert_actions
(必須)return_type=<一覧フォーマット>
(必須) 'csv' または 'json' を指定できます。other=<連続パラメータ>
(オプション):例
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
この機能はメタコンソールのみです。
メタコンソールからノードのアラートアクション一覧を取得します。
書式:
例
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
全アラートコマンドを返します。
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=all_alert_commands&return_type=csv&other=$&apipass=1234&user=admin&pass=pandora
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=get&op2=event_info&id=80&apipass=1234&user=admin&pass=pandora
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=tactical_view&apipass=1234&user=admin&pass=pandora
バージョン 5.0 かそれ以降
書式:
Example
http://localhost/pandora_console/include/api.php?op=get&op2=pandora_servers&return_type=csv&apipass=1234&user=admin&pass=pandora
次の順番で値が返ります。
= 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
= 5.0
エージェントの最新の gis データを返します。
書式:
例
http://localhost/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=gis_agent&id=1
= 5.1
特別日一覧を返します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=special_days
= 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
= 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
= 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
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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 7.0NG
Pandora に設定されているタイムゾーンを返します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?apipass=1234&user=admin&pass=pandora&op=get&op2=timezone
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 7.0NG. 725
ポリシーから全データを返します。ポリシー ID が指定されていない場合は、全ポリシーから全データを返します。
書式:
例
http://localhost/pandora_console/include/api.php?op=get&op2=policy&apipass=1234&user=admin&pass=pandora&return_type=json.
= 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.
= 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.
= 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
= 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.
= 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.
= 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
= 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.
= 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
= 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
= 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
Pandora FMS でユーザがアクセスするイベント応答の一覧を返します。
書式:
例
この例では、csv フォーマットで全システムイベント応答を返します。
http://localhost/pandora_console/include/api.php?op=get&op2=event_responses&return_type=csv&apipass=1234&user=admin&pass=pandora
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_&
この機能はメタコンソールのみです。
全 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
この機能はメタコンソールのみです。
ユーザデータの一覧を返します。
書式:
例
指定のユーザに関するすべての情報を取得します。 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
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_&
= 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
= 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
= 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
= 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
この機能はメタコンソールのみです。
フィルタリングを行ったユーザグループを取得します。
書式:
例
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
Pandora インベントリモジュールの一覧を返します。
書式:
例
この例では、全インベントリの情報を json フォーマットで返します。
http://localhost/pandora_console/include/api.php?op=get&op2=inventory_modules&return_type=json&apipass=1234&user=admin&pass=pandora
エージェント名を用いてエージェントからインベントリモジュールを取得します。
書式:
例
http://localhost/pandora_console/include/api.phpop=get&op2=inventory_modules_by_name&id=name&return_type=csv&apipass=1234&user=admin&pass=pandora
エージェントの別名を用いて、エージェントからインベントリモジュールを取得します。
書式:
例
http://localhost/pandora_console/include/api.phpop=get&op2=inventory_modules_by_alias&id=alias&return_type=csv&apipass=1234&user=admin&pass=pandora
エージェント名とモジュールを用いて、インベントリモジュールからデータを取得します。
書式:
例
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
Pandora の全コレクションの一覧を返します。
書式:
例
この例では、全コレクションの情報を json フォーマットで返します。
http://localhost/pandora_console/include/api.php?op=get&op2=list_collections&apipass=1234&user=admin&pass=pandora
コレクション内の全ファイル一覧を返します。コレクション ID を指定しなかった場合、全コレクションの全ファイルを返します。
書式:
例
この例では、コレクション内の全ファイル名を json フォーマットで返します。
http://localhost/pandora_console/include/api.php?op=get&op2=list_collection_files&id=1&apipass=1234&user=admin&pass=pandora
存在するイベントフィルタの一覧を返します。
書式:
例
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
ノードの 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
ノードが中央管理されているか(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
データを送信します。
パラメータで指定した内容で新たなエージェントを作成します。
書式:
例
ノード での呼び出し例:
.../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
1
の場合はエージェント名は別名と同じです。0
の場合はエージェント名は自動的に生成されます。パラメータで渡したデータで、エージェントを更新します。
書式:
op=set
(必須)op2=update_agent
(必須)id=
<エージェントID> (必須)other=
<連続パラメータ> (必須) エージェントの設定データで次の順番で設定します。例 (書式を参照):
.../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
この呼び出しは、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
指定した名前のエージェントを削除します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_agent&id=agente_erroneo
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
モジュールテンプレートをエージェントへ適用します。
モジュールテンプレートは、ネットワークモジュールを集めたものです。このテンプレートは、直接エージェントに適用することができ、モジュールを一つ一つ追加する必要はありません。
書式:
例
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
指定のパラメータでネットワークモジュールを作成します。
書式:
op=set
(必須)op2=create_network_module
(必須)id=
< エージェント名 > (必須) エージェント名でなければいけません。other=
< 連続パラメータ > (必須) 次の順番で指定するモジュール設定パラメータです。0
もしくは 1
例 (書式を参照):
…/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
指定のパラメータでプラグインモジュールを作成します。
書式:
op=set
(必須)op2=create_plugin_module
(必須)id=
<エージェント名> (必須) エージェント名でなければいけません。other=
<連続パラメータ> (必須) 次の順番でモジュールの設定を指定します。0
または 1
0
または 1
例 (書式を参照):
…/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 ドキュメントの内容は、次のプロパティを持つ複数のオブジェクトで構成されるオブジェクトである必要があります。
macro
: マクロ名。_field1_, _field2_, …, _fieldN_ である必要があります。desc
: マクロを表す名前。help
: マクロの説明。value
: マクロ値。hide
: マクロ値を非表示にするには、1
に設定します (パスワードの保存に役立ちます)。例:
{ "1": { "macro": "_field1_", "desc": "Target IP", "help": "", "value": "192.168.0.1", "hide": "" }, "2": { "macro": "_field2_", "desc": "Port", "help": "", "value": "80", "hide": "" } }
指定したパラメータでモジュールを作成します。
このコマンドにてデータベースにモジュールデータを追加できますが、モジュールに関連づけられたエージェントの設定ファイルの編集はできません。
書式:
op=set
(必須)op2=create_data_module
(必須)id=
<エージェント名> (必須) エージェント名でなければいけません。other=
<連続パラメータ> (必須) モジュールの設定とデータを次の順番で指定します。0
または 1
例 (書式を参照):
…/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
SNMP モジュールを作成します。
書式:
op=set
(必須)op2=create_snmp_module
(必須)id=
<エージェント名> (必須) エージェント名でなければいけません。other=
<連続パラメータ> (必須) 次の順番で指定するモジュールの設定とデータです。0
または 1
例 (書式を参照):
例 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
ネットワークモジュールを更新します。
書式:
op=set
(必須)op2=update_network_module
(必須)id=
<モジュールID> (必須) モジュールIDでなければいけません。other=
<連続パラメータ> (必須) 次の順番でモジュールの設定とデータを指定します。例 (書式を参照):
…/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
プラグインモジュールを更新します。
書式:
op=set
(必須)op2=update_plugin_module
(必須)id=
<モジュールID> (必須) モジュールIDでなければいけません。other=
<連続パラメータ> (必須) 次の順番でモジュールの設定とデータを指定します。0
または 1
例 (書式を参照):
…/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"
これによりデータベースにモジュールデータを追加することはできますが、該当モジュールに関するエージェントの設定ファイルを変更することはできません。
ローカルモジュールを更新します。
書式:
op=set
(必須)op2=update_data_module
(必須)id=
<モジュールID> (必須) 更新するモジュールの数値 ID。other=
<連続パラメータ> (必須) 次の順番でモジュールの設定とデータを指定します。1
、変更なし は 0
。{“going_unknown”:1}
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
ポリシーのデータモジュールを更新し、新たなモジュールの ID を返します。
書式:
op=set
(必須)op2=update_data_module_policy
(必須)id=
<id_policy> (必須) 対象のポリシーモジュールID。other=
<連続パラメータ> (必須) 次の順番でモジュールの設定とデータを指定します。:<マクロ名>:<マクロ値>
のようになっている必要があります。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
SNMP モジュールを更新します。
書式:
op=set
(必須)op2=update_snmp_module
(必須)id=
<モジュールID> (必須) モジュールIDでなければいけません。other=
<連続パラメータ> (必須) 次の順番でモジュールの設定とデータを指定します。0
または 1
例 (書式を参照):
例 (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"
ひとつもしくは複数のエージェントに、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
Pandora 内にある全ポリシーを適用します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=apply_all_policies&apipass=1234&user=admin&pass=pandora
指定したパラメータで、ポリシーにネットワークモジュールを追加します。
書式:
例
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_|
指定したパラメータで、ポリシーにプラグインモジュールを追加します。
書式:
例
{ "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_|
指定したパラメータで、ポリシーにローカルモジュールを追加します。
書式:
例
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_~
指定したパラメータで、ポリシーに 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_|
エージェント 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
エージェント名を用いてポリシーへエージェントを追加します。
書式:
例
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
エージェント 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
エージェント名を用いて、ポリシーからエージェントを削除します。
書式:
例
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
新たなネットワークコンポーネントを作成します。
書式:
例
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_|
新たなプラグインコンポーネントを作成します。
書式:
例
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_|
新たな 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_|
新たなローカルコンポーネントを作成します。
書式:
例
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_~
アラートテンプレートを作成します。
書式:
例
例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
アラートテンプレートを更新します。
書式:
例
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
アラートテンプレートと、テンプレートで使われているアラートを削除します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_alert_template&id=38
モジュールテンプレートを削除します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_module_template&id=38
モジュールテンプレートを削除します。
書式:
例
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
計画停止を停止します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=stop_downtime&id=1
Pandora FMS に新たなユーザを作成します。
書式:
op=set
(必須)op2=new_user
(必須)id=<ユーザ名>
(必須)other=<連続パラメータ>
(必須) 次の順番でユーザ設定とデータを指定します。上記の 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
指定した 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_|
ID で指定したユーザを削除します。
書式:
op=set
(必須)op2=delete_user
(必須)id=<ユーザID>
(必須) 削除するユーザの ID です。例 (書式を参照):
../include/api.php?op=set&op2=delete_user&id=md&apipass=1234&user=admin&pass=pandora
この機能はメタコンソールのみです。
ユーザのパーミッションを削除します。
書式:
例
ユーザのパーミッションを削除します。 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
この機能はメタコンソールのみです。
ユーザグループへパーミッションを追加します。
書式:
例
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
ユーザを無効化・有効化します。
書式:
例
例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
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_|
グループを作成します。
書式:
例
例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
グループの設定を更新します。
書式:
例
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
グループを削除します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_group&id=303&apipass=1234&user=admin&pass=pandora
ユーザにプロファイルを追加します。
書式:
例
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_|
ユーザのプロファイルを削します。
書式:
例
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_|
新たなインシデントを作成します。
書式:
例
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_|
インシデントにコメントを追加します。
書式:
例
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
全アラートを承諾します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=validate_all_alerts
ポリシーから作成されたアラートを承諾します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=validate_all_policy_alerts
指定したフィルタにマッチするすべてのイベントを承諾します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=event_validate_filter&other_mode=url_encode_separator_|&other=;|2
前述の 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
指定した ID のイベントを承諾します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora
テンプレートおよび、エージェント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
アラートにアクションを追加します。
書式:
例
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
アラートにコマンドを追加します。
書式:
例
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
新たなモジュールを作成します。
書式:
例
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
モジュールを削除します。
バージョン 768 以降、削除するモジュール (例: Host Alive ) が別のモジュールの 親 (“関連障害検知抑制” が有効)である場合、 子 モジュールも削除されます。
書式:
op=set
(必須)op2=delete_module
(必須)id=
<エージェント名> (必須)id2=
<モジュール名> (必須)例 (書式を参照):
.../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
エージェントのアラートを有効化します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=enable_alert&id=garfio&id2=Status&other=Warning%20condition
エイリアスでエージェントのアラートを有効化します。
書式:
例
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
エージェントのアラートを無効化します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=disable_alert&id=garfio&id2=Status&other=Warning%20condition
エージェントのアラートを無効化します。
書式:
例
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
enable_alert と同じです。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=enable_module_alerts&id=garfio&id2=Status
disable_alert と同じです。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=disable_module_alerts&id=garfio&id2=Status
モジュールを有効化します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=enable_module&id=garfio&id2=Status
モジュールを無効化します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=disable_module&id=garfio&id2=Status
コンポーネントから新たなネットワークモジュールを作成します。
書式:
例
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
モジュールに値を追加します。この機能は、サーバに送信するデータを含む 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 ファイルの生成が成功しても、データがデータベースに保存されることは保証されません。
新たなモジュールグループを作成します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=new_module_group&id=Module_group_name&apipass=1234&user=admin&pass=pandora
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
= 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' を返します。
= 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' を返します。
= 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' を返します。
モジュール 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
Pandora 内に新たなイベントを作成します。
この機能は、Metaconsole でも使えます。
書式:
op=set
(必須)op2=create_event
(必須)other=
<連続パラメータ> (必須) 次の順番でイベントデータを指定します:0
新規, 1
承諾済, 2
処理中unknown
alert_fired
alert_recovered
alert_ceased
alert_manual_validation
system
error
new_agent
configuration_change
going_unknown
going_down_critical
going_down_warning
going_up_normal
0
メンテナンス1
情報2
正常3
警告4
障害5
マイナー6
メジャー例 (書式を参照):
作成するイベントの 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
イベントにコメントを追加します。
これはメタコンソールでも利用できます。
書式:
メタコンソールで利用するには、“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
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
(>= 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_|
= 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
= 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
エージェントを有効化/無効化します。
書式:
例
例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
= 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
= 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
エージェントのモジュールおよびアラートカウントを更新します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=reset_agent_counts&apipass=1234&user=admin&pass=pandora&id=All
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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_|
= 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_|
= 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
= 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_|
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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.
= 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
= 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
= 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
= 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_|
= 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_|
= 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
= 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_|
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
= 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
新たなイベント応答を作成します。
書式:
op=set
(必須)op2=create_event_response
(必須)return_type=csv
または return_type=json
(いずれか必須)other=
<連続パラメータ> (以下の順番ですべて必須):command
の場合、ここでは、イベントへの応答を実行するために必要なコマンドを指定する必要があります。一方、url
の場合は、イベントへの応答としてアクセスしたい URL を指定する必要があります。command
または url
.1
または 0
。 URL を新規ウインドウで表示する(1
)か、モーダルウインドウで表示する(0
)かを指定します。0
です。例 ( 書式を参照):
…/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
既存のイベント応答を編集します。イベント応答の編集にはそれが所属するグループにユーザがアクセスできる権限を持っている必要があります。
書式:
例
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
イベント応答を削除します。イベント応答の削除にはそれが所属するグループにユーザがアクセスできる権限を持っている必要があります。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=delete_event_response&id=7&apipass=1234&user=admin&pass=pandora
新たなユーザプロファイルを作成します。
書式:
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
既存のユーザプロファイルを更新します。
書式:
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
ユーザプロファイルを削除します。また該当のプロファイルのユーザへの割り当ても削除します。
書式:
例
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
イベントフィルタを作成します。
書式:
例
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
イベントフィルタを更新します。
書式:
例
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
イベントフィルタを削除します。
書式:
例
http://127.0.0.1/pandora_console/include/api.php?op=set&op2=delete_event_filter&id=38&apipass=1234&user=admin&pass=pandora
新たなインベントリモジュールを作成します。
書式:
例
この例では、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
インベントリモジュールを更新します。
書式:
例
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
インベントリモジュールを削除します。
書式:
例
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
コレクションを作成します。
書式:
連続パラメータのセパレータを渡すために、次のように '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
コレクションを削除します。
書式:
例
http://localhost/pandora_console/include/api.php?op=set&op2=delete_collection&id=15&apipass=1234&user=admin&pass=pandora
自動検出タスク一覧 にあるタスクを有効化または無効化します。
書式:
例
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
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
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
イベントにカスタム ID を設定します。
書式:
op=get
(必須)op2=set
(必須)id=
< id_event > (必須、数値)id2=
< id_custom_event > (必須、文字列)例 (書式 を参照):
…/include/api.php?op=set&op2=event_custom_id&id=110&id2=9999&apipass=1234&user=admin&pass=pandora
Pandora API を呼び出すためのいくつかの言語での例です。
<?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>"; } ?>
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()
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"); }
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
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
[-]>[-]<>+++++++++[<+++++++++>-]<-. >+++++[<+++++>-]<----. >++++[<++++>-]<---. >++++[<---->-]<++. >+++[<+++>-]<++. -.>++++++++[<-------->-]<--. >+++[<--->-]<---. >++++++++[<++++++++>-]<++++. +.>++++++++[<-------->-]<-----. >+++++++++[<+++++++++>-]<----. ++. --.>+++[<--->-]<+. >+++[<+++>-]<. >++[<++>-]<++. >++[<-->-]<-. >+++++++++[<--------->-]<++. >+++++++++[<+++++++++>-]<---. +.>+++++++++[<--------->-]<++. >+++++++++[<+++++++++>-]<+++. >++++[<---->-]<+. >+++[<+++>-]<. >+++[<--->-]<++. >+++[<+++>-]<-. >+++++++++[<--------->-]<++. >+++++++++[<+++++++++>-]<+++. >+++[<--->-]<--. ----.>+++[<+++>-]<-. +++. -.>+++++++++[<--------->-]<++. >+++++++++[<+++++++++>-]<-. >++++[<---->-]<+. >++++[<++++>-]<+. >++++[<---->-]<-. >++++++++[<-------->-]<-. >++++++++[<++++++++>-]<++++++++. >+++[<--->-]<++. ++. ++.>++++[<++++>-]<---. >++[<-->-]<--. +++.>++++++++[<-------->-]<---. >+++[<--->-]<---. >+++++++++[<+++++++++>-]<-. >+++[<--->-]<--. >++++[<++++>-]<---. ---.>+++++++++[<--------->-]<++. >+++++++++[<+++++++++>-]<+++++. >+++++[<----->-]<++++. >+++[<+++>-]<++. >+++[<--->-]<++. >++++++++[<-------->-]<-----. >+++++++++[<+++++++++>-]<----. >+++[<+++>-]<-. >++++[<---->-]<--. >++[<++>-]<+. >+++[<+++>-]<--. ++++.>+++++++++[<--------->-]<--. >++++++++[<++++++++>-]<++++++. >+++[<+++>-]<+++. >+++[<--->-]<. ++. --.>+++[<+++>-]<--. >++[<++>-]<+. >+++[<--->-]<++. >++[<++>-]<++. >++[<-->-]<-. ++++.>++++++++[<-------->-]<-----.
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 の新たな呼び出しを開発するには、以下を考慮してください。
…/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 関数内では、以下の関数を利用できます。
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 では次のようなことを考えています。