Post

Upgrade Zabbix Agent to Agent 2

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.

1
2
3
sudo systemctl stop zabbix-agent

sudo apt remove zabbix-agent

Install the latest repo

Remove old repo with the following command.

1
sudo rm -Rf /etc/apt/sources.list.d/zabbix.list

Download, 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.

1
2
3
4
5
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 update

Install Zabbix Agent 2

1
sudo apt install zabbix-agent2

Note: 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).

1
openssl rand -hex 512

Paste the key into the secret file (or reuse the old one).

1
sudo vi /etc/zabbix/secret.psk

Change permissions on the secret file

1
2
sudo chown zabbix:zabbix /etc/zabbix/secret.psk
sudo chmod 640 /etc/zabbix/secret.psk

Remember 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sudo vi /etc/zabbix/zabbix_agent2.conf

# For agent checks - use a FQDN or IP address
Server=zabbix.myexample.tld,10.0.0.1

# For active checks or auto registration
ServerActive=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 one
HostMetadata=Linux Servers
HostMetadata=Windows Servers

# Add some TLS lines
TLSConnect=psk
TLSAccept=psk
TLSPSKFile=/etc/zabbix/secret.psk
TLSPSKIdentity=ZabbixKey1

Start Agent 2 and enable startup

1
2
3
sudo systemctl restart zabbix-agent2

sudo systemctl enable zabbix-agent2

Check logs for errors

1
sudo tail -f /var/log/zabbix/zabbix_agent2.log

Have fun!

Sources / Linkage

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.

© Kevin Schwickrath. Some rights reserved.

Using the Chirpy theme for Jekyll.