install zabbix on raspberry pi

DIY Monitoring Solution: Installing Zabbix on Raspberry Pi

Zabbix is a unified monitoring solution for your network, servers, and applications. There is a free version, and the Raspberry Pi is officially supported (which is pretty rare for that kind of enterprise-focused application). Let’s see how to install it on your device.

Zabbix requires a heavy setup (web server, database server, monitoring agent, and interface), but can be installed on Raspberry Pi OS with a few command lines. A package is available on the official website for all architectures.

Even if the Raspberry Pi is supported, it doesn’t mean it’s easy to set up, so let me guide you step-by-step to get it running on your Pi in a few minutes. I’ll also show you how to configure it and start using it once installed.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

Prerequisites to install Zabbix on Raspberry Pi

Hardware requirements

There are no mandatory requirements in terms of hardware to use Zabbix on Raspberry Pi, but there are many services required to make it work, so using a Raspberry Pi 4 for this project is recommended.

A wired network connection is also recommended for more stability (you can’t build a decent network monitoring project if the Wi-Fi is disconnected regularly).

Warning: current prices are all over the place for a new Raspberry Pi. Make sure to check this article to pay the right price when buying a Raspberry Pi. I also give a few tips to find one in stock (which currently isn’t that easy).

Software prerequisites

Here are the prerequisites in terms of software before installing Zabbix:

  • Operating system: Raspberry Pi OS is officially supported and is still the best choice for the Raspberry Pi system, so I would use it if possible. Zabbix Server is only listed for the Bullseye edition on the official website, so it’s probably better to use it.
    You can read my guide on how to install Raspberry Pi OS here if you need some guidance.
  • Up-to-date system: You’ll need to install many packages. To avoid any conflict later on, make sure your system is up-to-date first. You can do this with these commands:
    sudo apt update
    sudo apt upgrade -y

    Reboot the Raspberry Pi after the installation if there are a lot of updates available.
  • Database server installed: MySQL and PostgreSQL are supported. Pick the one you prefer, but you need to install the server first. Don’t go any further before making sure it’s running and with a root password set.
    You can read my MySQL server installation guide here for more details (MariaDB).

For your information, I tested this tutorial on my Raspberry Pi 4, with the Lite edition of Raspberry Pi OS Bullseye (64-bits), MySQL (MariaDB), and Apache.

Note: If you run Ubuntu on your Raspberry Pi, you should probably check this tutorial instead: Installing Zabbix on Ubuntu Server: A Step-by-step Guide

Install Zabbix on Raspberry Pi

Here are the main steps to install Zabbix on a Raspberry Pi:

  • Add the Zabbix repository to the package manager.
  • Download and install the Zabbix packages with APT.
  • Create the database and user for Zabbix.
  • Edit the Zabbix configuration and restart the services.

I’ll now explain each step in detail.

Use the website for up-to-date instructions

To be honest, Zabbix has pretty good documentation, and also something that’s pretty rare, Raspberry Pi OS is included, which is perfect for us.

When you go to the download page, you’ll see a menu that looks like this:

By picking your architecture from each column, you’ll get customized instructions for your setup:

There are a few things missing, so I’ll give you the exact commands I used, but it’s probably a good idea to check their page for updated command lines (like if there is a new version available, it will be updated on the Zabbix website, not here).

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Add the Zabbix repository to your system

The first step is to add the Zabbix repository to your system. It means your package manager (APT) will be connected to the Zabbix server, so it can access their packages directly.

Zabbix have made this simple, with a “.deb” package available that you can download and install with:
wget https://repo.zabbix.com/zabbix/6.4/raspbian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian11_all.deb
sudo dpkg -i zabbix-release_6.4-1+debian11_all.deb

I’m testing version 6.4, but make sure to check their website for the latest one available.

Once the package is installed, we need to sync the package lists with this command:
sudo apt update

