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:

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

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:

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

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:

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)

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:

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

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:

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:

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:

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

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:

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.

时间: 2024-12-31 19:37:43

How to Install and Configure Zabbix on Ubuntu 16.04的相关文章

在Ubuntu 16.04 Server上安装Zabbix

监控服务器 - 什么是 Zabbix Zabbix 是企业级开源分布式监控服务器解决方案.该软件能监控网络的不同参数以及服务器的完整性,还允许为任何事件配置基于电子邮件的警报.Zabbix 根据存储在数据库(例如 MySQL)中的数据提供报告和数据可视化功能.软件收集的每个测量指标都可以通过基于 Web 的界面访问. Zabbix 根据 GNU 通用公共许可证版本 2(GPLv2)的条款发布,完全免费. 在本教程中,我们将在运行 MySQL.Apache 和 PHP 的 Ubuntu 16.04

WordPress with LEMP on Alibaba Cloud – Part 1 Provision and Secure an Ubuntu 16.04 Server

By Jeff Cleverly, Alibaba Cloud Tech Share Author This is the first tutorial of a series that will culminate with a fresh WordPress site running on an Alibaba Cloud ECS Instance running a highly performant LEMP Stack. In this tutorial, we will create

如何在Ubuntu 16.04上安装OTRS(开源问题单系统)

OTRS ,即开源问题单(ticket)申请系统,是一个用于客户服务.帮助台和 IT 服务管理的开源问题单软件.该软件是用 Perl 和 javascript 编写的.对于那些需要管理票据.投诉.支持请求或其他类型的报告的公司和组织来说,这是一个问题单解决方案.OTRS 支持包括 MySQL.PostgreSQL.Oracle 和 SQL Server 在内的多个数据库系统,它是一个可以安装在 Windows 和 Linux 上的多平台软件. 在本教程中,我将介绍如何在 Ubuntu 16.04

Ubuntu 16.04下安装以太坊编译环境以及设置合约功能(支持geth 1.6以及solc 0.4.16版本以上)

由于没有苹果电脑,所以在这里使用Linux环境进行操作,Windows也可以,但是没有试过,也看过不少文章,说道会遇到很多问题. 本文解决了下面几个问题: 1.geth升级到1.6版本后,不再使用eth.getCompilers()或者admin.setSolc()等通过JS的方式实时编译,而是采用了ABI合约接口的二进制表示.通过转化为json方式到geth的console平台进行编译 具体看下面文章说明:https://ethereum.stackexchange.com/questions

[译]搭建个人深度学习平台:GTX 1080 + Ubuntu 16.04 + CUDA 8.0RC + CuDNN 7 + Tensorflow/Mxnet/

本文讲的是[译]搭建个人深度学习平台:GTX 1080 + Ubuntu 16.04 + CUDA 8.0RC + CuDNN 7 + Tensorflow/Mxnet/, 原文地址:Build Personal Deep Learning Rig: GTX 1080 + Ubuntu 16.04 + CUDA 8.0RC + CuDnn 7 + Tensorflow/Mxnet/Caffe/Darknet 原文作者:Guanghan Ning 译文出自:掘金翻译计划 本文永久链接:github

PHP7 学习笔记(一)Ubuntu 16.04 编译安装Nginx-1.10.3、 PHP7.0.9、Redis3.0 扩展、Phalcon3.1 扩展、Swoole1.9.8 扩展、ssh2扩展(全程编译安装)

 ==================== PHP 7.0 编译安装================== wget http://cn2.php.net/get/php-7.0.9.tar.bz2/from/this/mirror -- 下载php镜像tar xvf mirror -- 解压镜像cd php-7.0.9/ -- 进入安装目录sudo apt-get update -- 更新阿里云库 sudo apt-get install libkrb5-dev \ libc-client200

升级到Ubuntu 16.04 LTS教程

  如果你不想全新安装 Ubuntu 16.04 LTS ,本文将介绍如何从 Ubuntu 15.10 或更老版本的 Ubuntu 进行升级.就目前来看,升级到 Ubuntu 16.04 LTS 的过程中虽然会有些小错误,但整个升级过程还算不错. 在正式开始升级之前,请使用如下命令先对系统进行更新: sudo apt-get update && sudo apt-get dist-upgrade 上述命令将为当前系统安装最新可用的软件包,升级完成后请使用如下命令重启系统以完成更新安装: s

Ubuntu 16.04自定义Unity位置教程

  更改Ubuntu 16.04 Unity位置 刚我已经讲清楚了,该方法目前只适用于 Ubuntu 16.04,不会对早期版本的 Ubuntu 生效. 使用终端命令 你可以在终端中执行如下命令: 将 Unity 位置移到底部 gsettings set com.canonical.Unity.Launcher launcher-position Bottom 将 Unity 位置移到左侧 gsettings set com.canonical.Unity.Launcher launcher-p

在 Ubuntu 16.04 为 Nginx 服务器安装 LEMP 环境(MariaDB,PHP 7 并支持 HTTP 2.0)

LEMP 是个缩写,代表一组软件包(L:Linux OS,E:Nginx 网络服务器,M:MySQL/MariaDB 数据库和 P:PHP 服务端动态编程语言),它被用来搭建动态的网络应用和网页. (LCTT 译注:为何采用 LEMP 而不是 LNMP 的缩写?据 https://lemp.io/ 的解释:Nginx 的发音是 Engine-X,重要的发音而不是首字母,而且 LEMP 实际上是可读的,而 LNMP 看起来只是字母表.) 在 Ubuntu 16.04 安装 Nginx 以及 Mar