Upgrade Zabbix Agent to Agent 2
Posted October 2, 2024
By Kevin Schwickrath2 min read
Out with the old, in with the new. Memory-safe is all the rage. Let’s upgrade to Zabbix Agent 2 with “Go Technology!” *some parts in C
Agent 2 is a new generation of agent that is a drop-in replacement (mostly) for Zabbix Agent with additional functionality via plugins.
Benefits:
- Reduced number of TCP connections
- Provides improved concurrency, including executing checks from different plugins
- Extendible with plugins
- Written in the Go language
- Support for all the cool operating systems
The following details how to convert from Agent to Agent 2 with Ubuntu 24.04. I’m removing Zabbix Agent 6.4 and installing Zabbix Agent 2 7.0 (current). If you simply want to install Zabbix Agent 2, skip the parts you don’t need.
Uninstall the old version
Stop the process and remove the old agent.
sudo systemctl stop zabbix-agent
sudo apt remove zabbix-agentInstall the latest repo
Remove old repo with the following command.
sudo rm -Rf /etc/apt/sources.list.d/zabbix.listDownload, install, and update your package manager with the new repo data.
You can find the latest version of pre-compiled Zabbix Agent binaries here (Windows for example) or, if installing from a repo, here. Simply select what you’re putting the agent on from the menu.
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_7.0-2+ubuntu24.04_all.deb
sudo apt-get updateInstall Zabbix Agent 2
sudo apt install zabbix-agent2Note: If you need plugins add `zabbix-agent2-plugin-*’ to install them.
Setup PSK
Create a key with the following command (or reuse the old one, or skip PSK things altogether).
openssl rand -hex 512Paste the key into the secret file (or reuse the old one).
sudo vi /etc/zabbix/secret.pskChange permissions on the secret file
sudo chown zabbix:zabbix /etc/zabbix/secret.psksudo chmod 640 /etc/zabbix/secret.pskRemember to set the PSK and PSK Identity in the host within the server web interface.
Update the config file
I usually set some of the following items in the config file. Edit the config file with vi or whatever you prefer to use.
sudo vi /etc/zabbix/zabbix_agent2.conf
# For agent checks - use a FQDN or IP addressServer=zabbix.myexample.tld,10.0.0.1
# For active checks or auto registrationServerActive=zabbix.myexample.tld,10.0.0.1
# Hostname Zabbix will use. This MUST match what you configure on the server. Auto registration will also use this.Hostname=host.myexample.tld
# Pick oneHostMetadata=Linux ServersHostMetadata=Windows Servers
# Add some TLS linesTLSConnect=pskTLSAccept=pskTLSPSKFile=/etc/zabbix/secret.pskTLSPSKIdentity=ZabbixKey1Start Agent 2 and enable startup
sudo systemctl restart zabbix-agent2
sudo systemctl enable zabbix-agent2Check logs for errors
sudo tail -f /var/log/zabbix/zabbix_agent2.logHave fun!
Sources / Linkage
This post is licensed under CC BY 4.0 by the author.
Related Posts
Quick and simple monitoring for 2017 MSSQL server with Zabbix 7.0
Quick and simple guide for monitoring a 2017 MSSQL server with Zabbix 7.0 (current). Most of the documentation, blog posts, and forums I found on this…
VyOS High CPU Utilization with SNMP checks via Zabbix
I was working with VyOS 1.2 and 1.3 routers in a lab test. I wanted to wanted to monitor the underlying Linux/Debian objects and various routing process…
Install Zabbix Agent on Ubuntu 20.04
I'm running Zabbix 6.0 through my lab at the moment. To properly test, I'd also like to install the latest Zabbix agent on my test servers.