After we have done some discovery of our devices on the network, it's time to do something with our discovered items. In this recipe, we will show you how to create some devices in Zabbix after we have discovered them.
For this recipe to work, we need our Zabbix server with already configured network discovery such as in the previous recipe, Configuring network discovery. And of course, we also need a device that can be discovered on our network. For this recipe, it's ok if we can ping our device.
Discovery status = Discovered
.In our Actions tab, we have defined a new action for the event source Discovery. Zabbix presented us 3 different tabs. In the first tab, we only filled the name of our action but we can do more. We can tell Zabbix to inform us by mail when an action was launched and for this, we can make use of the Default message box and Default subject box to inform us with the details we want to know. Look in the See also section for a URL that points to the list of macros that can be used.
The next tab that we had to fill in was the Conditions tab, where we have defined the condition Zabbix had to check before doing our operation. Our condition here was to look if the device was discovered. More complex things can be done here. We can look, for example, for devices in certain IP ranges or for certain kernel versions or only for devices that have FTP or SNMP ports enabled. It's a good practice in general to look for a certain uptime or downtime before adding to or removing a device from Zabbix.
In the Operations tab, we have told Zabbix what to do once the device was discovered and in the example we have told Zabbix to add the host. Once again more complex things can be done here, such as sending a message, linking it to a template, removing a host or even launching a custom script, and so on.
Make sure that the network discovery is properly configured and still on DISABLED
. This is very important because our registration will only work once an event is created. It's better to configure all the actions and then enable network discovery, else you will have to wait till new events are created.