Zabbix 4 Network Monitoring
上QQ阅读APP看书,第一时间看更新

Choosing between active and passive items

Even though we discussed Zabbix agents being active or passive, an agent really is neither one nor the other—the direction of the connections is determined by the item level. An agent can (and, by default, does) work in both modes at the same time. Nevertheless, we will have to choose which item typeactive or passiveto use. The short version—active items are recommended.

To understand why, let's compare how the connections are made. With a passive agent, it is very simple:

The arrow direction denotes how connections are made.

One value means one connection. An active agent is a bit more complicated. Remember—in the active mode, the agent connects to the server; hence, the agent first connects to the Zabbix server and asks for a list of items to be monitored. The server then responds with items, their intervals, and any other relevant information:

At this point, the connection is closed and the agent starts collecting the information. Once it has some values collected, it sends them to the server:

Note that an active agent can send multiple values in one connection. As a result, active agents will usually result in a lower load on the Zabbix server and a smaller amount of network connections.

The availability icon in the host list represents passive items only; active items do not affect it at all. If a host has active items only, this icon will stay gray. In previous Zabbix versions, if you added passive items that failed and then converted them all into active items, this icon would still stay red. Zabbix 3.0.0 is the first version in which the icon is automatically reset back to gray.

Of course, there are some drawbacks to active items and benefits to passive items too. Let's try to summarize what each item type offers and in which situation they might be better.

The benefits of active items are as follows:

  • They have a smaller number of network connections
  • They cause lower load on the Zabbix server
  • They will work if the network topology or firewalls do not allow connecting from the server to the agent (for example, if the monitored hosts are behind an NAT)
  • Items such as log or Windows event log monitoring are supported

Here are the benefits of passive items:

  • They are easier to set up for beginners
  • Custom intervals are supported (they are not supported by active items)
  • Polling a virtual IP address on a cluster allows you to always query the active cluster node
  • The default templates use passive items; hence, no modification or other configuration is required to use them

We will discuss using and modifying templates in Chapter 8, Simplifying Complex Configurations with Templates.