Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Chapter 1 installation and configuration of Zabbix

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Chapter 1 introduction to Zabbix installation and configuration 1.1 Zabbix

Zabbix is an enterprise-class open source monitoring software, which can monitor the availability of IT infrastructure and the performance of applications, and provide users with a centralized management, distributed monitoring one-stop (all in one) monitoring solution. It is a real open source product (True Open source). Using the GPL agreement to release, whether commercial or non-commercial use without any restrictions, can be said to be absolutely free to use. Different from other open source products, there are no restrictions on the functions provided by the Zabbix software itself, the number of monitoring devices and so on. Whether for enterprise or personal use, you can modify and customize the source code to meet your own needs, especially for enterprises, it is very important to avoid the problem of vendor locking.

The most basic purpose of Zabbix is to collect monitoring data, save the collected data to the database for analysis and processing, and use Web front-end pages to easily display these monitoring data in real time. By comparing with the set threshold to trigger a specific event and generate the corresponding action, an alarm notice is issued or a remote command is executed. Zabbix provides a variety of monitoring methods to monitor all aspects of the infrastructure, not only dedicated Agent, but also supports External checks, SNMP, IPMI, JMX monitoring, SSH checks and other ways to collect monitoring data, with rich functions and flexible expansibility. In fact, almost everything you can think of can be monitored in Zabbix.

Alexei Vladishev began to create Zabbix in 1998, and in 2001 he released the first version of Zabbix. Since its first release, Zabbix has defined its development guidelines:

All rules for thresholds, triggers, and alerts are managed by the Zabbix server.

Almost all configuration tasks can be done through the Zabbix Web front-end page.

Use PHP to develop Zabbix Web front-end pages, and use C language to develop Zabbix server to ensure the performance of the core system.

All data (including configuration and historical data) is stored in a relational database (historical data can also be stored in the NoSQL database in the future).

The stable distributions supported by Zabbix are shown in Table 1-1 below:

Table 1-1

Version

Release date

Date of termination of support

Zabbix 3.0

February 16, 2016

February 2019

Zabbix 2.2

November 12, 2013

August 2017

At present, more and more people begin to pay attention to and use Zabbix in the field of operation and maintenance monitoring, so why Zabbix stands out among many open source monitoring software and becomes the most popular open source monitoring product, or the reasons for using Zabbix monitoring system can be summarized as follows:

Only Linux, Apache/Nginx, PHP, MySQL/PostgreSQL are required, and no dedicated operating system and hardware are needed.

Easy to install and configure, provide a centralized and unified Web front-end management interface, easy to learn and use.

The server can be installed in most UNIX-like operating systems, including Linux, AIX, BSD, Mac OS X, and Solaris.

Native agents supports most UNIX-like and Windows operating systems.

SNMP (SNMPv1, SNMPv2c, SNMPv3) trapping and polling are supported to monitor devices.

Can directly monitor IPMI equipment.

Use JMX (Java Management Extensions) to monitor Java applications.

Using VMware API, you can directly monitor vCenter or vSphere.

Built-in drawing function, real-time display of monitoring data and other visualization functions.

The collected data is permanently stored in the central database, which is convenient for the secondary analysis of the monitoring data.

It is convenient to use Wechat, nails and other extended alarm methods.

Zabbix API provides a programmable interface and can be integrated with third-party systems in many different programming languages. It has to be easy and simple.

Flexible and powerful template configuration, and support template nesting.

It has the functions of automatically discovering network equipment, automatically registering hosts, automatically adding templates and so on, to realize automatic operation and maintenance.

With rich extensibility, you can easily customize monitoring items and collect data, and you can monitor almost all the data you want.

Of course, there are many features, such as user and rights management, flexible alarm condition settings and alarm upgrades, which are no longer listed here. With the introduction of this book, I believe you will have an in-depth understanding of Zabbix.

Recently, we have completed the recording and release of the video tutorial "zabbix 4.0", which is based on zabbix 4.2 and provides a comprehensive explanation of Zabbix. Welcome to watch. Course link: https://edu.51cto.com/sd/ce000

1.2 Zabbix components and Architecture

The Zabbix monitoring system consists of four main components: Zabbixserver, Zabbix proxy, Zabbix database and Zabbix GUI. Each component has its own characteristics and requirements:

