Zabbix Beginner pt 1

So what is Zabbix ??
Zabbix is a monitoring tool written by Alexei Vladishev, who is also the owner of the company Zabbix.
A more in-depth story can be found at this page.

So Zabbix is an opensource monitoring system consisting of a Zabbix Server, database (MySQL,Postgresql) as main components, you will also need a webserver your choices are Nginx or Apache and then Php installed as FPM.
There are many ways to install this combo, so i will use the basic 1 host on bare metal or as a virtual host.
So what you need is you desired Linux OS, you can choose your version on the Download Page or use my predefined which is Debian 12 with server, agent, web-server ( Nginx ) and MySQL Database.

Depending on preference and how you connect there is the choice of SSH connection or via terminal.

Important you must either be root or be a sudo user for the installing of the packages.
make sure the following packages are installed (as non root user the command sudo infront of this command )

apt install wget zcat vim 


First install the Repository of Zabbix for this version is the 6.4.
First download the repo file for Debian.

wget https://repo.zabbix.com/zabbix/6.4/debian/pool/main/z/zabbix-release/zabbix-release_6.4-1+debian12_all.deb

Then you can install the download package. (as non root user the command sudo infront of this command )

dpkg -i zabbix-release_6.4-1+debian12_all.deb

Now we need to update our repo list (as non root user the command sudo infront of this command )

apt update 

now we are ready to install the packages needed for Zabbix (as non root user the command sudo infront of this command )

apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

So now packages are installed we must configure our basic MySQL for zabbix
usually on basic install the mysql root user has an empty password so when asked for password just press the enter button.

mysql -uroot -p

Now you should be in a MySQL “terminal”.
The commands in order are create the database zabbix ( remember after each of these commands press the enter button)

create database zabbix character set utf8mb4 collate utf8mb4_bin;

Now we need to create a user for the database (change ‘password’ to your desired password encased in ‘ / single qoutes ).

 create user zabbix@localhost identified by 'password';

We now move a step towards giving our user access to the specific database

grant all privileges on zabbix.* to zabbix@localhost;

now we have access we set a global value for log_bin_trust_function_creators ( for detailed information click here )

 set global log_bin_trust_function_creators = 1;

now we just need to leave the MySQL terminal

quit;

Next step is to populate the MySQL database zabbix with standard settings and predefined tables (you will be asked to provide a password for your zabbix user, it is the one that was set, when you created the user for the zabbix table ).

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

Now the database should be loaded, now we disable log_bin_trust_function_creators, so now use the terminal

mysql -uroot -p
 set global log_bin_trust_function_creators = 0;
quit;

Now we need to replace a few things in a few files, you can use vim,nano or do a replace the files is /etc/zabbix/zabbix_server.conf. (as non root user the command sudo infront of this command )

sed -i 's/DBPassword=password/DBPassword=mypassword/g' /etc/zabbix/zabbix_server.conf

Now do this on Nginx’s config file.  /etc/zabbix/nginx.conf
set the part ” listen 8080″ to desired port and the ” server_name example.com” to desired name. e.g. ” listen 80″ and ” server_name zabbix.mydomain.local” ( if you have a dns setup that is or set one of your local names to linked to the server )
(as non root user the command sudo infront of this command )

sed -i 's/# listen 8080;/ listen 8080;/g' /etc/zabbix/nginx.conf
sed -i 's/# server_name example.com;/ server_name example.com;/g' /etc/zabbix/nginx.conf

Now we must enable and restart Zabbix.
(as non root user the command sudo infront of this command )

 systemctl restart zabbix-server zabbix-agent nginx php8.2-fpm
 systemctl enable zabbix-server zabbix-agent nginx php8.2-fpm


Now the last part is to connect to your installation via a webbrowser.
see here .


Posted

in

, ,

by

Tags: