How to Implement the active registration function of Zabbix to implement zabbix
Active Agent Auto-Registration. As the name suggests, you do not need to manually add host information on Zabbix Web to monitor hosts.
It is automatically registered with the Server by the Agent.
Compared with another similar function-network discovery, it does not need to know the IP address segment and operating system version information of the Agent, and is more flexible to use.
Create an automatic registration rule
Configuration-> Actions-> Create action-> Auto registration
Configure Action
Enter the Action name
Set Conditions
There are three types of New condition.
1. Host metadata
2. Host name
3. Proxy
Host metadata is a new feature of Zabbix 2.2. in earlier versions, only the Host name and Proxy options are available,
The Host name determines the Hostname value in the Agent configuration file.
The Proxy name must be specified.
The actual production environment does not meet the requirements, because sometimes the Host Name of the server is not regular, such as in the cloud environment.
Host metadata provides a solution for this scenario,
It provides two configuration parameters in the Agent configuration file.
HostMetadata and HostMetadataItem
### Option: HostMetadata# Optional parameter that defines host metadata.# Host metadata is used at host auto-registration process.# An agent will issue an error and not start if the value is over limit of 255 characters.# If not defined, value will be acquired from HostMetadataItem.## Mandatory: no# Range: 0-255 characters# Default:# HostMetadata=### Option: HostMetadataItem# Optional parameter that defines an item used for getting host metadata.# Host metadata is used at host auto-registration process.# During an auto-registration request an agent will log a warning message if# the value returned by specified item is over limit of 255 characters.# This option is only used when HostMetadata is not defined.## Mandatory: no# Default:# HostMetadataItem=
Where
HostMetadata is manually specified to define the metadata of the host, which is similar to the description.
For example, HostMetadata = Linux
HostMetadataItem must be set to item, which is usually set to system. uname.
The returned values of system. uanme are as follows:
# zabbix_get -s node1 -k system.unameLinux node1 2.6.32-573.el6.x86_64 #1 SMP Wed Jul 1 18:23:37 EDT 2015 x86_64
Set Operations
Here, you can perform the following operations:
Send message
Remote command
Add host
Add to host group
Link to template
Disable host
Here, I have set the following operations:
Add host, Link to template, Send message
Modify zabbix client configuration file
[Root @ node2 ~] # Vim/etc/zabbix/zabbix_agentd.conf
Configure the following two options:
ServerActive=192.168.244.30HostMetadataItem=system.uname
Start zabbix Client
[Root @ node2 ~] # Service zabbix-agent start
Verify that node2 is automatically registered
1. The most intuitive is to view Configuration-> Hosts
, Node2 has been added successfully.
2. Because I added the Send message operation when setting Operations (similar to using a script to generate an alarm), you can use Administration> Audit> Actions to check whether the host is automatically registered successfully.
3. If it is not successfully added, locate it based on the error logs of Zabbix Server and Agent.