Populating inventory data automatically

Manually populated inventory data is useful, but doing that on a large scale may not be very feasible. Zabbix can also collect some inventory values automatically for us. This is possible because any item can populate any inventory field. We will use one of our existing items and create a new one to automatically populate two inventory fields.

Let's start by adding the new item. Navigate to Configuration | Hosts, switch to Linux servers from the Group drop-down, and click on Items for A test host. Then, click on Create item. Fill in the following values:

  • Name: The full OS name
  • Key: system.uname
  • Type of information: Text
  • Update interval: 300
  • Host inventory field: Software application A

When you're done, click on Add at the bottom.  We now have an item configured to place data in the inventory field, but this alone won't do anything. We have our inventory set to manual mode. From the navigation bar preceding the item list, click on A test host and switch to the Host inventory tab. Then, choose Automatic. Notice how something changed—our field Software application A  here got disabled, and a link appeared to the right of the field:

This is the field we chose during the item configuration earlier. The link shows which item is supposed to populate this field and allows convenient access to the configuration of the item. Note that the field we manually populated earlier, Type, did not lose the value. Actually, the automatic mode can be said to be a hybrid one. Fields that are configured to obtain their values automatically do so; other fields may be populated manually. Click on Update.

Values from items are placed in the inventory whenever an item gets a new value. For the full OS version item, we set the interval to a fairly low one: 300 seconds. The agent item, on the other hand, has a large interval. This means that we might have to wait for a long time before the value appears in that inventory field. To make it happen sooner, restart the agent on A test host.

The inventory field we chose, Software application A, is not very representative, but there is no way of customizing inventory fields at this time. If you have data that does not match existing inventory fields well, you'll have to choose the best fit or just use something not really related to the actual data.

With the item supposed to have the value placed in the Inventory field, let's return to Inventory | Overview and choose Software application A from the Grouping by drop-down. This should display only one host:

  1. Click on 1 in the Host count column, and you should be able to see that, as expected, it is A test host. The column we chose is not listed in the current view, though.
  2. Click on A test host in the Host column and switch to the Details tab.

Here, we can see system information from the system.uname item:

We used both the overview and host pages of the inventory section. The Overview page is useful to see the distribution of hosts by inventory field. The host page allows you to see individual hosts by using the filter at the top-right of the page.

When we ended up on the hosts page, the filter was preset for us to match an exact field value, but we may also search for a substring. For example, if we have systems with OS information containing CentOS 7.5 and CentOS 6.2, we may filter just by CentOS and obtain a list of all the CentOS systems, no matter which exact version they are running:

While being able to access inventory data in the frontend is useful sometimes, faster and easier access might be preferred. It is also possible to include inventory data in notifications. For example, an email could include system location, whom to contact when there's a problem with the system, and some serial numbers, among other things. We will discuss notifications in Chapter 7, Acting upon Monitored Conditions.

If we go to Administration | General | Other (from the drop-down on the right), then we have the option to set the default host inventory mode. This option is only valid for new added hosts. It will not change the default behavior for already existing hosts.
..................Content has been hidden....................

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