Zabbix server: this is the core engine that collects or receives data from the monitored device. It is developed in C language and communicates with Zabbix agents, Zabbix proxy and Zabbix database. It is the most important component that manages all rules (including collecting monitoring data, triggers, alarms, etc.).

Zabbix GUI: this is the Zabbix Web front-end management page. Through the Web front-end page, users can view the data collected by Zabbixserver and configure Zabbixserver. It is developed in PHP, uses a web server (Apache or Nginx) that supports PHP programs to run, and communicates with Zabbix databases.

Zabbix database: this is the Zabbix data repository. The back-end database for Zabbix can be Oracle, IBM DB2, PostgreSQL, MySQL, or SQLite3. In this book, we will use MySQL as the database.

Zabbix proxy: this is an optional component that can be used to implement a distributed monitoring architecture or to share the load of Zabbix server to improve the performance of Zabbix server. Its main function is to assist Zabbix server in collecting data from monitored hosts or devices. The data collected by Zabbix proxy is first stored in the local tempdb and then sent to Zabbix server regularly, even if the connection between Zabbix server and Zabbix proxy is disconnected, it will not result in data loss (the data retention time can be set in the configuration file of proxy). In version 3.0, encrypted data transfer between Zabbix server and Zabbix proxy is natively supported (either certificate-based or shared key-based encryption is supported).

As you can see from figure 1-1, Zabbix is a three-tier architecture, and we need to install the following three servers, namely, the Web server, the Database server and the Zabbix server.

Figure 1-1

If the scale of monitoring is relatively small (several or dozens of hosts), the three servers mentioned above can be installed in one physical server at the same time. The advantage of this method is that the installation and configuration is simple and fast, and the initial deployment cost is relatively low. This is shown in figure 1-2 below.

Figure 1-2

With the continuous expansion of the monitoring scale, more and more monitoring data need to be saved and processed, and more operation and maintenance personnel will visit the front-end Zabbix Web pages, which is bound to degrade the processing performance of Zabbixserver, resulting in problems such as broken pictures, slow access to Web front-end pages and so on. At this point, we can split the Web server, Database server, and Zabbix server and install them into different physical servers. In this way, each server component uses dedicated hardware resources, which can solve the corresponding performance problems, but need to increase the investment of server hardware. This is shown in figure 1-3 below.

Figure 1-3

1.3 Zabbix data processing flow

Figure 1-4

In the standard Zabbix data processing process, mainly through several different data sources to send data to Zabbix server, all the data will be saved to the database, and the results will be presented to the user through Web GUI. From figure 1-4 above, we can see that the main sources for sending data include:

Zabbix agent

Zabbix sender

Other agent (such as scripts or custom third-party agent)

Zabbix proxy

1.4 some considerations before Zabbix deployment

Before preparing to deploy Zabbix, you should plan and design the Zabbix monitoring deployment plan according to the actual IT infrastructure and business requirements, so as to avoid the performance, capacity and other problems that may be encountered in the later use.

1.4.1 identify the Zabbix deployment architecture

In most scenarios, Zabbix can be deployed with a centralized architecture, which means that all monitoring data is collected by Zabbix server, regardless of whether Zabbix server, Database server, and Web server are installed on the same server. If the IT infrastructure you need to monitor has multiple sub-centers or branch offices, it is recommended to deploy with a distributed architecture. Add Zabbix proxy to each sub-center or branch office. The Zabbix proxy collects local monitoring data and transmits it to Zabbix server for storage and processing, so as to achieve a distributed architecture and centralized monitoring solution.

1.4.2 evaluate server hardware resources

The server can run Zabbix normally as long as it has 128MB memory and 256MB disk space, but it needs to be adjusted according to the monitoring requirements when deployed in the real environment.

Table 1-2 below shows the officially listed server hardware configurations:

Table 1-2

Types

System platform

CPU/ memory

Database

Hard disk

Monitored host

Small size

CentOS

Virtual machine

MySQL InnoDB

SATA

one hundred

Medium-sized

CentOS

2 CPU cores/2GB

MySQL InnoDB

SATA

five hundred

Large scale

RedHat Enterprise Linux

4 CPU cores/8GB

MySQL InnoDB

Or PostgreSQL

RAID 10

SAS or SSD

> 1000

