This article continues to introduce zabbix automated monitoring, including zabbix automatic registration, zabbix automatic discovery, and changing the monitoring items that need to be done after the host is added to the server to active. It is not as simple as monitoring, and it also involves zabbix troubleshooting, alarm suppression, link tracking, etc. at a deeper level.
Table of contents
1. Create auto-discovery rules
1. Configure the automatic registration action
2. Restart the server and client
Zabbix monitoring project active
zabbix automatic discovery
The zabbix server automatically discovers surviving servers by scanning the address segment, and automatically performs actions after discovery, adding hosts, associating templates, associating alarms, and other operations.
The disadvantage is that the scanning speed is slow, and the server side of zabbix is under great pressure; all scanned clients can only use the same template. For example, the templates used by the Web and the database are different, and manual configuration is required
1. Create auto-discovery rules
Delete the previous host and add an automatic discovery action
Although it is an action, it cannot be viewed in the action log if it is executed
Restart the zabbix server and the client with IP 172.16.1.7 for testing
[root@Zabbix ~]# systemctl restart zabbix-server.service
[root@Web01 ~]# systemctl restart zabbix-agent.service
Refresh the host list and find that a new host with IP 172.16.1.7 has been added
And you can see the latest data of the host
zabbix automatic registration
The role of zabbix automatic registration is opposite to that of automatic discovery. It actively uploads its own information from the client to the server to reduce the pressure on the server.
1. Configure the automatic registration action
Same as automatic discovery, although it is an action, it cannot be viewed in the action log when it is executed, but if it is associated with an email address, you can see the log of the sending email address
Disable the automatic discovery action first to prevent conflicts with automatic registration
Select the automatic registration action in the upper left corner --> create action
Add action name and condition
add operation
2. Restart the server and client
Add Web02 to the host
[root@Zabbix ~]# systemctl restart zabbix-server.service
[root@Web02 ~]# systemctl restart zabbix-agent.service
3. Refresh the host list
Found successfully registered to the server
You can also check the latest data
The email was also sent successfully
You can see the action log sent by email
Zabbix monitoring project active
Both zabbix automatic discovery and automatic registration add the client to the server, but after adding it, the server needs to continuously monitor the monitoring items and obtain data. We can adjust the monitoring items of the host according to the needs. Active or passive
For example, when there are more than 300 servers, when the network is complex, and when the server configuration is general, we can modify the monitoring item to be active. Next, I will configure the client monitoring item named Web02 as active to reduce service end pressure.
1. Observe the latest data, check the inspection records, you can see that the data is inspected sequentially, because the zabbix server is inspected sequentially.
2. Modify the monitoring item from passive to active, first modify the configuration file
[root@Web02 ~]# cat /etc/zabbix/zabbix_agentd.conf
......
# ServerActive=127.0.0.1
ServerActive=172.16.1.71 # 主动注册服务器地址
......
# Hostname=Zabbix server
Hostname=Web02 # 必须设置为主机名称
[root@Web02 ~]# systemctl restart zabbix-agent.service
3. Modify the template associated with the automatic registration just now
Change template os linux by zabbix agent to template os linux by zabbix agent active, the former is passive monitoring and the latter is active monitoring
After the modification, the host that is actively registered later is active, but the registered host template has not changed. We can delete the host and let it automatically register, or click on the host to relink the new template
Check the latest data again, and find that the inspection records are all at the same point in time, indicating that the mode has been successfully modified to active.
The above is the active template given by the official. As for our own custom monitoring items, we can customize the type when creating
I am koten, with 10 years of experience in operation and maintenance, and I continue to share dry goods in operation and maintenance. Thank you for your reading and attention!