Zabbix agent currently supports only one server in active mode – the first host from the Server configuration parameter is used. While for most users that is enough, some installations require a more advanced approach with the agent being able to report to multiple servers in the active mode.
Multiple server support in 1.8.12 already
The chosen approach was simple enough to be implemented in Zabbix 1.8.12 already. From the user perspective, if they only want to use a single active server (or none at all), nothing changes. Note that agent doesn’t really know whether it is talking to a server or proxy, so multiple proxies or any combination of servers and proxies is supported as well. Everywhere further down when a “server” is mentioned, that also includes Zabbix proxies. Now, if a user wants to use more than one server for the active checks, things change a bit. First, there is a new configuration parameter – ServerActive. How it works:
- If ServerActive is specified, Server is not used for active checks, only for passive checks
- If ServerActive is not specified, Server is used same as before, that is, first host is used for active checks
If you were using the first host from the Server parameter for active checks and you add a ServerActive parameter, you must list the same host in the new parameter as well, otherwise it will be ignored for active checks. Of course, to achieve our goal of having multiple servers used, this parameter allows to specify multiple hosts here – comma separated. For example, it could list:
But what if a proxy on one of them is running on a non-standard port? Custom port can be specified for each host after a colon.
Of course, IPv6 is supported as well… but wait, IPv6 addresses contain colons. How about specifying non-default port then? If IPv6 host must have port specified, IP address should be enclosed in square brackets (square brackets are optional if no port is used with IPv6) address, for example:
For all hosts that don’t have a port specified here, port in ServerPort is used. If ServerPort is not specified, default port (10051) is used.
Different implementation in 2.0
The solution for 1.8 is great as it does not require any changes for users, upgrading to 1.8.12 or later from previous agent versions. It is not great as the behaviour is a bit cryptic and confusing – if this parameter is specified, we ignore something from that parameter, ports can be overridden in two ways… Given that 2.0 is a major upgrade it was decided to implement a simpler solution. A minor drawback is that some users will have to modify their agent daemon configuration files when upgrading agents to 2.0. So, 2.0 works exactly as 1.8 implementation, but with these differences:
- Hosts in the Server parameter are never used for active checks, only for passive checks – even if ServerActive is not specified
- ServerPort parameter is removed
Upgrading agent to Zabbix 2.0
For those users who are not using active checks, upgrade to 2.0 will not require any changes – unless they were specifying ServerPort (for some reason – it is not used for anything else besides active checks). For those users who moved to using ServerActive with 1.8, upgrade to 2.0 will not require any changes – unless they were specifying ServerPort.
- All users who used ServerPort will have to remove this parameter from their configuration files
- All users who used active checks in 1.8 without ServerActive parameter will have to add their server/proxy in ServerActive parameter. If they used ServerPort, that will also have to be added to corresponding hosts in the ServerActive parameter
How it works
Before this development, only one agent internal process was possible that would be responsible for active items. Now, for each host, specified in ServerActive, a new active item process will be created. Each process will work with one server only in an independent fashion. So these processes work totally in parallel, without any communication between them.Each active item process works with one server or proxy exclusively
Item values are sent back to whichever server sent configuration data for them. If one server sends active item configuration data and another has no active items configured, only the first server will receive the values for those items. All the configuration data, received from servers, is handled separately by each internal process, so you should be careful with that – for example, if there is a script that should not be run in multiple copies simultaneously, you should never send item data from multiple servers that references this script. If you do, multiple active item processes will definitely attempt to run the script at the same time.
The new parameter syntax is a bit more complex than for the old Server parameter, so typos and other mistakes might be a bit more likely. Because of this (and because Zabbix becomes a bit more user-friendly lately ), error reporting should be fairly helpful. If Zabbix agent can’t parse some part of the addresses (there’s something totally wrong there), it will refuse to start up with a message error in ServerActive option at position <pos>, printing out the character position where the problematic content starts. If an address is specified twice in ServerActive, agent will refuse to start up with an additional message part address “host:port” specified more than once.
Where is it?
This functionality is available in 1.8.12rc1, and will be in the final release of 1.8.12. If you are interested in it, make sure to test 1.8.12rc1 as soon as possible.
Special thanks for help and support with this feature goes to:
- Takanori Suzuki for the initial idea and proof-of-concept patch
- Intelligence Business Solutions, Ltd. (Zabbix certified partner) for financing the complete development