Super large

RedHat Enterprise Linux

8CPU cores/16GB

MySQL InnoDB

Or PostgreSQL

RAID 10

SAS or SSD

> 10000

The hardware configuration of the server is closely related to the number of hosts to be monitored, the number of monitoring indicators and the setting and number of triggers. The larger the number, the higher the processor performance of Zabbix, especially the database needs not only a lot of processor resources, but also more memory.

When the interval time for collecting monitoring data is relatively small, it will increase the refresh rate of the data, and at the same time, it will also bring more intensive read and write operations to the database. Therefore, when the number of monitored hosts and the number of monitoring indicators are very large, it is recommended to configure SSD hard disk to avoid disk IXO and database performance becoming a bottleneck.

1.4.3 selection of databases

Although Zabbix supports Oracle, PostgreSQL, IBM DB2, MySQL and SQLite databases, it is recommended to use MySQL databases in production environments because MySQL databases are used in the development of Zabbix backend databases, and MySQL databases should be used to achieve the best performance of Zabbix. Unless you can only use Oracle databases in your environment, it is not recommended. Zabbix using Oracle may have some performance problems. The IBM DB2 database is currently in the experimental stage and is not recommended. There is no problem with using SQLite 3 as the database in Zabbix proxy, but the concurrent access to the database by server and web front-end may cause database damage when SQLite 3 Zabbix v2.4 and above cannot be used in Zabbix server.

There are currently two derivative versions of the MySQL database: Percona and MariaDB, and the recommended selection order in the build environment is Percona à MariaDB à Oracle MySQL.

1.4.4 calculation of disk capacity

The main factors that affect the amount of disk space occupied by Zabbix are as follows:

Total number of monitoring items.

The average refresh rate of the monitoring item.

The number of days the data is retained.

The disk space occupied by a piece of data is added to the database. This value varies from database to database. In MySQL databases, adding a history or trend data record of numeric (numeric) type typically takes about 90 bytes (bytes), while records of text (text) or log (bytes) take up about 500 bytes (bytes). A new event record typically takes up about 170bytes (bytes).

The capacity of disk space can be calculated using the following formula:

Total disk capacity = configuration data + historical data + trend data + event data

Where:

Configuration data: all relevant configuration data in Zabbix is stored in the database, which takes up approximately the disk space of 10MB.

Historical data: historical records are usually kept for a period of time, such as 30 days or 1 year, which can be set according to your needs. The corresponding disk space occupied when a record is added can be calculated by the following formula:

Historical data retention days * 24 * 3600 * (total number of monitoring items / average refresh rate) * 90 bytes

Trend data: Zabbix will perform max/min/avg/count statistics on all monitoring items every hour and save the results to the trend table (trends) of the database. When a new record is added, the disk space occupied can be calculated by the following formula:

Trend data retention days * Total number of monitoring items * 24 * 90bytes

Event data: it is difficult to estimate an accurate number of events generated in Zabbix every day. We can assume that Zabbix generates one event per second, and the disk space occupied by new records can be calculated by the following formula:

Number of days of event data retention * 24 * 3600 * 170 bytes

Let's take a look at the calculation process of disk capacity through an example:

Suppose you have 3000 monitoring items that are refreshed every 60 seconds.

First of all, we need to calculate the number of monitoring items to be processed per second, that is, the total number of monitoring items / average refresh rate, 3000 / 60 = 50, which means that Zabbix will add 50 records per second to the database.

Then calculate the disk space occupied by historical data, trend data and event data respectively.

Assuming that the historical data of each monitoring item is retained for 30 days, the disk space occupied by historical data is: * 24 * 3600 * (total number of monitoring items / aPCge refresh rate) * 90 bytes, that is, (30 * 24 * 3600) * 50 * 90. It is calculated that 11.7 GB disk space is required.

Assuming that the trend data of each monitor item is retained for 5 years, the disk space capacity occupied by the trend data is: days of trend data retention * total number of monitoring items * 24 * 90bytes, that is, (5 * 24 * 365) * 3000 * 90. It is calculated that 11.8 GB disk space is required.

Assuming that each event is retained for 3 years, the disk space occupied by the event data is: the number of days of event data retention is * 24 * 3600 * 170bytes, that is, 3 * 3600 * 24 * 3600 * 170.It is calculated that 16GB disk space is required.

