After trying and testing out different monitoring software over the last couple of days and my choice fell on Zabbix.
It was the most intuitive and customizable, and came with A LOT of templates right out of the box. The community, around this product is strong and there are templates for your every desire ready to download from the forum.
So a here is a fast installation guide :
Zabbix version: 5.4
Linux Ubuntu server version: 20.04
Lets first of obtain root access, then we don’t have to elevate the command all the time. You can do it without this, but then you need to add ‘sudo’ to every command that requires elevation.
sudo su -
Type your password and we are good to go!
Adding .deb
Lets get the .deb, add it to the repository and then update.
wget https://repo.zabbix.com/zab# wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb
dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb
apt update
Now lets install the agent, server and frontend.
apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
Creation of database and configuration.
Installation of MariaDB
We need SQL to handle the database for zabbix, I chose MariaDB
apt -y install mariadb-common mariadb-server-10.3 mariadb-client-10.3
Ones installed lets kickstart Maria..DB
systemctl start mariadb && systemctl enable mariadb
Onwards to secure our installation of MariaDB
I will use these database passwords:
root: DBpassRoot
zabbix: DBpassZabbix
You should definitely get creative and conjure up some of your passwords of your own choice for obvious security reasons!
mysql_secure_installation
Enter current password for root (enter for none): Press the Enter
Set root password? [Y/n]: Y
New password: <Enter root DB password>
Re-enter new password: <Repeat root DB password>
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
Creation of database and user
Ask Maria nicely to create a database zabbix with password DBpassRoot
mysql -uroot -p'DBpassRoot' -e "create database zabbix character set utf8 collate utf8_bin;"
Then the user zabbix@localhost password DBpassZabbix and set privileges.
mysql -uroot -p'DBpassRoot' -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'DBpassZabbix';"
Lets aviod the import ERROR 1118 🙂
mysql -uroot -p'DBpassRoot' zabbix -e "set global innodb_strict_mode='OFF';"
Our next task is to import initial schema and data.
Beware your installation didn’t break, it just takes some time
Pop open a soda, make a cup of coffee or read about configuration of Zabbix
zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -p'DBpassZabbix' zabbix
We need to be a little strict and enter strict mode
mysql -uroot -p'DBpassRoot' zabbix -e "set global innodb_strict_mode='ON';"
Lets enter the database password in the config files
nano /etc/zabbix/zabbix_server.conf
Look for the DBPassword key in the config file and write your password after the equals sign.
Search (ctrl+w and enter to search) for the value DBPass
Remove the # sign and enter our password DBpassRoot
DBPassword=DBpassRoot
Save the file and exit (ctrl+x, followed by y and enter
Configuration of the firewall
ufw allow 80/tcp
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw reload
Lets fire up the Zabbix server and agent processes
systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2
Timezone PHP configuration needs a tweek
nano /etc/zabbix/apache.conf
Search (ctrl+w and enter to search) for the value data.timezone
remove the # sign and change the timezone information to your location.
php_value date.timezone Europe/Stockholm
Save the file and exit (ctrl+x, followed by y and enter
Restart Apache and lets make it start with the system.
systemctl restart apache2
systemctl enable apache2
Ladies and gentlemen, we have lift-off!
Now lets start configuring the Zabbix frontend.
Open your favorite browser and connect to you sparkeling new server:
http://server_ip_or_name/zabbix
In the wizard you only need to enter the password for the Zabbix database user we created DBpassZabbix for everything else just hit the next button.
You did it!
Use Zabbix default admin username “Admin” and password “zabbix” (without quotes) to login to Zabbix frontend at URL “http://server_ip_or_dns_name/zabbix” via your browser.
Have fun configuring the server!