See www.zabbix.com for the official Zabbix site.

Docs/specs/ZBXNEXT-1726

From Zabbix.org
Jump to: navigation, search

More flexible autoregistration based on data sent from the agent

ZBXNEXT-1726

Status: v1.1

Owner: Alexei

Summary

Currently it is only possible to use hostname to differentiate discovered hosts. In some cases (for example, Amazon cloud nodes) it would be great to keep original hostname while use other information sent by the agent for auto-registration purposes.

Details

New optional host attributes HostMetadata and HostMetadataItem will help to differentiate hosts. The attributes will be specified in Zabbix agent configuration file.

Example 1:

 HostMetadata=linuxserver

Example 2:

 HostMetadata=DC1/linuxserver/apache

Agent side changes

Two new configuration parameters will be supported:

HostMetadata - optional parameter that defines host metadata. If not defined, value will be acquired from HostMetadataItem.

HostMetadataItem - item used for getting host metadata, used only if HostMetadata is undefined

Host metadata is empty if both parameters are undefined.

Host metadata will be re-evaluated and sent to Zabbix server along with the host name in JSON request used to retrieve list of active checks.

Host metadata limit is 255 characters. If specified value of HostMetadata exceeds that limit an error will be issued and agent will not start up. In case of HostMetadataItem the output will be truncated and a warning message will appear in the agent log every time an item is called.

Note, the limit is 255 characters, not bytes. Only UTF-8 values are supported. In case of non-UTF-8 HostMetadata value - an error will be issued and agent will not start up, in case of non-UTF-8 value returned by HostMetadataItem a warning will appear in agent log file and it will be ignored.

The error log message:

 the value of "HostMetadata" configuration parameter cannot be longer than 255 characters

The warning log messages:

 the returned value of "%s" item specified by "HostMetadataItem" configuration parameter is too long, using first 255 characters
 cannot get host metadata using "%s" item specified by "HostMetadataItem" configuration parameter
 cannot get host metadata using "%s" item specified by "HostMetadataItem" configuration parameter: returned value is not an UTF-8 string

Interface changes

Configuration of action for auto-registration will support additional condition:

 Host metadata [like/not like]  [XXXXX]

Design and validation will be the same as for existing condition for 'Host name'.

Action example:

 Host metadata like  DC1
 Host metadata like  linuxserver
 Host metadata like  apache
 
 Therefore the action will be executed if host metadata contains all these strings.

Server and proxy side change

Server and proxy will be extended to support new condition for auto-registration.

Host metadata will be stored in table 'autoreg_host' or 'proxy_autoreg_host'.

The new {HOST.METADATA} macro must be supported in auto-registration notifications and remote commands.

Translation strings

  • Host metadata

Database changes

New field for table 'autoreg_host':

 FIELD           |host_metadata |t_varchar(255)  |''     |NOT NULL       |ZBX_SYNC

New field for table 'proxy_autoreg_host':

 FIELD           |host_metadata |t_varchar(255)  |''     |NOT NULL       |0

Documentation

ChangeLog

  • v1.0
    • label was renamed to metadata
  • v1.1
    • added the {HOST.METADATA} macro