Database table partition

The management of expired history, trend and other data in Zabbix provides the Housekeeper function, and the expired data can be deleted automatically through Housekeeping. In the case of small monitoring scale and not a lot of data, there will be no problem with using Housekeeper. When the scale of monitoring increases, the storage capacity of the database will also increase rapidly. At this time, if you use Housekeeping to automatically delete a large number of expired data, it will take more time to complete the deletion task. While deleting expired data, it is necessary to meet the operation of new data storage and various data queries, which is prone to database performance problems, such as stutter when operating Web front-end pages, new data can not be stored normally and so on.

To solve this problem, the usual approach is to partition history, history_uint, trends, trends_uint and other data tables, as shown in figure 1-5 below.

Figure 1-5

Table partitioning brings the following benefits:

Greatly improve the query performance of a single table.

Partitioning reduces the size of the index.

Large-scale deletions can be done by deleting partitioned tables, which is faster than executing the SQL delete command.

When a query requires a wide range of access zones, using sequential scanning is more efficient than using indexes.

Therefore, according to the actual environment, if the amount of monitoring data is relatively large, it is recommended that you consider database table partitioning before installation, which is better early than late.

1.5 install Zabbix

The environment used in this book is:

OS:CentOS 7.2 (SElinux needs to be set to disable)

Web server:Apache

Database server:mariadb

Zabbix server:version 3.0.1

Like other software, Zabbix can be installed in two ways: package manager-based installation and source-based compilation installation.

Based on the benefits of the package manager installation:

Easy installation and upgrade

Automatically resolve all dependencies

Benefits of compiling and installing based on source code:

You only need to compile the features you need

Full control of the upgrade process

You can compile agent statically and use a unified version of agent on different linux platforms

There are different versions of Linux, Unix or Windows systems in a large IT infrastructure. If we use agent released by Zabbix, the version of agent used will be inconsistent, and the configuration files defined by different versions of agent may be stored in different locations, which will not be able to achieve standardized and unified management in OPS, which will put pressure on OPS. Compiling with the-- enable-static option provides us with a standardized way to easily deploy the same version of agent on different systems.

Let's start installing and configuring Zabbix server, Zabbix agent, and Zabbix proxy. In order to learn and test Zabbix, we can also install it in a virtual machine, which is not recommended in the actual production environment.

1.5.1 install Zabbix server install Zabbix source # rpm-ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm

Install MySQL server and Zabbix server

# yuminstall mariadb-server mariadb zabbix-server-mysql zabbix-web-mysql

# systemctl enable mariadb

# systemctl start mariadb.service

# / usr/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT ISRECOMMENDED FOR ALL MySQL

SERVERS IN PRODUCTION USE! PLEASEREAD EACH STEP CAREFULLY!

In order to log into MySQL to secure it,we'll need the current

Password for the root user. If you've just installed MySQL, and

You haven't set the root password yet, thepassword will be blank

So you should just press enter here.

Enter current password for root (enter fornone):

OK, successfully used password, movingon...

Setting the root password ensures thatnobody can log into the MySQL

Root user without the proper authorisation.

Set root password? [Y/n] y

New password: (set the database root user password here, which is zabbix in the example of this book)

Re-enter new password:

Password updated successfully!

Reloading privilege tables..

... Success!

By default, a MySQL installation has ananonymous user, allowing anyone

To log into MySQL without having to have auser account created for

Them. This is intended only for testing, and to make the installation

Go a bit smoother. You should remove them before moving into a

Production environment.

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connectfrom 'localhost'. This

Ensures that someone cannot guess at theroot password from the network.

Disallow root login remotely? [Y/n] y

... Success!

By default, MySQL comes with a databasenamed 'test' that anyone can

Access. This is also intended only for testing, and should be removed

Before moving into a productionenvironment.

Remove test database and access to it? [Y/n] y

-Dropping test database...

... Success!

-Removing privileges on test database...

... Success!

Reloading the privilege tables will ensurethat all changes made so far

Will take effect immediately.

Reload privilege tables now? [Y/n] y

... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MySQL

Installation should now be secure.

Create a Zabbix database

# mysql-u root-p

MariaDB [(none)] > create database zabbixcharacter set utf8 collate utf8_bin

