Autoinventory

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.

Getting ready

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.

How to do it ...

  1. The first thing we do is go to Configuration | Host then click on the host that we want to configure.
  2. Now click the Host Inventory button and select Automatic from the menu and press Update.
    How to do it ...
  3. Now go to the menu to add a new item on the host or create a new template and create a new item in the template.
  4. Give our item Name the name Mac Address as we are going to get the MAC address from our host.
  5. As Type, we select Zabbix agent.
  6. For the Key we select system.hw.macaddr[] from the list with keys.
  7. Select the correct Host interface.
  8. And select Text as Type of information.
  9. Create a New application for example Inventory.
  10. Now select the Populates host inventory field and select here MAC address A from the list.
  11. Save the item and wait a bit so that our items gets updated.
  12. Now go to the menu Inventory | Hosts and select from the right dropdown, the correct host.
  13. If all went well, you will see the MAC address from your host in Zabbix.
    How to do it ...
  14. Now when you go back to Configuration | Hosts and you click on your host, you will see that in the tab Host inventory, the field MAC address A is populated.

How it works...

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.

There's more...

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.

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

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