# 一 、 Introduction
网络发现
: Zabbix server scans the hosts within the specified network range;
network discovery is one of zabbix's most distinctive functions, it can automatically add monitored hosts or services according to the rules defined by the user in advance
优点
:
- Speed up Zabbix deployment
- Simplify management
- Use Zabbix in a rapidly changing environment without over-management
发现方式
:
Ip address range;
available services (ftp, ssh, http,…)
zabbix_agent response;
snmp_agent response;
Network discovery usually includes two stages: discovery and actions
discovery
:
Zabbix regularly scans the IP range defined in the network discovery rules;actions
: Events in network discovery can trigger actions to automatically perform specified actions, taking discvery events as a prerequisite;
add / remove hosts
enable / disable
hosts add hosts to the group
remove hosts in the group
link the host from the template or cancel link
# 二 、 Configure network discovery Network discovery
### 1. Use the second host for 192.168.246.227 that can be discovered by scanning
#安装agent 段的包
[root@zabbix-agent-none2 ~]# # yum -y install zabbix-agent zabbix-sender
#设置agent 配置,可以把之前设置好的none1的配置传过来
[root@zabbix-agent-none2 ~]# vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.62.135
ServerActive=192.168.62.135
Hostname=zabbix-agent-none2 #只需修改hostname
[root@zabbix-agent-none2 ~]# visudo #修改sudo的配置,添加如下信息
zabbix ALL=(ALL) NOPASSWD: ALL
#开启服务
[root@zabbix-agent-none2 ~]# systemctl start zabbix-agent
### 2. Set automatic discovery rule discovery
configuration-automatic discovery-create automatic discovery rule
ip range should not be too large
Test on zabbix-server
[root@zabbix-server ~]# zabbix_get -s 192.168.246.227 -p 10050 -k "system.uname"
Linux zabbix-agent-none2 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64
Update interval: just set it to 1h, don't scan too frequently, scan the entire network segment, too waste resources; here for experiment, set to 1m
### 3. Auto discovery succeeded
### 4. Set automatic discovery action
create:
Set condition A, automatic discovery rule = test net
Set condition B, auto-discovery status = up
[External chain image transfer failed, the source site may have anti-theft chain mechanism, it is recommended to save the image and upload it directly (img-zieyLnwX-1585730962006) (https: //upload-images.jianshu. io / upload_images / 21294643-823807c18b245dbd.png? imageMogr2 / auto-orient / strip% 7CimageView2 / 2 / w / 1240)]Add host to monitor
Automatically link Template OS Linux to this host
After the configuration action is completed, it is disabled by default. If it is not disabled, you need to choose to start again and activate it.
Enable the action, check the effect
has taken effect, add the host successfully, the template link is successful
If the host you need to add has been scanned and added, you can turn off network scanning because it consumes too much resources