MariaDB [(none)] > use zabbix

MariaDB [(none)] > grant all privilegeson zabbix.* to zabbix@'%' identified by 'zabbix'

MariaDB [(none)] > flush privileges

MariaDB [(none)] > exit

# cd/usr/share/doc/zabbix-server-mysql-3.0.0

# zcatcreate.sql.gz | mysql-uroot-pzabbix zabbix

Create a table in the zabbix database, where-uroot is the root user of the database, and-pzabbix is the password zabbix of the database root user.

Modify the configuration file of Zabbix server

# vi/etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix (the password set for you here, set to zabbix in the example of this book)

Allow and start the Zabbix server

# systemctl enable zabbix-server

# systemctl start zabbix-server

Check whether the Zabbix server starts properly

# cat / var/log/zabbix/zabbix_server.log

2924:20160302:155929.675 Starting ZabbixServer. Zabbix 3.0.1 (revision 58734).

2924Rom 20160302Rose 155929.675 * Enabledfeatures *

2924:20160302:155929.675 SNMPmonitoring: YES

2924:20160302:155929.675 IPMImonitoring: YES

2924:20160302:155929.675 Web monitoring: YES

2924:20160302:155929.675 VMwaremonitoring: YES

2924:20160302:155929.676 SMTPauthentication: YES

2924:20160302:155929.676 Jabbernotifications: YES

2924:20160302:155929.676 Ez Textingnotifications: YES

2924:20160302:155929.676 ODBC: YES

2924:20160302:155929.676 SSH2 support: YES

2924:20160302:155929.676 IPv6 support: YES

2924:20160302:155929.676 TLS support: YES

2924Rol 20160302 Flex 155929.676 *

2924:20160302:155929.676 using configurationfile: / etc/zabbix/zabbix_server.conf

2924Rol 20160302 current databaseversion 155929.694 (mandatory/optional): 0300000Univer 03000000

2924:20160302:155929.694 required mandatoryversion: 03000000

2924:20160302:155929.698 server # 0 started [main process]

2929:20160302:155929.698 server # 1 started [configuration syncer # 1]

2930:20160302:155929.698 server # 2 started [db watchdog # 1]

2932:20160302:155929.699 server # 3 started [poller # 1]

2952:20160302:155929.704 server # 23 started [history syncer # 4]

2944:20160302:155929.704 server # 15 started [alerter # 1]

2946:20160302:155929.704 server # 17 started [timer # 1]

2934:20160302:155929.704 server # 5 started [poller # 3]

2935:20160302:155929.710 server # 6 started [poller # 4]

2938:20160302:155929.715 server # 9 started [trapper # 1]

2940:20160302:155929.717 server # 11 started [trapper # 3]

2936:20160302:155929.720 server # 7 started [poller # 5]

2949:20160302:155929.729 server # 20 started [history syncer # 1]

2950:20160302:155929.729 server # 21 started [history syncer # 2]

2942:20160302:155929.730 server # 13 started [trapper # 5]

2937:20160302:155929.731 server # 8 started [unreachable poller # 1]

2954:20160302:155929.731 server # 25 started [proxy poller # 1]

2933:20160302:155929.733 server # 4 started [poller # 2]

2939:20160302:155929.741 server # 10 started [trapper # 2]

2941:20160302:155929.747 server # 12 started [trapper # 4]

2943:20160302:155929.749 server # 14 started [icmp pinger # 1]

2945:20160302:155929.749 server # 16 started [housekeeper # 1]

2947:20160302:155929.749 server # 18 started [http poller # 1]

2951:20160302:155929.749 server # 22 started [history syncer # 3]

2955:20160302:155929.749 server # 26 started [self-monitoring # 1]

2953:20160302:155929.749 server # 24 started [escalator # 1]

2948:20160302:155929.752 server # 19 started [discoverer # 1]

When you see the above message, it indicates that zabbix is installed and started successfully.

3019 Access denied for user'zabbix'@'localhost' to database 20160302 zsabbix' 160415.128 [Z3001] Access denied for user'zabbix'@'localhost' to database 'zsabbix' failed: [1044]

3019:20160302:160415.128 Cannot connect tothe database. Exiting...

