4 Zabbix agent 2 plugin protocol

    TypeSizeComments
    Byte4Size of the current payload in bytes.
    TypeSizeComments
    ByteDefined by the Size fieldJSON formatted data.
    Payload data definition
    Common data

    These parameters are present in all requests/responses:

    NameTypeComments
    iduint32For requests - the incrementing identifier used to link requests with responses. Unique within a request direction (i.e. from agent to plugin or from plugin to agent).
    For responses - ID of the corresponding request.
    typeuint32The request type.
    Log request

    A request sent by a plugin to write a log message into the agent log file.

    directionplugin → agent
    responseno

    Parameters specific to log requests:

    NameTypeComments
    severityuint32The message severity (log level).
    messagestringThe message to log.

    Example:

    Register request

    A request sent by the agent during the agent startup phase to obtain provided metrics to register a plugin.

    directionagent → plugin
    responseyes

    Parameters specific to register requests:

    Example:

      Register response

      Plugin’s response to the register request.

      directionplugin → agent
      responsen/a

      Parameters specific to register responses:

      NameTypeComments
      namestringThe plugin name.
      metricsarray of strings (optional)The metrics with descriptions as used in the plugin. Returns RegisterMetrics(). Absent if error is returned.
      interfacesuint32 (optional)The bit mask of plugin’s supported interfaces. Absent if error is returned.
      errorstring (optional)An error message returned if a plugin cannot be started. Absent, if metrics are returned.

      Examples:

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

      A request to execute the Start function of the Runner interface.

      directionagent → plugin
      responseno

      The request doesn’t have specific parameters, it only contains parameters.

      Example:

      Terminate request

      A request sent by the agent to shutdown a plugin.

      directionagent → plugin
      responseno

      The request doesn’t have specific parameters, it only contains parameters.

      Example:

      Export request

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

      directionagent → plugin
      responseno

      Parameters specific to export requests:

      NameTypeComments
      keystringThe plugin key.
      parametersarray of strings (optional)The parameters for Export function.

      Example:

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

      Response from the Export function of the Exporter interface.

      NameTypeComments
      valuestring (optional)Response value from the Export function. Absent, if error is returned.
      errorstring (optional)Error message if the Export function has not been executed successfully. Absent, if value is returned.

      Examples:

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

      or

      Configure request

      A request to execute the Configure function of the Configurator interface.

      directionagent → plugin
      responsen/a

      Parameters specific to Configure requests:

      NameTypeComments
      global_optionsJSON objectJSON object containing global agent configuration options.
      private_optionsJSON object (optional)JSON object containing private plugin configuration options, if provided.

      Example:

      Validate request

      A request to execute Validate function of the Configurator interface.

      directionagent → plugin
      responseyes

      Parameters specific to Validate requests:

      NameTypeComments
      private_optionsJSON object (optional)JSON object containing private plugin configuration options, if provided.

      Example:

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

      Response from Validate function of Configurator interface.

      directionplugin → agent
      responsen/a

      Parameters specific to Validate responses:

        or