Skip to content

Zabbix agent configuration migration

Zabbix agent configuration migration involves updating the zabbix_agentd.conf file and restarting the Zabbix service to point the agent to a new or additional monitoring server.^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md] This process is commonly required when changing monitoring infrastructure or migrating servers, such as moving to a Google Cloud Platform (GCP) environment^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].

Procedure

Backup and modification (Linux)

The standard workflow on Linux systems involves creating a backup of the configuration file, modifying the Server parameter using sed, and verifying the change^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].

  1. Backup: Copy the current configuration file to a timestamped backup^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].
  2. Update IP: Use sed to replace the old server address with the new one or append the new IP to the existing list^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].
  3. Verify: Display the updated configuration line to confirm the change^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].
cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.20180810
sed -i 's/Server=zabbix.mypay1.com/Server=zabbix.mypay1.com,10.140.0.23/g' /etc/zabbix/zabbix_agentd.conf
cat /etc/zabbix/zabbix_agentd.conf | grep mypay

Service restart

After the configuration file is updated, the Zabbix agent service must be restarted to apply the changes^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md]. It is good practice to check the service status immediately after restarting^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].

systemctl restart zabbix-agent.service
systemctl status zabbix-agent.service

Windows environments

For Windows agents, the configuration file (typically C:\Program Files\zabbix_agents\conf\zabbix_agentd.conf) should be updated to include the new server address (e.g., Server=zabbix.mypay1.com,10.140.0.23)^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md].

The service is then restarted using Windows net commands^[600-developer__operation-maintenance__zabbix__zabbix-agentd.md]:

net stop "Zabbix Agent"
net start "Zabbix Agent"
  • DevOps
  • [[Infrastructure as Code]]

Sources

  • 600-developer__operation-maintenance__zabbix__zabbix-agentd.md