This is a translation of the original English documentation page. Help us make it better.

4 Zabbixエージェント2プラグインプロトコル

Zabbixエージェント2プロトコルはコード、サイズ、データ モデルに基づいています。

コード

タイプ サイズ コメント
バイト 4 ペイロードタイプ。現在はJSON形式のみがサポートされています。

サイズ

タイプ サイズ コメント
バイト 4 現在のペイロードのサイズ(バイト単位)

ペイロードデータ

タイプ サイズ コメント
バイト サイズフィールドで定義される JSON形式のデータ
ペイロードデータ定義
共通データ

これらのパラメータはすべてのリクエスト/レスポンスに存在します。

名前 タイプ コメント
id uint32 リクエストの場合 - リクエストとレスポンスを関連付けるために使用される増分識別子。リクエスト方向(エージェントからプラグイン、またはプラグインからエージェント)内で一意です。
レスポンスの場合 - 対応するリクエストのID
type uint32 リクエストタイプ
ログリクエスト

プラグインからエージェントのログファイルにログメッセージを書き込むために送信されるリクエスト

direction plugin → agent
response no

ログリクエスト固有のパラメータ:

Name Type Comments
severity uint32 メッセージの重要度(ログレベル)
message string ログに記録するメッセージ

例:

{"id":0,"type":1,"severity":3,"message":"message"}
登録リクエスト

エージェント起動フェーズ中に、プラグインを登録するためのメトリクスを取得するためにエージェントから送信されるリクエスト

direction agent → plugin
response yes

登録リクエスト固有のパラメータ:

Name Type Comments
version string プロトコルバージョン <major>.<minor>

例:

{"id":1,"type":2,"version":"1.0"}
登録レスポンス

登録リクエストに対するプラグインのレスポンス

direction plugin → agent
response n/a

登録レスポンスに固有のパラメータ:

Name Type Comments
name string プラグイン名
metrics 文字列の配列 (オプション) プラグインで使用される説明付きのメトリクス。RegisterMetrics() を返します。エラーが返された場合は省略されます。
interfaces uint32 (オプション) プラグインでサポートされているインターフェースのビットマスク。エラーが返された場合は省略されます。
error string (オプション) プラグインを起動できない場合に返されるエラーメッセージ。メトリクスが返された場合は省略されます。

例:

{"id":2,"type":3,"metrics":["external.test", "External exporter Test."], "interfaces": 4}

または

{"id":2,"type":3,"error":"error message"}

開始リクエスト

ランナーインターフェースの Start 関数を実行するためのリクエスト

direction agent → plugin
response no

このリクエストには特定のパラメーターはなく、共通データパラメーターのみが含まれます。

Example:

{"id":3,"type":4}
終了リクエスト

プラグインをシャットダウンするためにエージェントから送信されるリクエスト

direction agent → plugin
response no

このリクエストには特定のパラメータはなく、共通データパラメータのみが含まれます。

例:

{"id":3,"type":5}
Export request

A request to execute the Export function of the Exporter interface.

direction agent → plugin
response no

Parameters specific to export requests:

Name Type Comments
key string The plugin key.
parameters array of strings (optional) The parameters for Export function.

Example:

{"id":4,"type":6,"key":"test.key","parameters":["foo","bar"]}
Export response

Response from the Export function of the Exporter interface.

direction plugin → agent
response n/a

Parameters specific to export responses:

Name Type Comments
value string (optional) Response value from the Export function. Absent, if error is returned.
error string (optional) Error message if the Export function has not been executed successfully. Absent, if value is returned.

Examples:

{"id":5,"type":7,"value":"response"}

or

{"id":5,"type":7,"error":"error message"}
構成リクエスト

Configurator インターフェースの Configure 機能を実行するためのリクエスト

direction agent → plugin
response n/a

Configure リクエスト固有のパラメーター:

名前 タイプ コメント
global_options JSON オブジェクト グローバルエージェント構成オプションを含む JSON オブジェクト
private_options JSON オブジェクト (オプション) プライベートプラグイン構成オプション (指定されている場合) を含む JSON オブジェクト

例:

{"id":6,"type":8,"global_options":{...},"private_options":{...}}
Validate リクエスト

Configurator インターフェースの Validate 関数を実行するためのリクエスト

direction agent → plugin
response yes

Validate リクエスト固有のパラメーター:

Name Type Comments
private_options JSON オブジェクト (オプション) プライベートプラグイン設定オプション (指定されている場合) を含む JSON オブジェクト

例:

{"id":7,"type":9,"private_options":{...}}
Validate response

Response from Validate function of Configurator interface.

direction plugin → agent
response n/a

Parameters specific to Validate responses:

Name Type Comments
error string (optional) An error message returned if the Validate function is not executed successfully. Absent if executed successfully.

Example:

{"id":8,"type":10}

or

{"id":8,"type":10,"error":"error message"}