By Hitesh Jethva, Alibaba Cloud Tech Share Author
Zabbix is an open source and enterprise-class network monitoring tool that can be used to monitor performance and availability of the server, network devices and other network components. Zabbix uses MySQL, PostgreSQL and Oracle to store its data. Zabbix also provides a user friendly web interface to monitor and track data and settings. Zabbix uses a Zabbix agent to collect the data and send it to the Zabbix server.
In this tutorial, we will go through step by step installation of Zabbix server and Zabbix client on Ubuntu 16.04 server.
• A fresh Alibaba Cloud ECS instance for Zabbix server with Ubuntu 16.04 installed.
• A fresh Alibaba Cloud ECS instance for Zabbix client with Ubuntu 16.04 installed.
• Non-root user with sudo privileges is configured on both instance.
Before starting, Zabbix requires Apache, MySQL and PHP installed on your system. First, install Apache, PHP7 and other required PHP modules by running the following command:
sudo apt-get update -y
sudo apt-get install apache2 libapache2-mod-php7.0 php7.0 php7.0-xml php7.0-bcmath php7.0-mbstring -y
Once all the components are installed, you will need to install MariaDB. By default, the latest version of the MariaDB is available in Ubuntu 16.04 repository. So you can easily install it by just running the following command.
sudo apt-get install mariadb-server -y
Next, start MariaDB server and enable it to start on boot time:
sudo systemctl start mysql
sudo systemctl enable mysql
By default, the latest version of the Zabbix is not available in Ubuntu 16.04 default repository. So you will need to download and install the official Zabbix repository to your system.
First, download the Zabbix repository with the following command:
wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-2+xenial_all.deb
Next, install the downloaded repository with the following command:
sudo dpkg -i zabbix-release_3.0-2+xenial_all.deb
Next, update the repository and install Zabbix server and web front-end with MySQL database support with the following command:
sudo apt-get update -y
sudo apt-get install zabbix-server-mysql zabbix-frontend-php -y
You will also need to install Zabbix agent to collect the Zabbix server data itself.
sudo apt-get install zabbix-agent -y
Next, start Zabbix agent and enable it to start at boot:
sudo systemctl restart zabbix-agent
sudo systemctl enable zabbix-agent
Before using Zabbix, you will need to create a database and a user to store the Zabbix server data.
First, log in to MariaDB shell with the following command:
mysql -u root -p
Enter your root password when prompt, then create a database for Zabbix.
CREATE DATABASE zabbix_db character set utf8 collate utf8_bin;
Next, create a user for the Zabbix server and grant all the privileges identified by a password:
GRANT ALL PRIVILEGES on zabbix_db.* to zabbix_user@localhost identified by 'zabbix';
We will be using the password zabbix by default.
Next, flush the privileges with the following command:
MariaDB [(none)]>FLUSH PRIVILEGES;
Finally, exit from the MariaDB shell:
MariaDB [(none)]>exit;
Next, import initial schema and data to the newly created Zabbix database:
cd /usr/share/doc/zabbix-server-mysql/
sudo zcat create.sql.gz | mysql -u zabbix_user -p zabbix_db
Enter your zabbix_user password when prompt. (You may have to wait)
Next, you will need to set database, database username and the database password in the Zabbix server configuration file. You can do this by editing zabbix_server.conf
file:
sudo nano /etc/zabbix/zabbix_server.conf
Change the following lines:
DBName=zabbix_db
DBUser=zabbix_user
DBPassword=zabbix
Save and close the file when you are finished. Next, you will need to change Timezone settings in /etc/zabbix/apache.conf
file:
sudo nano /etc/zabbix/apache.conf
Find the line:
# php_value date.timezone Europe/Riga
Then, replace it with the following line as per your Timezone: http://php.net/manual/en/timezones.php. For this example, I will be using:
php_value date.timezone Asia/Shanghai
Save the file when you are finished.
Finally, start Apache server and Zabbix server and enable them to start on boot time:
sudo systemctl restart apache2
sudo systemctl restart zabbix-server
sudo systemctl enable apache2
sudo systemctl enable zabbix-server
Your Zabbix server is now set up and connected to the database. It's time to access Zabbix web installation wizard.
Open your favourite web browser and navigate to the URL http://ECS_Internet_IP_Address/zabbix. You can find your ECS Internet IP Address from the management console. You will be redirected to the welcome page as shown below:
Click on the Next step button, you should see the pre-requisites page in the following screen:
Make sure all the values are ok. Once you have done. Click on the Next step button. You should see the Zabbix database configuration screen:
Here, update all the details like, Database name, Database username and the password, then click on the Next step button. You should see the following screen:
Here, provide hostname or IP address and port number of the zabbix server and click on the Next step. You should see the following page:
Verify the pre-installation summary, then click on the Next step button to start the installation. Once the installation is finished, you should see the following page:
Now, click on the Finish button. You will be redirected to the Zabbix server login screen as below:
Now, log in with the Zabbix server default username Admin and the password zabbix. You should see the Zabbix server dashboard in the following screen:
Your Zabbix server is now up and running. Next, you will need to install Zabbix Agent which you want to monitor. First, download and install the Zabbix repository to your Client machine:
wget http://repo.zabbix.com/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-2+xenial_all.deb
Next, install the downloaded repository with the following command:
sudo dpkg -i zabbix-release_3.0-2+xenial_all.deb
Next, update the repository and install Zabbix Agent with the following command:
sudo apt-get update -y
sudo apt-get install zabbix-agent -y
Next, open the Zabbix agent default configuration file located at /etc/zabbix/zabbix_agentd.conf:
sudo nano /etc/zabbix/zabbix_agentd.conf
Change the file as shown below:
##IP address of Zabbix Server
Server=192.168.0.103
ServerActive=192.168.0.103
Hostname=Zabbix-Client
Save and close the file when you are finished, then restart Zabbix Agent to apply these changes:
sudo systemctl restart zabbix-agent
Next, add Zabbix Agent service to start at boot:
sudo systemctl enable zabbix-agent
Now, Zabbix Agent is up and running. Next, move to the Zabbix server web interface and add the Client Machine which run zabbix agents in order to be monitored by the Zabbix server.
On the Zabbix web console, go to Configuration -> Hosts -> Create Host -> Host tab and provide all the required information as shown below:
Next, move to Templates tab and click on the select button. A new window with templates should open. Choose Template OS Linux then scroll down and click on the Select button to add it.
Next, click on add button to link it to Zabbix server, then click on lower add button again to complete the process:
You should now see the monitored client machine in below screenshot:
After adding the Zabbix client to the Zabbix server make sure that the host Status is set to Enabled. Next, wait for the few seconds for Zabbix server to contact the agent, then move to the Monitoring tab on Zabbix web console and then click on the Latest data to see the data from your agent.
Heterogeneous Computing: Dominated by GPU, FPGA, and ASIC Chips
MaxCompute in Australia, Leading Artificial Intelligence Industry
2,599 posts | 762 followers
FollowAlibaba Clouder - May 7, 2019
Alibaba Clouder - May 8, 2019
Alibaba Clouder - May 9, 2019
Alibaba Clouder - May 10, 2019
Alibaba Clouder - June 4, 2019
Alibaba Clouder - June 10, 2019
2,599 posts | 762 followers
FollowMigrate your legacy Oracle databases to Alibaba Cloud to save on long-term costs and take advantage of improved scalability, reliability, robust security, high performance, and cloud-native features.
Learn MoreAn online MPP warehousing service based on the Greenplum Database open source program
Learn MoreAlibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.
Learn MoreAnalyticDB for MySQL is a real-time data warehousing service that can process petabytes of data with high concurrency and low latency.
Learn MoreMore Posts by Alibaba Clouder
Raja_KT February 9, 2019 at 7:15 am
Nice one. Hope we can see and compare with others like Nagios, Prometheus....