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.
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.
Mounted File System Discovery
.Zabbix agent (active)
.vfs.fs.discovery
.60
(in production, this could be once a day or an hour).{#FSTYPE}
with Regular expression @File systems for discovery
. (We explain this later in How it works):Zabbix agent (active)
.vfs.fs.size[{#FSNAME},pfree]
.Numeric (float)
.%
.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.
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.
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.
3.17.186.247