Skip to content
Tutorials Center
My learning

Topics

Lesson 10 of 37 ยท Hosts and Items

Zabbix Hosts, Host Groups, Interfaces, Tags and Macros

Create and organize Zabbix hosts: host names vs visible names, host groups, agent/SNMP/JMX/IPMI interfaces, tags, user macros, inventory and the host status settings.

In Zabbix, a host is anything you monitor: a server, a switch, a virtual machine, a database instance, a website, or even an abstract thing such as "backup jobs". Everything else (items, triggers, graphs) belongs to a host, directly or through a template. Getting hosts organized well makes every later task easier: permissions, alert routing, dashboards and reports.

Zabbix does not run on this site. The frontend steps are written out in words; the TryIt blocks are stand-ins that model the data structures.

Creating a host

Data collection > Hosts > Create host opens a form with these tabs and fields:

  • Host name: the technical, unique identifier (letters, digits, spaces, dots, underscores, hyphens). For agent active checks it must equal the agent's Hostname.
  • Visible name: an optional friendlier name shown in the interface (any characters). Use it if the technical name is cryptic.
  • Templates: templates linked to the host (see templates chapter).
  • Host groups: at least one group is required.
  • Interfaces: how the server reaches the host.
  • Description, Monitored by (server, a proxy, or a proxy group in 7.0), Enabled checkbox.

Other tabs: IPMI, Tags, Macros, Inventory, Encryption, Value mapping.

Host groups

Host groups are a flat list of names; a host can be in many. Zabbix uses them for permissions, filters, maintenance and alert conditions, so choose them for those jobs. Two practical conventions:

  1. Group by who owns it or what role it plays: Linux servers, Network/Switches, Prod/Databases.
  2. Use a slash to build visual hierarchy: Prod/Web, Prod/DB. Zabbix treats the slash as a naming convention; user group permissions can include nested groups with an option.

Since Zabbix 6.2, template groups are separate from host groups, so templates do not clutter the host group list.

Interfaces

An interface is a network address that Zabbix uses to reach the host. There are four types:

Type Used by Default port
Agent Zabbix agent (passive), simple checks, external checks, SSH, Telnet 10050
SNMP SNMP agent items 161
JMX JMX agent items 12345
IPMI IPMI agent items 623

A host can have several interfaces, even several of one type (for example two agent interfaces for a server with a management NIC and a data NIC). When you create an item, you choose which interface it uses. Each interface can be addressed by IP or by DNS (a "Connect to" switch). Use DNS names when addresses change; use IP addresses to avoid DNS as a dependency.

For SNMP interfaces you also set the version (SNMPv1, v2, v3), community or v3 credentials, and Use combined requests (several OIDs per request). One host with both an Agent and an SNMP interface can be monitored with agent items for the OS and SNMP items for the hardware.

Availability icons

The host list shows one icon per interface type: ZBX, SNMP, JMX, IPMI. Green = available, red = unavailable, gray = unknown or not monitored. Zabbix marks an interface unavailable after a failed passive check and then retries more slowly (with UnreachablePeriod, UnavailableDelay, UnreachableDelay server settings) until it answers again, so unavailability is detected quickly and the host is not hammered.

Tags

Host tags are key/value labels (env: prod, owner: payments, tier: db). They are inherited by problems of that host, so you can filter Problems, route alerts, and group dashboards by tag without creating more host groups. Tags are one of the most useful features introduced in Zabbix 4.x/5.x; use them for dimensions that cut across groups (environment, application, customer).

Python Stand-in: host model and tag filter

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

User macros

Macros are named placeholders replaced when Zabbix evaluates a field. User macros look like {$NAME} and can be defined globally (Administration > Macros), on a template, or on a host. The value used is the most specific one: host, then linked templates, then global. They are the way to parametrize templates without editing them:

  • {$CPU.UTIL.CRIT} = 90 on a template; one busy host overrides it to 98.
  • {$DB.PASSWORD} can be a secret text (hidden in the UI) or a value from a vault (HashiCorp Vault or CyberArk).
  • A context lets you give one macro per object: {$FS.FREE.MIN:"/var"} = 5, {$FS.FREE.MIN} = 10.

Built-in macros such as {HOST.NAME}, {HOST.IP}, {HOST.CONN}, {ITEM.LASTVALUE} and {TRIGGER.NAME} are used in messages and keys; see actions and media types.

Python Stand-in: macro resolution

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Inventory

The Inventory tab stores descriptive fields (type, OS, serial number, location, MAC, contact). Mode Manual keeps what you type; Automatic fills fields from items that you map (an item can "populate host inventory field"). It is handy for a quick CMDB: Inventory > Hosts gives a filterable table and a field overview.

Enabling, disabling and cloning

  • A disabled host is not monitored, and its history stays. Disabling is safer than deleting.
  • Clone copies a host with its templates and macros; Full clone also copies items, triggers and graphs. Prefer linking a template over cloning.
  • Mass update (select hosts in the list, choose Mass update) changes templates, groups, tags or macros for many hosts at once.
  • To import and export hosts as XML, JSON or YAML use Export and Import on the Hosts page. This is how you version-control monitoring configuration.

Naming rules that save you later

  1. Match the technical name to the DNS short name.
  2. Do not encode state in names (web-01-old); use tags.
  3. Keep host groups few and purposeful; use tags for extra dimensions.
  4. Document ownership in a tag so an alert tells you whom to call.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which host field must equal the agent's Hostname setting for active checks?

    Active checks identify the host by its technical Host name.
  2. 2. What is a macro value precedence order?

    The most specific definition wins: host, then template, then global.
  3. 3. How many host groups must a host belong to?

    At least one group is required; a host may be in many.
  4. 4. What are host tags best used for?

    Tags are key/value labels inherited by problems.

Summary

  • A host carries interfaces, groups, templates, tags, macros and inventory.
  • Groups are for permissions and scope; tags are for cross-cutting labels.
  • One host can have agent, SNMP, JMX and IPMI interfaces, even several of each.
  • User macros resolve host first, then template, then global.
  • Export and import host configuration to keep it in version control.

Next: Items and item keys