Monitoring tool zabbix realizes automatic discovery and automatic registration

Overview
Automatic discovery:
zabbix Server actively discovers all clients, and then registers the clients on their own notebooks. The disadvantages are that zabbix server is under pressure (large network segment, many clients) and time consuming.
Automatic registration:
zabbix agent takes the initiative to report to zabbix Server for registration; disadvantages the agent may not find the Server (configuration error)
Two
modes: Passive mode: the default agent is captured by the server.
Active mode: the agent actively sends data to the server
PS : Both modes are configured on the agent, the use of zabbix should be done in advance in the hosts file to resolve the host name

Automatic discovery- install the agent on the passive mode
client and configure

rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
sed -i.bak 's#repo.zabbix.com#mirrors.aliyun.com/zabbix#g' /etc/yum.repos.d/zabbix.repo
yum clean all && yum makecache
yum install zabbix-agent -y
vim /etc/zabbix/zabbix_agentd.conf
修改如下内容:
ListenPort=10050
Server=192.168.2.3
#ServerActive=192.168.2.3
#Hostname=192.168.2.15

Note:
I set the Hostname in the configuration file through a test, but it is the host name of the host in the WEB view, so it can be judged that the automatic discovery will configure the WEB name according to the host name.
Among them, Server and ServerActive both specify the IP address of zabbix_server. The difference is that the former is passive and the latter is active. In other words, the Server configuration is used to allow the ip of 192.168.2.3 to come to me to fetch data. The 192.168.2.3 of serverActive means that the client actively submits data to him.
Hostname=XXX, the defined name must be the same as the host name in the web page.
If you do not specifically define the Hostname in zabbix_agentd.conf, the server will use the system hostname of the agent to name the host. The hostname of the system in Linux can be obtained by running the hostname command. The last successfully added host name is also the value set by this option.

start up

systemctl start zabbix-agent.service 
netstat -anput | grep 10050
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      35795/zabbix_agentd 
tcp6       0      0 :::10050                :::*                    LISTEN      35795/zabbix_agentd 

WEB interface configuration
web interface: Configuration >> Auto-discovery >> Local network
use the built-in auto-discovery rules (modify) you can
Insert picture description here
enter the ip within the ip range, pay attention to the format; the
delay is larger in the actual production environment (1h -2h), the experimental environment can be smaller than 60s to
Insert picture description here
create discovery actions.
Configuration >> Actions >> Auto discovery. Linux servers.
Insert picture description here
Configure action
Insert picture description here
configuration conditions
Insert picture description here
PS: trigger conditions can be modified according to your own environment, and similar.
Configuration operation
Insert picture description here
Finally, wait for the host to go online.
Insert picture description here

Automatic registration-active mode
Note: first disable the previous automatic discovery

1. Modify zabbix agent configuration file

vim /etc/zabbix/zabbix_agentd.conf
修改如下内容:
ListenPort=10050
Server=192.168.2.3
ServerActive=192.168.2.3	#server端IP
Hostname=192.168.2.15
#HostnameItem=system.uname

HostMetadataItem: host metadata, silent reading is system.uname, which can be obtained and viewed through the zabbix_get command.

When the agent program sends an automatic registration request to the server, it will send its host name. In some cases, the host name of the Zabbix server is not sufficient to distinguish the discovered host. Host metadata can send other information from the agent to the server.
The host metadata is configured in zabbix_agentd.conf. There are two ways to specify host metadata in the configuration file: (the two cannot be used at the same time)

HostMetadataItem:
HostMetadataItem=system.uname

system.uname is used to obtain information including "Linux" or "Windows", depending on the host running the agent.
Examples of host metadata are as follows:

Linux: Linux server3 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2 i686 GNU/Linux
Windows: Windows WIN-0PXGGSTYNHO 6.0.6001 Windows Server 2008 Service Pack 1 
systemctl start zabbix-agent.service 
netstat -anput | grep 10050
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      43332/zabbix_agentd 
tcp6       0      0 :::10050                :::*                    LISTEN      43332/zabbix_agentd 

WEB interface configuration
Insert picture description here
configuration action
Insert picture description here
configuration conditions
Insert picture description here
Insert picture description here
PS: conditions are modified according to their own definition!
The configuration operation
is the operation that needs to be set after the automatically discovered host meets the previous setting conditions, such as adding to a group, linking to a template, and so on.
Insert picture description here
Note
If we set it up, after the above configuration, but find that there is no host registration, we can see if the listening port of our zabbix server or zabbix proxy is open in the firewall (or security group). The default listening port is 10051.
If we can see that the host registration is successful, but the agent's status has not been active, then we can see that the listening port of our zabbix agent is not open in the firewall (or security group). The default listening port is 10050.
Insert picture description here

Guess you like

Origin blog.csdn.net/ZhanBiaoChina/article/details/105700523