Zabbix automatic monitoring --- automatic discovery mechanism (22)

Automatic discovery of zabbix automatic monitoring

1. Introduction to Auto Discovery

It is very convenient to use automatic discovery when we have thousands of hosts that need to be monitored. We only need to create an automatic discovery rule and set the scope of automatic discovery. According to the set action, the Linux server with the agent can be installed. Automatically added to monitoring

Note: The automatically discovered host must have zabbix-agent installed in advance, so the automatic discovery action is based on the output of the system.uname monitoring item as a judgment, and the system.uname monitoring item is to check whether zabbix-agent is installed

Installing zabbix-agent will output:

[root@zabbix-server ~]# zabbix_get -s 192.168.81.220 -k system.uname
Linux 192_168_81_220 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64

If zabbix-agent is not installed, it will output:

[root@zabbix-server ~]# zabbix_get -s 192.168.81.250 -k system.uname
zabbix_get [28088]: Get value error: cannot connect to [[192.168.81.250]:10050]: [113] No route to host

The basic operation is

​ 1. Install zabbix-agent and configure

​ 2. Create automatic discovery rules

​ 3. Set the automatic discovery action

2. Install zabbix-agent on the controlled host

[root@192 ~]# yum localinstall zabbix-agent-4.0.24-1.el7.x86_64.rpm -y
[root@192 ~]# vim /etc/zabbix/zabbix_agentd.conf 
Server=192.168.81.210
[root@192 ~]# systemctl start zabbix-agent

3. Configure zabbix automatic discovery

3.1. Create automatic discovery rules

Configuration-automatic discovery-create automatic discovery-fill in the information-add

Name: 192.168.81.0

Automatically discovered by agent agent: no agent agent

ip range: 192.168.81.1-254

Add a new check:

​ Check type: zabbix client

​ Port range: 10050

​ Key value: system.uname

Device uniqueness rule: ip address

Insert picture description here

3.2. Create action

Used to automatically discover the host and add it to zabbix

Configuration-Action-Event source selection automatic discovery

Insert picture description here

Click on an existing action

The "received value contains Linux " here is the value obtained by the monitoring item system.uname for filtering

Insert picture description here

Click to enter and then click to add operation instructions, there is no need to change the action

Insert picture description here

Finally click to enable

Insert picture description here

4. Speed ​​up zabbixserver

[root@zabbix-server ~]# systemctl restart zabbix-server

5. Check whether the host has been discovered by automatic discovery

Click to monitor-automatic discovery

You can see that the host has been monitored
Insert picture description here

Just wait for the host to turn green

Insert picture description here

6. Automatic discovery is successful

You can see that when the host is automatically discovered, it will add hosts and link templates according to the actions we configured
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44953658/article/details/115369149