Hosts and host groups

A host can be considered a basic grouping unit in Zabbix configuration. As you might remember, hosts are used to group items, which in turn are basic data-acquiring structures. Each host can have any number of items assigned, spanning all item types—Zabbix agents, simple checks, Simple Network Management Protocol (SNMP), Intelligent Platform Management Interface (IPMI), and so on. An item can't exist on its own, so hosts are mandatory.

Zabbix does not allow a host to be left alone, that is, to not belong to any group. Let's look at what host groups we currently have defined—from the frontend, open Configuration | Host groups, as shown in the following screenshot:

The first thing that should catch your eye is that the Templates group seems to have a large number of templates already. These are provided as examples so that you can quickly refer to them later for some hints on items. We'll ignore these for now. We can also see an empty Discovered hosts group and the Zabbix servers group, which contains a single example host. The interesting part is in the first half of the table—we can see both groups we used along the way, with all the corresponding members. This table is fairly simple, with just a group name, a count of the number of group members (individually denoting hosts and templates contained in the group), and individual members being listed.

As you will see, individual members are color-coded, and use the following convention:

  • Green: Normal, enabled host
  • Red: Normal, disabled host
  • Gray: Template

As you will see, some of the groups have / in their name, such as, for example, Templates/Applications. This is the new way of allowing the creation of subgroups in Zabbix. So, when you would like to create a host in a sub-group, it is possible to do so by just adding a / in the name.

Let's create another host group and assign some hosts to it:

  1. Click on the Create host group button.
  2. Enter Linux servers/Test group. This will allow you to create a host group nested in the Linux servers group with the name Test group. Let's also create a Linux servers/SNMP group. As you can see, there is a box that allows you to apply permissions and tags to all subgroups. This box can be helpful if you would like sub-groups to inherit the permissions from the host group.
  3. Now, we will add our another host and our test host to the group Linux servers/Test group and our snmptrap host to the group Linux servers/SNMP group by going to Configuration | Hosts followed by <our host>.
  1. In the Groups box, we can now type the name of our new group, or we can select it with the Select button.
  2. Next, we click Update. For the snmptrap host, we remove the Linux servers group by clicking on the x just after the name of the group, so that it only belongs to Linux servers/SNMP group:

You have probably guessed by now that a host can belong to any number of groups or subgroups. This allows you to choose groupings based on any arbitrary decision, such as having a single host in groups called Linux servers, Europe servers, and DB servers.

Now, we are back in the host list, so return to the host group list by navigating to Configuration | Host groups. The group Linux servers/Test group contains two hosts, as it should, and Linux servers/SNMP group only contains our host, snmptrap. Let's say you want to disable a whole group of hosts, or even several host groups. Perhaps you have a group of hosts that are retired but that you don't want to delete just yet, or maybe you want to disable hosts that were created for testing when creating an actual production configuration on the Zabbix server. The group listing provides an easy way to do that—mark the checkboxes next to Linux servers/SNMP group, click on the Disable hosts button at the bottom of the list, and confirm the popup.

After this operation, all green hosts should be gone—they should be red now, indicating that they are in a disabled state:

After doing this, you should remember that snmptrap is a generic SNMP trap-receiving host, which probably should be left enabled. Click on it to open the host details editing page.

While you have the host details page open, you can take a quick look at the Interface section. As you can see, there are four different interface types available. For each of them, a single IP and DNS field is available, along with connect to controls, which are used for checks that are initiated from the server side. We've already used agent and SNMP interfaces. We will also use IPMI and JMX interfaces when configuring monitoring using those protocols.

Mark the Enabled checkbox and click on Update.

You should now see a host list with a status that shows in green, Enabled, per host. By clicking on the Enabled status, we can disable/enable each host individually.

 Finally, we are back to having all the hosts enabled again. Zabbix has four methods to change the state of a host. Let's have a look at them:

  • Changing the state for the whole group in the Configuration | Host groups area
  • Changing the state for a single host using the Enabled checkbox in that host's properties page
  • Changing the state for a single host using controls for each host in the Status column in the host configuration list
  • Changing the state for a single host or multiple hosts by marking the relevant checkboxes in the host configuration list and using the enable and disable buttons at the bottom of the list

We created the previous host group by going through the group configuration screen. As you might remember, another way to do this is to use the New group field when creating or editing a host—this creates the group and simultaneously adds the host to that group.

The host list on the configuration screen is also useful in another way. It provides a nice, quick way of seeing which hosts are down. While the monitoring section gives us quite extensive information on the state of specific services and the conditions of each device, sometimes you will want a quick peek at the device status, for example, to determine the availability of all the devices in a particular group, such as printers, routers, or switches. The configuration provides this information in a list that contains almost no other information to distract you. If we were to now select all from the Group drop-down, we would see all the hosts this installation has:

This time, we are interested in two columns—Status and Availability. The Availability column shows the internal state, as determined by Zabbix, for each host and polled item type. If Zabbix tries to get data from a host but fails, the availability of that host for this specific type of information is determined to be absent. Both the availability status and error message are preserved for the following four separate types of items, which are polled by the Zabbix server:

  • Zabbix agent (passive)
  • SNMP
  • JMX
  • IPMI

Error messages are preserved for each interface and are calculated by the Zabbix server internally. Error messages are shown when you move your mouse over the red icon. Here, we have an overview of all the different possible statuses in Zabbix:

  • Green—available
  • Red—not available (error shown when the mouse is moved over the red icon)
  • Gray—unknown or not configured:

Remember that the availability icon in the host list represents passive Zabbix agent items only—active items do not affect it at all. If a host has active items only, this icon will remain gray. If you add passive items that fail and then convert them all to active items, the icon should revert to gray. This is an improvement in Zabbix that has been around since version 3.0. In previous versions, the icon would remain red throughout and you had to reset it in the database manually.

The Zabbix server will set the icon to grey in the following situations:

  • There are no enabled items on the interface
  • The host is set to be monitored by a proxy, a different proxy, or by a server (until Zabbix is updated and the host is checked again for availability, the icon will remain grey)
  • The host is monitored by a proxy that is offline
  • When our host is disabled

Availability information is aimed more at Zabbix administrators—it shows problems related to gathering data from a host, not information such as resource usage, process status, or performance metrics.

That just about wraps it up for host and host group management in Zabbix. The usefulness of host groups extends a bit past frontend management, though we'll see how exactly later in this chapter when we talk about permissions.

With older versions of Zabbix, it was possible to add hosts to the host group when creating it. In Zabbix 4.0, this option has been removed, as selection boxes were removed in 4.0. Let's hope that this functionality comes back in another way. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.204.140