As you can see in this screenshot, in addition to checking packages on the Debian servers, we are now also connected to the Zabbix repositories.

Install Zabbix packages

The next step is to install the Zabbix packages for your server. This command will be different depending on which web server and database server you are using.

If you decided to use Apache and MariaDB (MySQL) like me, you can copy and paste this command:
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

In other cases, get the command from the official documentation, and make sure to add “sudo” at the beginning (instructions are written for Debian with root access I think).

All dependencies will be installed automatically if needed (Apache server and MySQL client if you don’t have it yet, for example).

Setting up the Zabbix database

Zabbix uses a database to store all the data and most of the configuration. Before proceeding further, we need to manually create the database and establish a specific user with all privileges.

I’ll give you the instructions for a MySQL server but it will be slightly different with PostgreSQL.

You need the MySQL server already set up with an administrator login and password to continue. If you haven’t done it yet, you can follow this tutorial first, and come back here after doing it.

Create the database and user

Connect to the MySQL server console with:
mysql -uroot -p
Enter the root password and you’ll get access to the MariaDB monitor, where you can type all the following commands.

Here are the commands you can copy and paste to create the database and the Zabbix user for MySQL:
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbix@localhost identified by 'password';
grant all privileges on zabbix.* to zabbix@localhost;
set global log_bin_trust_function_creators = 1;
quit;

Just replace the password with something stronger when you execute the commands.
If everything goes well, you should get something like this:

Initialization

We’ve created an empty database, we’ll now use the SQL script from the Zabbix installation directory to initialize it (creating tables and filling them with the minimal data required).

Here’s the command you can run for this:
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Enter the password for the Zabbix user (the one you just created), and wait a few seconds. The “server.sql.gz” file is basically a text file with a ton of SQL queries, that will do everything for you. We simply send them to the “mysql” command, to execute them.

Once done, we can reset the log_bin_trust_function_creators flag we changed earlier. We don’t need it any more. Connect to the MariaDB monitor once again:
mysql -uroot -p
Enter the root password (not the same as the Zabbix user), and then this:
set global log_bin_trust_function_creators = 0;
quit;

Adjust Zabbix server configuration

The last thing we need to do to complete the server configuration is to tell Zabbix the MySQL password. You can edit the server configuration file with:
sudo nano /etc/zabbix/zabbix_server.conf

Find the paragraph about “DBPassword” (you can use CTRL+W to do a search with Nano).
Then add this line:
DBPassword=password

Replace “password” with the password you set for the MySQL user you created for Zabbix.

Restart services

That’s it, the Zabbix server is installed and configured, we just need to restart the services to apply the changes:
sudo systemctl restart zabbix-server zabbix-agent apache2

It’s probably a good idea to also run this command, to make sure all these services are started automatically on boot:
sudo systemctl enable zabbix-server zabbix-agent apache2

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

You’ll want the server to be running all the time to collect data from the different hosts you monitor 24/7. The agent gathers data for the Raspberry Pi system and Apache2 is the web server used for the frontend interface.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Zabbix quick-start guide on Raspberry Pi

The hard part is done. We can do almost everything from the web interface. Let me guide you to get started quickly with Zabbix on your Raspberry Pi.

Get your IP address

To access the web interface you’ll need the Raspberry Pi IP address. If you’re still in the terminal the fastest way to get it will be to use this command:
ip a

You should be able to quickly find the IP address in the output, it looks like this:

And if you need more options or details, I have a specific tutorial on how to find the current IP address on Raspberry Pi. Click on the link to read it now, and come back once you have it.

Go to the web interface

Once you know the Raspberry Pi IP address, you can access the web interface from any computer on the same network. The URL to use follows this format:
http://<IP>/zabbix

Replace <IP> with the Raspberry Pi IP address and you’ll get access to a welcome page that looks like this:

Follow the configuration steps

From there, click on “Next step” and follow the instructions to complete the interface configuration.