If you see the above message that the Zabbix server is not started properly, please check whether the parameters DBHost, DBName, DBUser and DBPassword are set correctly in the configuration file / etc/zabbix/zabbix_server.conf:

Set up a firewall

# firewall-cmd--permanent-add-port=10051/tcp

# firewall-cmd-reload

Check that ports 10051 and 10050 are registered in / etc/service:

# grep1005 / etc/services

Zabbix-agent 10050/tcp # Zabbix Agent

Zabbix-agent 10050/udp # Zabbix Agent

Zabbix-trapper 10051/tcp # Zabbix Trapper

Zabbix-trapper 10051/udp # Zabbix Trapper

Now that we have installed and configured the Zabbix server and MySQL database, we can optimize the configuration of Zabbix server as needed. When we are ready to make changes to the configuration file, we can make a copy of the configuration file that is in use and modify it. When finished, we can use the-c parameter to start the Zabbix server with the new configuration file to check the correctness of the parameter configuration in the configuration file.

# / sbin/zabbix_server-c

Where is the modified configuration file.

1.5.2 install Zabbix agent

Zabbix agent is a small program, about the size of 320KB, and agent is installed in all Zabbix servers so that we can monitor local resources on the Zabbix server. When we need to monitor other servers, we just need to install agent.

When you install agent in the Zabbix server, the Zabbix source is already installed in the server, so you can install it directly through the yum command. Before installing agent on another server, install and set up the Zabbix source as described earlier.

Install agent

# yum install zabbix-agent

Set up a firewall

# firewall-cmd-permanent-add-port=10050/tcp

# firewall-cmd-reload

Modify agent configuration file

# vi/etc/zabbix/zabbix_agentd.conf

Server=

< zabbix server的IP地址>

# you need to set the server from which to connect to agent in passive mode

In ServerActive= # active mode, you need to set which server to send data to.

Hostname= # must be set in active mode, but not in passive mode

For the setting of Zabbix agent active mode and passive mode, please refer to Chapter 3.

Multiple Zabbix servers can connect to an agent at the same time to obtain the monitoring data of the IP side, and each server address is separated by a comma when set. For example: Server=192.168.2.100192.168.10.2.

Start agent

# systemctl enable zabbix-agent

# systemctl start zabbix-agent

Check whether agent starts normally.

# cat/var/log/zabbix/zabbix_agentd.log

6489:20160303:112252.464 Starting Zabbix Agent [zabbixsrv]. Zabbix 3.0.1 (revision 58734).

* Enabled features *

6489:20160303:112252.464 IPv6 support: YES

6489:20160303:112252.464 TLS support: YES

6489Flex 20160303 Flex 112252.464 * *

6489:20160303:112252.464 using configuration file:/etc/zabbix/zabbix_agentd.conf

6489:20160303:112252.464 agent # 0 started [main process]

6490:20160303:112252.465 agent # 1 started [collector]

6491:20160303:112252.465 agent # 2 started [listener # 1]

6492:20160303:112252.465 agent # 3 started [listener # 2]

6493:20160303:112252.467 agent # 4 started [listener # 3]

If you see the above message, Zabbix agent started successfully. If you see the following information in the log:

2155:20150907:220219.494 no active checks on server [192.168.0.116:10051]: host [Zabbix server] not monitored

Don't worry, this is because the parameter ServerActive is not set. When anget is installed successfully, this parameter is set to 127.0.0.1 by default. If you use active mode, you need to set ServerActive to the address of Zabbix server and set the parameter Hostname (Zabbix server is set by default after successful installation of agent). If you are sure not to use active mode, you can comment out the parameter before the configuration file. It is recommended that when configuring anget, configure Server, ServerActive and Hostname parameters at the same time.

After modifying the Zabbix agent configuration file, remember to restart the agent service, otherwise the modified parameters will not take effect.

1.5.3 install Zabbix Web GUI

We have installed the Zabbix source in the Zabbix server, which can be installed directly through the yum command. Before installing web pages on other servers, install and set up the Zabbix source as described earlier.

Install Web GUI components

# yum install zabbix-web zabbix-web-mysql

Set up the configuration of php

# vi/etc/httpd/conf.d/zabbix.conf

Php_value date.timezone Asia/Shanghai

Set up a firewall

# firewall-cmd-permanent-add-service=http

# firewall-cmd-reload

Set up the httpd service

