- #5 Real life scenario
Suppose we would like to set up network discovery for local network having IP range of 192.168.1.1-192.168.1.255. In our scenario we want to:
- discover those hosts that have Zabbix Agent running
- run discovery every 10 minutes
- add host to monitoring if host uptime is more than 1 hour
- remove hosts if host downtime is more than 24 hours
- use Template_Windows for Windows hosts
- use Template_Linux for Linux hosts
- add Linux hosts to "Linux servers" group
- add Windows hosts to "Windows servers" group
Step 1
Define a network discovery rule for our IP range (Configuration → Discovery → Create rule button)

Zabbix will try to discover hosts in IP range of 192.168.1.1-192.168.1.255 by connecting to Zabbix Agents and getting value from system.uname key. A value received from an agent can be used to apply different actions for different operating systems. For example, link Windows servers to Template_Windows, Linux servers to Template_Linux.
The rule will be executed every 10 minutes (600 seconds).
When the rule is added, Zabbix will automatically start discovery and generation of discovery-based events for further processing.
Step 2
Define an action for adding newly-discovered Linux servers to the respective group/template. (Configuration → Actions → Create Action button)

The action will be activated if:
- "Zabbix agent" service is "Up"
- value of system.uname (the Zabbix Agent's key we used in rule definition) contains "Linux"
- Uptime is more than 1 hour (3600 seconds)
The action will execute the following operations:
- add the newly discovered host to "Linux servers" group (also add host if it wasn't added previously)
- link host to "Template_Linux" template. Zabbix will automatically start monitoring the host using items and triggers from "Template_Linux".
Step 3
Define an action for adding newly-discovered Windows servers to the respective group/template.

Step 4
Define an action for removing lost servers.

A server will be removed if "Zabbix agent" service is "Down" for more than 24 hours (86400 seconds).