About Zabbix

Zabbix is a free and open source network monitoring Software tool which is used to monitor and track the availability and performance of your IT infrastracture: servers, network devices and other IT assets.

In this article we will install Zabbix 3.4 on CentOS 7 and RHEL 7, in order to use Zabbix we required a Web Server (Apache), database server(Mysql, Mariadb, Postgresql …) and PHP to work.

Environment:

Hostname = zabbix.yallalabs.com

IP Address = 192.168.1.200

OS = CentOS 7 / RHEL 7

Before we begin, note that I have installed lamp stack in my server:

– Don’t forget to set a password for the root using mysql_secure_installtion, take a look to this tutorial: Securing MySQL server / Mariadb with mysql_secure_installation



Step 1 – Install Zabbix Server with MySQL

Before starting the installation we need to enable the zabbix repository using this commands:



Now use the below command to install Zabbix and necessary packages

Step 2 – Edit PHP timezone

Open the file /etc/httpd/conf.d/zabbix.conf created by Zabbix with your favourite editer



It’s necessary to uncomment the “date.timezone” setting and set the right timezone for you.

php_value date.timezone Europe/Rome



– Save the file and don’t forget to reload httpd service using the below command:

[[email protected] ~]# systemctl reload httpd





Step 3 – Edit create and import initial zabbix database and user

First we need to create zabbix database (zabbixdb) and create a zabbix user (zabbixuser).

[[email protected] ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 10 Server version: 5.5.47-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE zabbixdb CHARACTER SET utf8 COLLATE utf8_bin; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbixdb .* TO [email protected] Password "; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye [[email protected] ~]#



– After creating the zabbix database and user we need to import the zabbix initial database using the below commands:

[[email protected] ~]# zcat /usr/share/doc/ zabbix-server-mysql-3.4.0 /create.sql.gz | mysql -u root -p zabbixdb



– Now we need to edit database configuration in the zabbix server configuration file zabbix_server.conf



Specify the database name for zabbix , database user name and the password

DBHost= localhost DBName= zabbixdb DBUser= zabbixuser DBPassword= Password

Step 4 – Set SELinux settings and adjust Firewall

– Having SELinux status enabled in enforcing mode, you need to execute the following command to enable successful connection of Zabbix frontend to the server

– SELinux configuration is done, you need to restart Apache web server:

[[email protected] ~]# systemctl start httpd

– Execute the following command to enable http service and connection between the Zabbix server and agents:

– After adjusting the Selinux settings and the firewall we need to enable and start zabbix service on boot using the bellow commands



Note: If you have issues starting the zabbix-server daemon and the zabbix-agent daemon and you got this error “Job for zabbix-server.service failed because a configured resource limit was exceeded. See “systemctl status zabbix-server.service” and “journalctl -xe” for details“, you need to set Selinux roles using the audit2allow command:



* SELINUX for Zabbix-agent:



* SELINUX for Zabbix-server:

– Finaly:

Step 5 – Configure Zabbix via Web console

– Navigate to http://ip_address/zabbix or http://host_name/zabbix



– Make sure that all software prerequisites are met.



– Enter details for connecting to the database. Zabbix database must already be created.



– Enter Zabbix server details.



– Review a summary of settings.



– Finish the installation.



– Now you’ll be redirected to the zabbix web console page. The default user name is Admin and the password is zabbix .







Last thing to do is to enable your server zabbix to be monitored: go to Configuration -> Hosts. Select the host (zabbix server) and click “Disabled”





We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!