# systemctl enable httpd

# systemctl start httpd

Now that we have completed the installation of the web front-end system, you can reboot the server with the reboot command and check the log after the system restart to see if all the components start properly.

Next, we enter http://192.168.0.22/zabbix in the web browser to enter the web page (192.168.0.22 change to your own server address). Do you see it? The welcome page of Zabbix 3.0 appears. Are you happy at this time? This is shown in figure 1-5 below.

Figure 1-6

Click the Next step button in the lower right corner of the page to enter the php configuration check page, where Zabbix will check the configuration of php, usually Zabbix will provide relevant configuration files, the only thing we need to do is to set timezone, if there is something wrong with some parameters, you can solve it by checking the configuration file of Zabbix. This is shown in figure 1-7 below.

Figure 1-7

When you confirm that all php projects are displayed as OK, click Next step to enter the database configuration page, where we need to fill in the connection information of the database (which we have set when installing the database). After filling in the relevant information, we can proceed to the next step. This is shown in figure 1-8 below.

Figure 1-8

Click Next step to enter the Zabbix server configuration page. In the Zabbixserver details page, you need to fill in the host name or IP address of Zabbixserver, as well as the port number. Generally, this information will be filled in automatically. If not, you can add it yourself. Name is optional and can be set if you like. This is shown in figure 1-9 below.

Figure 1-9

Click Next step to go to the configuration information preview page, which displays the information set in the previous steps. You can check again if it is correct. This is shown in figure 1-10 below.

Figure 1-10

Click Next step, and the installation page appears, which prompts you that the Zabbix front end has been successfully installed and the configuration file zabbix.conf.php has been created in the directory / etc/zabbix/web/. This is shown in figure 1-11 below.

Figure 1-11

Click the Finish button in figure 1-11 above to complete the configuration installation of Zabbix web.

On the login page at the front end of Web, we enter the default user name and password of Zabbix, user name: Admin, password: zabbix, and be sure to pay attention to the case of the user name here. This is shown in figure 1-12 below.

Figure 1-12

After entering the correct user name and password, click the Sign in button to log in to the system, or click the signin guest link to log in to the system as the Guest user. The Web page after login is shown in figure 1-13 below.

Figure 1-13

Set up web Chinese pages

1. Edit the locales.inc.php file to enable simplified Chinese. Modify the 'display' = > true of zh_CN. After v3.0.3, Zabbix defaults to true.

# vi / usr/share/zabbix/include/locales.inc.php

'zh_CN' = > [' name' = > _ ('Chinese (zh_CN)'), 'display' = > false]

2. Click the Admin icon on the Zabbix web page. This is shown in figure 1-14 below.

Figure 1-14

3. Select Chinese (zh_CN) in Language and click the Update button to save. As shown in figure 1-15 below.

Figure 1-15

3, refresh the web page, we can see the Chinese, but in the graphics page can not be displayed in Chinese, this is because of the font. This is shown in figure 1-16 below.

Figure 1-16

4. Copy Chinese fonts such as simkai.ttf to / usr/share/fonts/

# ll / usr/share/fonts

Total 11520

Total 11516

Drwxr-xr-x 2 root root 4096 Mar 2 15:26 dejavu

-rw-r--r-1 root root 11785184 Mar 3 12:53 simkai.ttf

5. Add fonts to the Zabbix web page

# ll / usr/share/zabbix/fonts

Total 0

Lrwxrwxrwx 1 root root 33 Mar 3 12:56 graphfont.ttf-> / etc/alternatives/zabbix-web-font

# alternatives-- install/usr/share/zabbix/fonts/graphfont.ttf zabbix-web-font / usr/share/fonts/simkai.ttf100

# alternatives-display zabbix-web-font

Zabbix-web-font-status is manual.

Linkcurrently points to / usr/share/fonts/dejavu/DejaVuSans.ttf

/ usr/share/fonts/dejavu/DejaVuSans.ttf-priority 10

/ usr/share/fonts/simkai.ttf-priority 100

