How to Install and Configure Zabbix on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author

Introduction

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.

Prerequisites

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.

Install LAMP Server

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:

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.

Next, start MariaDB server and enable it to start on boot time:

Install Zabbix

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:

Next, install the downloaded repository with the following command:

Next, update the repository and install Zabbix server and web front-end with MySQL database support with the following command:

You will also need to install Zabbix agent to collect the Zabbix server data itself.

Next, start Zabbix agent and enable it to start at boot:

Configure Database for Zabbix

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:

Enter your root password when prompt, then create a database for Zabbix.

Next, create a user for the Zabbix server and grant all the privileges identified by a password:

We will be using the password zabbix by default.

Next, flush the privileges with the following command:

Finally, exit from the MariaDB shell:

Next, import initial schema and data to the newly created Zabbix database:

Enter your zabbix_user password when prompt. (You may have to wait)

Configure Zabbix

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:

Change the following lines:

Save and close the file when you are finished. Next, you will need to change Timezone settings in /etc/zabbix/apache.conf file:

Find the line:

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:

Save the file when you are finished.

Finally, start Apache server and Zabbix server and enable them to start on boot time:

Access Zabbix Web Interface

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:

Image for post
Image for post

Click on the Next step button, you should see the pre-requisites page in the following screen:

Image for post
Image for post

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:

Image for post
Image for post

Here, update all the details like, Database name, Database username and the password, then click on the Next stepbutton. You should see the following screen:

Image for post
Image for post

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:

Image for post
Image for post

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:

Image for post
Image for post

Now, click on the Finish button. You will be redirected to the Zabbix server login screen as below:

Image for post
Image for post

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:

Image for post
Image for post

Install and Configure Zabbix Client

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:

Next, install the downloaded repository with the following command:

Next, update the repository and install Zabbix Agent with the following command:

Next, open the Zabbix agent default configuration file located at /etc/zabbix/zabbix_agentd.conf:

Change the file as shown below:

Save and close the file when you are finished, then restart Zabbix Agent to apply these changes:

Next, add Zabbix Agent service to start at boot:

Add Zabbix Client Machine to Zabbix Server for Monitoring

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:

Image for post
Image for post

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.

Image for post
Image for post

Next, click on add button to link it to Zabbix server, then click on lower add button again to complete the process:

Image for post
Image for post
Image for post
Image for post

You should now see the monitored client machine in below screenshot:

Image for post
Image for post

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.

Source Article: https://cloudfocus.alibabacloud.com/How-to-Install-and-Configure-Zabbix-on-Ubuntu-16-04-221230

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store