See for the official Zabbix site.


Jump to: navigation, search

Automatic host availability update for interfaces without enabled items


Status: v1.3

Owner: Andris Zeila


Host availability is updated when an item check fails or succeeds. This means that if items of the corresponding type are removed the host availability will never change, displaying its last status forever.

Current implementation details

Zabbix server and proxy keep track of hosts' availability in 'hosts' database table. The information is also cached (see 'ZBX_DC_HOST').

Server - passive Zabbix agent and SNMP, IPMI, JMX agents

Zabbix server (poller, IPMI poller, Java poller) polls items with 'get_values()'. It selects items to poll in each invocation with 'DCconfig_get_poller_items()'. Note - per iteration 'get_values()' polls a single Zabbix agent, IPMI item but it can poll multiple Java, SNMP items (see 'DCconfig_get_poller_items()').

In case of NETWORK_ERROR or GATEWAY_ERROR the poller checks if host associated with the item needs to be deactivated. In case of SUCCEED, NOTSUPPORTED, AGENT_ERROR, TIMEOUT_ERROR the poller checks if the host associated with the item needs to be activated.

Relevant functions:

  • get_values();
    • activate_host(), deactivate_host() - update availability in cache and (if necessary) - DB;
      • host_get_availability() - from cache;
      • DChost_activate(), DChost_deactivate() - check if host's status changed;
      • db_host_update_availability().

Server - active Zabbix agent

Active Zabbix agent items do not influence host's availability in any way.

Server - passive Zabbix proxy

See the JSON-based protocol description.

Server functions (proxy poller):

  • process_proxy();
    • get_data_from_proxy() with argument ZBX_PROTO_VALUE_HOST_AVAILABILITY;
    • process_host_availability() - updates availability in DB and cache;
      • DChost_update_availability().

Proxy functions (trapper):

  • process_trap();
    • send_host_availability();
      • get_host_availability_data() - from DB.

Server - active Zabbix proxy

See the JSON-based protocol description.

Proxy functions (data sender):

  • host_availability_sender();
    • get_host_availability_data() - from DB.

Server functions (trapper):

  • process_trap();
    • recv_host_availability();
      • process_host_availability() - updates availability in DB and cache.

Proxy - agents

The implementation from Zabbix server is reused without changes.


Zabbix server should reset host availability for:

  • interfaces without enabled items;
    • for Zabbix agent - interfaces without enabled passive items;
  • disabled hosts;
  • hosts monitored by quiet proxies (inactive for the maximum heartbeat interval: 1 hour);
  • hosts whose proxy assignment is changed (server -> proxy, proxy -> another proxy, proxy -> server).


During configuration sync server/proxy must do the following:

  • reset host's used interfaces flags;
  • set a flag for host's interfaces with enabled items;
    • skip interfaces for hosts whose proxy assignment changed - these interfaces will be reset in the next step;
  • reset host availability for:
    • disabled hosts;
    • interfaces without enabled items;
    • on server - hosts monitored by quiet proxies (no input for more than 1 hour - maximum heartbeat interval).


In both server and proxy when periodically synchronizing configuration cache with DB:

  • DCsync_hosts():
    • reset per-host 'used_interfaces' flags;
    • in case host is monitored by proxy - save proxy last access from DB to cache.
  • DCsync_items():
    • for enabled items that have enabled host (but not handled by proxy) set relevant bit in the host's 'used_interfaces' flags;
    • don't set the host's 'used_interfaces' flags if host's proxy assignment changed.

Immediately after synchronization:

  • DCupdate_hosts_availability() - get hosts with no enabled interfaces in 'used_interfaces' flags, (re)set availability of hosts' unused interfaces to unknown state in DB;
    • DCreset_hosts_availability() - (re)set availability of hosts' unused interfaces to unknown state in configuration cache and report these hosts, interfaces back to caller.
      • Note that on server DCreset_hosts_availability() skips hosts that are handled by proxies which have been accessed during the last maximum heartbeat interval (1 hour).



  • v1.3 reset host's availability status if its proxy assignment has been changed or proxy data was not received during maximum proxy heartbeat period (1 hour).
  • v1.2 described implementation details.
  • v1.1 moved host availability reset to the same process as configuration sync because of proxies.
  • v1.0 initial.