Automation after discovery

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.

Getting ready

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.

How to do it...

  1. Go to Configuration | Actions and select Discovery from the Event source dropdown on the top right.
  2. Create a new action by pressing the Create action button on the top right corner.
  3. Now we have to configure our Action. First, we just give our action a Name in the Action tab.
    How to do it...
  4. Then we have to add a condition for our action in the Conditions tab. Here we will add a simple condition that says Discovery status = Discovered.
    How to do it...
  5. In our Operations tab, we have to add the operation we expect Zabbix to perform once the discovery has finished and our conditions were met. Here we keep it simple and tell Zabbix to Add host and click on Update button.
    How to do it...
  6. After some time when you see in the event page that devices are discovered, go to the Hosts tab and you will see some new devices in your host list.
    How to do it...

How it works

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.

There is more…

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.

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

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