Latest posts by khushvinder (see all)
- How to monitor Services/Processes in zabbix using SNMP? - August 17, 2019
- How to get overall CPU utilization in zabbix - June 15, 2019
- How to write discovery rule in zabbix and create prototype items - June 15, 2019
What is Zabbix?
Zabbix is an open source monitoring software for networks, operating systems and applications, created in Latvia by Alexei Vladishev. It is designed to monitor and track the status of various network services, servers, and other network hardwires (Router and Switches).
To start device/network interface monitoring first we need to setup Zabbix server. So, in the below section we are going to discuss how to install Zabbix?
Zabbix prerequisites: Apache server for frontend (by default its installed in linux) second as we need Zabbix frontend and need to maintain host details so we need a database. In this installation we are going to use MySql but can also use (MariaDB, SqlLite, PostgreSQL etc)
How to install MySql:
First of all, we must check if our system is updated and update it if it is not. Type command:
1. sudo yum update
Wait for the system to be updated. Now it is necessary to download MySQL repositories. The newest release at the end of the year 2016 is el7-9 so we will use it. (You can check other versions here: https://dev.mysql.com/downloads/repo/yum/). Type in command:
2. wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
At the end of the download, you should see that .rpm file was saved.
3. Now we need to prepare the repository so we could later install MySQL packages from it. Type:
sudo rpm -Uvh mysql57-community-release-el7-9.noarch.rpm
So now Mysql community has been installed and its time to install MySql server using below command.
4. Install MySql server
sudo yum install mysql-server
5. A list of packages will be provided and you will be asked for confirmation to download them. Type y and press ENTER.
6. When they finish downloading you will again be asked for confirmation to install them. Type y and press ENTER.
7. Once its installed now its time to start MySql server
sudo systemctl start mysqld
You can use start/stop/restart/status command as per your requirement.
8. Now with below command you can sign-in
#mysql -uroot -p //Press enter
9. After login now change the default password as below
1. Let get RPM package download from below link;
# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
Note: Zabbix frontend requires additional packages not available in basic installation. You need to enable repository of optional rpms in the system you will run Zabbix frontend on:
# yum-config-manager –enable rhel-7-server-optional-rpms
2. To install Zabbix server my MySql support run below command
# yum install zabbix-server-mysql
3. And for frontend with MySql support run below command
# yum install zabbix-web-mysql
4. Now we need to setup db script so first create database and user in mysql as given below
shell> mysql -uroot -p<password>
mysql> create user zabbix;
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘<password>’;
Note: Database and user name we can keep anything as per your requirement.
5. Now import initial schema and data for the server with MySQL:
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p Zabbix
Note: make sure all these user name and database name you changed into below file.
Edit zabbix_server.conf or zabbix_proxy.conf to use the created database. For example:
# vi /etc/zabbix/zabbix_server.conf
6. Now save Zabbix_server.conf file and exit from this file. After this we are ready to start Zabbix server using below command
# service zabbix-server start
In case of system reboot if you want Zabbix also restart automatically then use below command
# systemctl enable zabbix-server
7. For RHEL 7 and later the Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf.
Note: Some PHP settings are already configured. But it’s necessary to uncomment the “date.timezone” setting and set the right timezone (http://php.net/manual/en/timezones.php) for you
# vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
8. We all done with Zabbix server so now we are ready to install Zabbix frontend but before frontend installation follow the below SELinux configuration:
Having SELinux status enabled in enforcing mode, you need to execute the following commands to enable communication between Zabbix frontend and server:
# setsebool -P httpd_can_connect_zabbix on
# setsebool -P httpd_can_network_connect_db on
9. Installing frontend for Zabbix server
a. In your browser, open Zabbix URL: http://<server_ip_or_name>/zabbix
b. Make sure that all software prerequisites are met.
c. Enter details for connecting to the database. Zabbix database must already be created.
d. Enter Zabbix server details.
e. Review a summary of settings.
f. Finish the installation.
g. Zabbix frontend is ready! The default user name is Admin, password zabbix.
10. As frontend and SELinux configuration is done, you need to restart Apache web server:
# service httpd restart
Note: By default, the port 80 for http connection is filtered on Redhat 7 as you can only access this port from the actual localhost and not from any other public host. To open a port 80 on RHEL 7 Linux we need to add an iptables rule. For this RHEL7 uses firewall-cmd. First add your port 80 rule with a following linux command:
#sudo firewall-cmd –zone=public –add-port=80/tcp –permanent
Once you add the above firewall rule reload firewall service:
# sudo firewall-cmd –reload
11. That’s it I hope you able to install your Zabbix server successfully. Thank You
517 total views, 2 views today