Overview
Zabbix client auto-registration allows active agents to initiate contact with the Zabbix server, which then adds these agents to the host inventory. This functionality is particularly valuable for environments with numerous servers, enabling rapid deployment of monitoring across all systems. After installing Zabbix agents on multiple servers and configuring appropriate triggers on the server, the entire monitoring infrastructure can be established quickly.
Configuration
2.1 Agent Configuration
The Zabbix agent must be configured to connect to the server and provide identification information.
Specify Server IP
# cat /etc/zabbix/zabbix_agentd.conf | grep -E ^ServerActive
ServerActive=monitoring.example.com
Set Hostname
If the Hostname parameter is defined in zabbix_agentd.conf, Zabbix will use that value. Otherwise, it will use the system hostname.
# cat /etc/zabbix/zabbix_agentd.conf | grep -E ^Hostname
Hostname=web-server-01
Configure Metadata Item
The HostMetadataItem parameter specifies which item key should be used to determine the host's metadata.
# cat /etc/zabbix/zabbix_agentd.conf | grep -E ^HostMetadataItem
HostMetadataItem=system.uname
2.2 Server-Side Action Configuration
Navigate to Configuration → Actions → Event source (select Auto registration) → Create Action. Follow these steps to define an action:
Action Tab
Define the action name and message subject/content. The default values are typically sufficient.
Conditions Tab
Configure conditions that trigger the action. For example, hosts with metadata containing "Linux" will trigger the operation.
Operations Tab
When an active host meets the conditions, the server will perform these actions:
- Add the agent to the host list
- Add the agent to the Linux servers group
- Link the agent host to the Template OS Linux template
Verification
Check the Zabbix server log file to confirm successful registration:
# tail -f /var/log/zabbix/zabbix_server.log
16585:20231015:141110.910 enabling Zabbix agent checks on host "auto-reg-web-01": host became available
HostMetadataItem and HostMetadata
These parameters help identify and differentiate hosts, enabling specific configurations based on host characteristics.
4.1 HostMetadataItem Usage
This parameter specifies an item key whose value determines the host's metadata.
HostMetadataItem=system.uname
4.2 HostMetadata Usage
This parameter directly defines the host's metadata as a string.
HostMetadata=Production Linux Server
By utilizing various metadata values, you can differentiate hosts and apply specific groupings or templates according to your requirements.
Advanced Configuration
Zabbix 2.2 introduced enhanced metadata functionality, allowing more sophisticated filtering during auto-registration.
Configuration Parameters
The following parameters must be configured in zabbix_agentd.conf:
- HostMetadata: A string (0-255 characters)
- HostMetadataItem: An item key to retrieve metadata (0-255 characters)
# vim /etc/zabbix/zabbix_agentd.conf
HostMetadataItem=system.uname
HostMetadata=production-web-cluster
Web Interface Rules
Configure matching rules in the Zabbix web interface to utilize the metadata values for automatic host grouping and templating.
Benefits of Auto-Registration
The auto-registration feature provides several advantages:
- Rapid discovery and addition of hosts
- Simplified management of large environments
- Quick adaptation to changing infrastructure
Auto-registration works with various discovery information including:
- IP address ranges
- Service availability (FTP, SSH, HTTP, etc.)
- Information from Zabbix agents
- SNMP agent data
Use Cases
Auto-registration is particularly effective in cloud environments where hosts may be distributed across different locations or networks. The active registration approach overcomes limitations of network discovery in such scenarios.
Example: Cloud Environment Deployment
For distributed environments, configure agents with specific metadata to ensure proper grouping and templating:
# Configure agent in cloud environment
ServerActive=cloud-monitoring.example.com
Hostname=cloud-instance-42
HostMetadata=aws-production
HostMetadataItem=system.uname
On the server, create actions that match the "aws-production" metadata to apply appropriate templates and groupings.