Briefly:
Today, consider the active registration function of Zabbix.
When you have 10 machines to monitor, it is no problem to add them manually. But what do you do when you have 50, hundreds, or more servers to monitor?
Active agent Auto-registration is primarily used by agents to actively and automatically register with the Server. It is very good to solve the Agent IP, System, configuration is not uniform and so on.
Ideal for today's cloud environments.
First, the installation Agent
Shell > cd/scripts; Vim Auto_install_zabbix_agent.SH#!/bin/BASHCD/usr/local/src# Download Zabbix agentwgethttp//jaist.dl.sourceforge.net/project/zabbix/zabbix%20latest%20stable/3.0.1/zabbix-3.0.1.tar.gz# InstallZabbix AgentTarZXF zabbix-3.0.1.Tar. GZCD Zabbix-3.0.1./configure--prefix=/usr/local/zabbix_agent--enable-agent; Make Install# configCPmisc/init.d/fedora/core/zabbix_agentd/etc/init.d/sed-I.'s#basedir=/usr/local#basedir=/usr/local/zabbix_agent#'/etc/init.d/Zabbix_agentdEcho 'Zabbix Agent is Install sucessed.'# End
Second, the configuration Agent auto-registration
Shell >grep-vp'^#|^$'/usr/local/zabbix_agent/etc/Zabbix_agentd.conflogfile=/tmp/Zabbix_agentd.log # Specifying log path Server=121.42.11.220# Zabbix Server address in passive mode # startagents=0# Disable Passive mode (disable the agent will not listen to any address, port) serveractive=121.42.11.220# Zabbix Server address in active mode hostname=auto Rserver54.64# Machine identifier (the host name displayed by the Web interface) Hostmetadata=password123456# Active registration conditions, very flexible, you can do as I do this way, two fields exactly match to add a host
Third, start Agent
Shell >grep000.0. 0.0:100500.0. 0.0 7149/zabbix_agentd
Iv. Web front-end configuration
1. Templates
> Configuration--Templates-click Templates OS Linux--Full clone
Template name Template OS Linux Active # with a unique name
ADD # Complete Cloning
> Configuration--and Templates--click Templates OS Linux Active--and Items (also change item to active mode)--Select all and click on the M below The
Type # Tick to change the original Zabbix agent to Zabbix agent (active)
Update # Completed
# # We find that this template is associated with another is template App Zabbix Agent, using the same method to modify!
# # After the modification, you also need to open the changed OS Linux template, Linked template to replace the original passive agent templates, change the active agent template.
2, Auto Registration
> Configuration-----Event source Auto-registration--Create action
Name Auto Registration
Default subject Auto Registration:{host:host}
Default message Host name:{host. HOST}
Host Ip:{host. IP}
Agent Port:{host. PORT}
Conditions (condition)
New condition Host metadata like password # condition one
Add
New condition Host metadata like 123456 # condition Two
Add
Type of calculation and A and B # relationship is and, both conditions must satisfy both
Operations (Operation)
Action Operations New # Start Add action
Operation details operation type Add host # Action one: Add hosts
Add
Operation details operation type link to template # Action two: link template
Templates Template OS Linux Action
Add
Operation details operation type Send message # action three: Send mail
Send to User groups DevOPS
Send only to My_email
Default message√
Add
ADD # all done!
V. Testing
# Save completed, about one or two minutes, the host will automatically register to complete, and will receive mail!
# # Problems encountered!
1. If the Agent shuts down the passive mode completely (Server commented out, startagents is set to 0 # # before comment, must be set to 0 later)
Agent will not listen to any address, port!
The Zabbix Server Web will show that you cannot connect to the Agent. This is because the agent interfaces in the added host has written the agent address, port.
2. Firewall condition: Zabbix Server TCP 10051/zabbix Agent server TCP 10050
3, Host Status: If you can get data, no error, is the color, restart Zabbix Server can
Zabbix Agent Automatic, active registration