You’ll need to fill in the database settings, choose a server name, time zone, and theme.

Click on “Finish” once everything is done and you’ll get redirected to the login page.

First login

To login to Zabbix for the first time, the default credentials are:

  • Username: Admin
  • Password: zabbix

You can then access the main dashboard, with a menu on the left to access all the features.

Fix locales errors

When I logged in for the first time, I got a bunch of errors on the Zabbix interface. Basically, in each frame, I had an error like “Locale for language ‘en_US’ is not found on the web server”.

My understanding is that Zabbix is set to use the “en_US” locale by default, while Raspberry Pi OS is installed with “en_GB” (the Foundation is based in the UK).

To fix this, you can either change the Zabbix settings to use en_GB instead (option 1) or add the en_US locale on your system (option 2). Pick the option you prefer, you just need to follow one.

Option 1: Change your profile

In the Zabbix interface, find Settings > Profile in the left menu, and click on it.
You’ll get a form looking like this, where you can choose a different language:

Pick “English (en_GB)” instead of “System default”. Save your changes, and it should be OK now.

Option 2: Add the en_US locale to your system

If you prefer to install the US locale to your system, the easiest way would be to use Raspi-config for this:
sudo raspi-config

Once the tool has started, go to Localization options, find en_US in the list, check the option (use the arrows and the space bar to select it). Then press TAB and choose “OK” to save the changes.

A restart is required to make it available for the whole system.

Whichever option you chose, this should be fine now and you should get the dashboard showing up properly:

Change the user password

The last thing I recommend doing before starting to use Zabbix on your Raspberry Pi is to change the user password. It’s never a good idea to keep the default values.

You can do this easily from the web interface, in Settings > Profile (same form as for option 1 above). Click on “Change password” and set it to something strong enough.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Using Zabbix on Raspberry Pi

Once the installation is completed, using Zabbix on a Raspberry Pi is not different from using it on any server. So, you’ll easily find documentation, tutorials, and videos online for anything specific you might be interested in. But let me give you a few tips to get started.

Monitoring the Raspberry Pi

The Raspberry Pi we used to install Zabbix is automatically available in the interface as our first host. The Zabbix Agent has been installed during the server installation, so we get all the data from the Raspberry Pi system directly available in the interface.

You can go to Monitoring > Host to find the Raspberry Pi (name “Zabbix Server” by default), and then click on “Graphs” to have an overview of the system usage. Here is an example of disk space usage:

And if you click on “Latest data”, you’ll get a table with a list of all the information collected by the Zabbix agent which looks like this:

It means that for all of these values, we can have graphs and notifications of whatever is important for our project.

Adding a new host

In most cases, monitoring the Raspberry Pi server won’t be the main goal. You can add as many hosts as you want via the web interface. Just click on “New host” from the Monitoring > Hosts page.

You’ll need a way to access the new host information remotely. In most cases, SNMP is used for applications like this, but other methods are also supported with Zabbix. Using the Zabbix Agent can also be an alternative if needed.

I tested this with my NAS, which has SNMP enabled and it worked perfectly fine on the first try. I just filled in the new host form with the IP address and SNMP configuration:

And a few minutes later, I had my data collected and the first graphs showed up:

❤️ Love Raspberry Pi & writing?
Combine your passions and get paid. Write for RaspberryTips!

Going further

As mentioned earlier, the Zabbix website is really well laid out, and the documentation is good enough to get started.

They even have several videos you can use as an introduction, like this one which I recommend watching if you are new to this:

From there, you’ll probably try things, see what’s working directly for your network and what needs more help. Head to their forums if you have specific questions. It’s very active and you’ll likely find an answer quickly there.

I used Nagios and Cacti for network and server monitoring when I worked as a sysadmin. I don’t have as much experience with Zabbix, but it looks like a great alternative. Let me know how it goes if you use it!

And if you are doing network projects like this, you might be interested in these other articles I have for you:

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts