Skip to main content

zabbix server installation

I have a very neglected Nagios installation on my LAN monitoring some servers/ services. I never got around to adding additional items to monitor. Finally getting around to it now, I decided to setup a Zabbix server instead as I've used it more recently in production and I know it's pretty straight forward to add additional items to be monitored. The hope being I will be more inclined to keep it up to date.
Install is taken from the excellent documentation, listing my specific steps to help if I ever have to re-do. I'm installing Zabbix 6.4 on a minimal install of Ubuntu Server 22.04.2 LTS.

Setup repo and install:

wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo dpkg -i ./zabbix-release_6.4-1+ubuntu22.04_all.deb
sudo apt update
sudo apt install mariadb-server
sudo mysql_secure_installation
sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Setup mysql:

mysql -uroot -p

create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbix@localhost identified by '#################';
grant all privileges on zabbix.* to zabbix@localhost;
set global log_bin_trust_function_creators = 1;
quit;

Import schema:

cp /usr/share/zabbix-sql-scripts/mysql/server.sql.gz .
gunzip server.sql.gz
cat ./server.sql | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Set mysql settings:

mysql -uroot -p

set global log_bin_trust_function_creators = 0;
quit;

Set DB password: Edit /etc/zabbix/zabbix_server.conf config file and add the password to: DBPassword=############

Start and enable required services:

sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2

Visit http://ip.add.re.ss/zabbix/ and run through the setup wizard. (Zabbix default login details: Admin/ zabbix)

I had a display issue in the GUI, I had to update the system locale: before locale fix

sudo apt install locales
sudo dpkg-reconfigure locales
Selected: 160. en_US.UTF-8 UTF-8

after locale fix

Configure alerting: I decided to use Telegram for alerts, I haven't used it for much but recently heard an interesting use case where it was being used by a group of people to track content for their podcast, so I figured this would be a good oppertunity to see how it works.

  • First I enabled the Telegram Media Type (under alerts)
  • Then I followed this guide to setup a new Telegram bot.
  • Then I added the token from the new bot to the config of the Media Type full steps here
  • I enabled the default Report problems to Zabbix administrators Trigger action in Alerts->Actions
  • Finally I edited my Zabbix a/c profile to enable the Telegram media type and add my Telegram userid for alerts to be sent to.

Add a first host to monitor: I wanted to add one host to make sure everything was working as expected, I will put some more thought into getting everything else I want monitored added. Depending on how much effort that invloves I might do a second doc for that.

  • On my Proxmox server to monitor I ran apt-get install zabbix-agent
  • Then I edited /etc/zabbix/zabbix_agentd.conf on the server and set the Server=IP-OF-Zabbix-Server field.
  • I then added the server as a host in Zabbix selecting the Zabbix Linux template.
  • Finally restart zabbix-agent service.

list of hosts being monitored