Low-level discovery

In Zabbix, another way to automate is to make use of low-level discovery. This way Zabbix can automatically create items, triggers, and graphs. At the moment, there are four types in Zabbix that can be discovered out of the box. Zabbix is able to discover filesystems, network interfaces, CPUs, cores, and SNMP OIDs.

Getting ready

For this recipe, we will need our Zabbix server and a Zabbix linux host. The Zabbix host just needs to be properly installed and added to the Zabbix server, but without any templates linked to the hst. On the Zabbix server we need administrator rights.

How to do it ...

  1. The first thing to do is to go to Configuration | Hosts or Templates | Discovery rules.
  2. Click on the Create discovery rule button on the upper right.
  3. Add a Name for our rule: Mounted File System Discovery.
  4. Select the Type Zabbix agent (active).
  5. Add the Key; in this case, the key is vfs.fs.discovery.
  6. Select an Update interval 60 (in production, this could be once a day or an hour).
  7. In the Filters tab, add the Macro {#FSTYPE} with Regular expression @File systems for discovery. (We explain this later in How it works):
    How to do it ...
  8. Add a nice Description and press the Add button in the Discovery rule tab.
  9. Once you update all the details, click on the Update button which saves your changes. Now we can create an item by clicking on Item prototypes:
    How to do it ...
  10. Click on the Create item prototype button.
  11. Add a Name for the Item prototype.
  12. Select a Type: Zabbix agent (active).
  13. Add a Key, in our case, this is vfs.fs.size[{#FSNAME},pfree].
  14. Add the Type of information: Numeric (float).
  15. Add the Unit: in %.
  16. Add a Description and press the Add button.
    How to do it ...
  17. Now, if we wait a bit and go to Monitoring | Latest data, we will see that Zabbix has detected the filesystems on our host and the percentage free space on those filesystems.
    How to do it ...

How it works

The first thing we did was create a discovery rule to tell Zabbix what to discover. This could be a filesystem, network interface, CPU, CPU cores, or an SNMP device. In our case, it was a filesystem.

We added a filter. This filter was already defined in Zabbix so we just had to point to this filter. Filters can be made by making use of regular expressions. You can check out the filter we have used under Administration | General | Regular expressions.

There are already some filters defined for filesystems, network interfaces, and SNMP storage devices. Once our discovery rule was defined and our filter was added we made an item prototype. An item prototype will tell Zabbix what items it has to discover. In our item prototype, we made use of the macro {#FSNAME} in our key instead of the name of our filesystem. For example: /, /usr, /var, and so on.

There's more…

Once an item is not discovered anymore, it will receive an orange indication with an exclamation mark in the items list. When you hover your mouse over, it will show you how much time is left before the item will be removed from the items list. This time can be set in the option Keep lost resources period (in days) in the general Discovery rule.

There's more…

Since Zabbix 2.4, it is possible to add more than one filter. Earlier, one could add just one filter in a low-level discovery rule.

A user can also define his or her own types of discovery. For this to work, you have to follow a particular JSON protocol. More information with examples on how to do this can be found in the Zabbix documentation.

..................Content has been hidden....................

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