Besides monitoring values to see if something goes wrong, Zabbix has another nice feature. It is possible to gather certain information of your hardware and use this to create some inventory in Zabbix. Knowing we have an API in Zabbix, it can be used to populate our Configuration Management Database (CMDB) later.
Make sure you have your Zabbix server up and running with super administrator rights. We can do this recipe with only the Zabbix server added as host; having said that, it won't hurt if you add a extra host to monitor the inventory from this machine.
Mac Address
as we are going to get the MAC address from our host.Zabbix agent
.system.hw.macaddr[]
from the list with keys.Text
as Type of information.Inventory
.MAC address A
from the list.MAC address A
is populated.To get our inventory fields populated, we need to create items on our hosts. Those items have to be linked to fields from our inventory. Once the items are detected the data will be put in the inventory fields from our host. It's good practice to create a specific template to detect certain information that you need and apply the template to all your hosts.
Be careful, not all items work on all operating systems. For instance, it is at times possible that one item works on Fedora and not on Ubuntu, example, OS short name. It is also possible to make use of macros in the reporting. A full list of macros can be found here:
https://www.zabbix.com/documentation/2.4/manual/appendix/macros/supported_by_location.
We could make use of the macros {INVENTORY.LOCATION<1-9>}
and {INVENTORY.CONTACT<1-9>}
to get notified in case of issues with the location and the contact person for this server.