Current `best' version is / usr/share/fonts/simkai.ttf. (the current font is simkai.ttf)

If the current font is not simkai.ttf, you can execute the command setting.

# alternatives-config zabbix-web-font

There are 2 programs which provide'zabbix-web-font'.

Selection Command

+ 1 / usr/share/fonts/dejavu/DejaVuSans.ttf

* 2 / usr/share/fonts/simkai.ttf

Enter to keep the current selection [+], ortype selection number: 2 (select simkai.ttf here)

6. Refresh the web page and display it normally in Chinese, as shown in figure 1-17 below.

Figure 1-17

1.5.5 Source Code compilation and installation

1. Download the Zabbix source code package from the Zabbix official website and save it to the / usr/src directory, and decompress the source code package.

# tar-zxvf zabbix-3.0.1.tar.gz

# cd / usr/src/zabbix-3.0.1

We need to install Apache,MySQL,PHP and some other libraries.

# yum install httpd mariadb-server php php-mysql php-bcmath php-mbstring php-gdphp-xml

3. Configure the database.

# systemctl enable mariadb

# systemctl start mariadb.service

# / usr/bin/mysql_secure_installation

# mysql-u root-p

MariaDB [(none)] > create database zabbix character set utf8collate utf8_bin

MariaDB [(none)] > grant all privileges on zabbix.* to zabbix@'%'identified by 'zabbix'

MariaDB [(none)] > flush privileges

MariaDB [(none)] > exit

# / usr/src/zabbix-3.0.1/database/mysql

# mysql-uzabbix-p zabbix < schema.sql

# mysql-uzabbix-p zabbix < p_w_picpaths.sql

# mysql-uzabbix-p zabbix < data.sql

4. Create zabbix users and groups:

# groupadd zabbix

# useradd-g zabbix zabbix

5. In order to compile smoothly, we need to install some additional packages, and you may need to add EPEL sources:

# yum install gcc mysql-devellibxml2-devel net-snmp-devel

Curl-devel unixODBC-develOpenIPMI-devel libssh3-devel iksemel-devel openldap-devel

View supported configuration options:

#. / configure-help

Select configuration options as needed:

# / configure-- enable-server--with-mysql-- enable-ipv6-- with-net-snmp-- with-libcurl-- with-libxml2--with-openipmi-- with-unixodbc-- with-ssh3-- with-ldap-- with-jabber-- with-mbedtls

When the configuration is completed correctly, you can see the message from make install, and if you encounter an error, it will indicate which library has a problem.

Compile and install:

# make install

After completing the compilation and installation, the standard configuration file is in / usr/local/etc/ and the Zabbix server file is in / usr/local/sbin/. You can specify the installation location with the-- prefix parameter, for example:-- prefix=/, uses / replaces / usr/local, and the compiled files will be installed to / sbin, / lib, / etc, etc.

6. Define zabbix-server service.

# cd / usr/lib/systemd/system/

# vi zabbix-server.service

[Unit]

Description=Zabbix Server

After=syslog.target

After=network.target

[Service]

Environment= "CONFFILE=/usr/local/etc/zabbix_server.conf"

Type=forking

Restart=on-failure

KillMode=control-group

ExecStart=/usr/local/sbin/zabbix_server-c $CONFFILE

ExecStop=/bin/kill-SIGTERM $MAINPID

RestartSec=10s

[Install]

WantedBy=multi-user.target

# systemctl enable zabbix-server

# systemctl start zabbix-server

Next let's install the Zabbix web page:

# mkdir / var/www/html/zabbix

# cd / usr/src/zabbix-3.0.1/frontends/php/

# cp-a. / var/www/html/zabbix

# chown-R-no-dereference apache:apache / var/www/html/zabbix

# vi / etc/httpd/conf.d/zabbix.conf

Options FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

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 date.timezone Asia/Shanghai

# systemctl enable httpd

# systemctl start httpd

Enter the http:// server ip address / zabbix in the Web browser and complete the configuration on the web page.

The compilation and installation methods mentioned above also apply to agent and proxy.

When compiling and installing agent, you only need to configure the-- enable-agent option by using the same source package as Zabbix server, for example:

#. / configure-enable-agent

When compiling and installing proxy, you only need to configure the-- enable-proxy option by using the same source package as Zabbix server, for example:

#. / configure-enable-proxy

When you use other database products, you can use the configuration options-- with-oracle,-- with-postgresql, or-- with-ibm-db2.

This article is from http://ustogether.blog.51cto.com/8236854/1921034. If you need to reprint it, please contact the author.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report