Zabbix Agent automatic and active registration
Brief description:
Let's take a look at the active registration function of Zabbix today.
When you have ten machines to monitor, you can add them manually. But what do you do when you have 50, hundreds, or more servers to monitor?
Active Agent Auto-Registration is mainly used for Active agents and automatic Registration with the Server. The problem of inconsistent Agent IP addresses, systems, and configurations is well solved.
Suitable for the current cloud environment.
1. Install the Agent
Shell> cd/scripts; vim auto_install_zabbix_agent.sh
#! /Bin/bash
Cd/usr/local/src
# Download zabbix agent
Wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz
# Install zabbix agent
Tar zxf zabbix-3.0.1.tar.gz
Cd zabbix-3.0.1
./Configure -- prefix =/usr/local/zabbix_agent -- enable-agent; make install
# Config
Cp misc/init. d/Fedora/core/zabbix_agentd/etc/init. d/
Sed-I's # BASEDIR =/usr/local/zabbix_agent # '/etc/init. d/zabbix_agentd
Echo 'zabbix Agent is Install sucessed .'
# End
Ii. Configure Agent auto-Registration
Shell> grep-vP '^ # | ^ $'/usr/local/zabbix_agent/etc/zabbix_agentd.conf
LogFile =/tmp/zabbix_agentd.log # specify the Log Path
Server = 121.42.11.220 # Zabbix Server address in passive mode
# StartAgents = 0 # disable the passive mode (after the prohibition, the agent will not listen to any address or port)
ServerActive = 121.42.11.220 # Zabbix Server address in Active Mode
Hostname = Auto RServer 54.64 # machine ID (host name displayed on the Web interface)
HostMetadata = password 123456 # active registration conditions are flexible. You can use this method just like me. Only when the two fields match completely can the host be added.
3. Start the Agent
Shell> service zabbix_agentd start
Shell> netstat-lnpt | grep zabbix_agent
Tcp 0 0 0.0.0.0: 10050 0.0.0.0: * LISTEN 7149/zabbix_agentd
Iv. Web Front-end Configuration
1. Template
> Configuration --> Templates --> click Templates OS Linux --> Full clone (Full clone)
Template name Template OS Linux Active # a unique name
Add # complete cloning
> Configuration --> Templates --> click Templates OS Linux Active --> Items (also change item to Active mode) --> select all and click the following Mass update
Type # check box to change the original Zabbix agent to Zabbix agent (active)
Update # complete
# We found that another Template App Zabbix Agent is associated with this Template. Use the same method to modify it!
# After modification, you also need to open the modified OS Linux template. Linked template replaces the original passive Agent template with the changed active Agent template.
2. Auto Registration
> Configuration --> Actions --> (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)
New condition Host metadata like password # condition 1
Add
New condition Host metadata like 123456 # condition 2
Add
Type of calculation And A and B # The relationship is And, And both conditions must be met at the same time
Operations)
Action operations New # Start adding operation
Operation details Operation type Add host # Operation 1: Add a host
Add
Operation details Operation type Link to template # Operation 2: Link template
Templates Template OS Linux Action
Add
Operation details Operation type Send message # Operation 3: Send an email
Send to User groups DevOPS
Send only to My_Email
Default message √
Add
Add # All completed!
V. Test
# After saving, the host automatically registers and receives an email in about one or two minutes!
# Problems!
1. If the active mode is completely disabled by the Agent (comment out the Server, set StartAgents to 0 ## comment out the previous mode, and set StartAgents to 0)
The Agent does not listen to any address or port!
The Zabbix Server Web displays that the Agent cannot be connected. This is because the Agent address and port are written in the Agent interfaces in the added host.
2. Firewall: Zabbix Server TCP 10051/Zabbix Agent Server TCP 10050
3. Host status: if the data can be obtained, no error is reported, that is, the color remains unchanged. Restart Zabbix Server.
Some Zabbix Tutorials:
Compile and install Zabbix2.4.5 source code in Ubuntu 14.04
Install and deploy the distributed monitoring system Zabbix 2.06
Install and deploy the distributed monitoring system Zabbix 2.06
Install and deploy Zabbix in CentOS 6.3
Zabbix distributed monitoring system practice
Under CentOS 6.3, Zabbix monitors apache server-status
Monitoring MySQL database Parameters Using Zabbix in CentOS 6.3
Install Zabbix 2.0.6 in 64-bit CentOS 6.2
ZABBIX details: click here
ZABBIX: click here
This article permanently updates the link address: