In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This month is almost over again, and recently I am so busy that I have no time to write an article. Today, I squeeze some time to write down the article on zabbix3.0 installation and configuration.
In fact, the installation of zabbix3.0 is very simple, but because individuals are lazy, so they do not like to use source code for installation, and manage more servers, source code installation also feels inconvenient, so now most of the installation software I will first choose yum or apt-get mode.
In this article, I will not describe the detailed steps of zabbix3.0 installation, but only list the relevant installation commands of zabbix3.0 under centos and ubuntu, as well as the basic configuration of zabbix.
Zabbix3.0 requirements for OS: mysql5.0 or above, apache1.3 or above, php5.4 or above.
Note: this requirement is very important.
Zabbix server3.0 is installed on centos 7
According to the official requirements of zabbix server3.0, zabbix server3.0 cannot install yum on centos6 OS at present. If you must install zabbix server3.0 on centos6 OS, it is strongly recommended that you compile and install it in source code, and pay attention to the version of PHP.
With these factors in mind, here we are installing zabbix server3.0 on yum on centos7 OS.
Note: although zabbix server3.0 cannot be installed in yum on centos6 OS, zabbix-agent3.0 can be installed in yum on centos6 OS.
1.1 Building a lamp environment
Before installing zabbix server3.0 on centos7, we first build the lamp environment needed for zabbix.
Download the latest yum source, as follows:
Wget-P / etc/yum.repos.d http://mirrors.aliyun.com/repo/Centos-7.repo
Before we start the installation, we also need to note that the mysql that comes with centos7 is mariadb, which we can check with the following command:
Yum search mysql | tac
Now start installing the lamp environment, using the following command:
Yum-y install mariadb mariadb-server php php-mysql httpd
From the figure above, we can clearly see that php5.4, httpd2.4 and maradb5.5 are installed by default in centos7, which fully meets the software version requirements of zabbix3.0.
After lamp is installed, let's now configure the mysql database.
Set up the self-boot mysql and start the mysql, using the following command:
Systemctl enable mariadb
Systemctl start mariadb
Initialize the mysql database and configure the root user password. Use the following command:
Mysql_secure_installation
Note: at the Enter current passwdord for root in the above picture, we can just hit the enter key. Because the default root user password for mysql on centos7 is empty.
The main purpose of the above figure is to configure passwords for root users and refresh relevant permissions.
The figure above is mainly about configuring anonymous users, test users, remote connections for root users and other related configurations.
After mysql initialization, let's now create the zabbix database and its users, using the following command:
Mysql-uroot-pendant ilannie'- e "create database zabbix default character set utf8 collate utf8_bin;"
Mysql-uroot-pairilannie "grant all on zabbix.* to 'zabbix'@'%' identified by' zabbix';"
Now let's test whether the zabbix user you just created can connect to the mysql database, as follows:
Mysql-uzabbix-pzabbix
Show databases
From the figure above, we can clearly see that zabbix users can connect to the database normally.
Start apache and open port 80, as follows:
Systemctl start httpd
Netstat-tunl
Firewall-cmd-zone=public-add-port=80/tcp-permanent
Firewall-cmd-reload
Note: centos7's firewall is very different from centos6's.
Up to this point, the lamp environment has been fully built.
1.2 install zabbix server3.0
After setting up the lamp environment, we now begin to formally install zabbix3.0.
The EPEL source required to install zabbix3.0 and the yum source of zabbix are as follows:
Rpm-ivh http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
Rpm-ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
After the above installation, we will now formally install zabbix3.0, using the following command:
Yum-y install zabbix-server-mysql zabbix-web-mysql zabbix-get
From the figure above, we can clearly see that the current zabbix server is version 3.0.2.
After the above installation, we will now start to configure zabbix.
Import the zabbix database structure as follows:
Cd / usr/share/doc/zabbix-server-mysql-3.0.2/
Zcat create.sql.gz | mysql-uroot-pilanni zabbix
After the database is imported, let's modify the configuration file of zabbix sever as follows:
Vim / etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
In the above configuration file, we only need to focus on DBHost, DBName, DBUser,
Just a few items of DBPassword. These are the parameters that configure zabbix server to connect to the mysql database.
After the above modification, let's modify the zabbix.conf file again. As follows:
Vim / etc/httpd/conf.d/zabbix.conf
Alias / zabbix / usr/share/zabbix
Options FollowSymLinks
AllowOverride None
Require all granted
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 Asia/Chongqing
Php_value date.timezone Asia/Chongqing mainly defines the time zone of php.
After the above modifications are completed, we will add zabbix-server to boot and start zabbix-server, as follows:
Systemctl enable zabbix-server
Systemctl start zabbix-server
Finally, restart apache as follows:
Systemctl restart httpd
Then visit the http://192.168.1.9/zabbix/setup.php address as follows:
From the figure above, we can clearly see that zabbix3.0 has been installed correctly.
Of course, the above access address can also be customized. We only need to modify the alias in the zabbix.conf file, as follows:
Vim / etc/httpd/conf.d/zabbix.conf
After the modification, remember to restart apache, as follows:
Systemctl restart httpd
The access address has been changed to http://192.168.1.9/ilanni/setup.php, as follows:
At this point, the first half of installing zabbix server 3.0 on centos7 is complete, and the second half is in Chapter 3, "configuring zabbix3.0."
2. Zabbix server3.0 is installed on ubuntu 15
It's much easier to install zabbix server 3.0 on ubuntu 15, and we do it directly in apt-get mode. Note: zabbix server3.0 is installed in the same way on ubuntu 15 and ubuntu 14.
First, install the relevant software, as follows:
Sudo apt-get-y install gettext unzip rar
Download the zabbix server3.0 repository file and install it as follows:
Wget http://mirrors.aliyun.com/zabbix/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1%2btrusty_all.deb
Dpkg-I zabbix-release_3.0-1+trusty_all.deb
To start installing zabbix server, use the following command:
Sudo apt-get update
Sudo apt-get-y install zabbix-server-mysql zabbix-frontend-php zabbix-get
The above is the password for setting the root user of the mysql database.
After the above installation, let's now create the zabbix database and its users, as follows:
Mysql-uroot-pairilanniannie "create database zabbix default character set utf8 collate utf8_bin;" & & mysql-uroot-pamphilanni'-e "grant all on zabbix.* to 'zabbix'@'%' identified by' zabbix';"
Now let's test whether the zabbix user you just created can connect to the mysql database, as follows:
Mysql-uzabbix-pzabbix
Show databases
After the above installation and testing, we now begin to carry out the relevant configuration.
Import the zabbix database structure as follows:
Cd / usr/share/doc/zabbix-server-mysql
Zcat create.sql.gz | mysql-uroot-paired ilannian 'zabbix
After the database is imported, let's modify the configuration file of zabbix sever as follows:
Vim / etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
In the above configuration file, we only need to focus on DBHost, DBName, DBUser,
Just a few items of DBPassword. These are the parameters that configure zabbixserver to connect to the mysql database.
After the above modification, let's modify the zabbix.conf file again. As follows:
Vim / etc/apache2/conf-enabled/zabbix.conf
Alias / zabbix / usr/share/zabbix
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 always_populate_raw_post_data-1
Php_value date.timezone Asia/Chongqing
Php_value date.timezone Asia/Chongqing mainly defines the time zone of php. This is basically the same as the configuration under centos7.
After the above modifications are completed, we will add zabbix-server to boot and start zabbix-server, as follows:
Sudo systemctl enable zabbix-server
Sudo systemctl start zabbix-server
Finally, restart apache as follows:
Sudo systemctl restart apache2.service
Then visit the http://192.168.1.231/zabbix/setup.php address as follows:
From the figure above, we can clearly see that zabbix server 3.0 has been installed correctly.
At this point, the first half of installing zabbix server 3.0 on ubuntu is complete, and the second half is in Chapter 3, "configuring zabbix3.0."
3. Configure zabbix
In chapters 1 and 2, we have installed the first half of zabbix server3.0, and in this chapter we will continue to install and configure zabbix.
Note: we will no longer have a textual explanation in this chapter, all of which are pictures.
Open the zabbix3.0 page shown in the front and click next, as follows:
What we need to fill in in the above figure is that the zabbix database we created earlier already has a user and password.
Fourth, install zabbix agent
We installed zabbix server3.0 earlier, and in this chapter we introduce the installation of the zabbix agent side. The installation of zabbix agent is relatively simple, we just need to install the appropriate warehouse, and then execute the installation command.
4.1 install zabbix agent
Install agent on centos os, using the following command:
Rpm-ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
Yum clean all
Yum-y install zabbix zabbix-agent
Install agent on ubuntu os, using the following command:
Wget http://mirrors.aliyun.com/zabbix/zabbix/3.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.0-1%2btrusty_all.deb
Dpkg-I zabbix-release_3.0-1+trusty_all.deb
Sudo apt-get-y install zabbix-agent
4.2 configure zabbix agent
The configuration of zabbix agent is simple, and you only need to modify the Server, ServerActive, and Hostname items in the zabbix agent configuration file.
Where Server and ServerActive are the IP addresses of the zabbix server server, and Hostname is the IP address of the monitored end, as follows:
Vim / etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.1.231
ServerActive=192.168.1.231
Hostname=192.168.1.124
Include=/etc/zabbix/zabbix_agentd.d/
After the above configuration, when we add the monitoring machine on the zabbix web side, we only need to correspond the honst name to the hostname in the configuration file. As follows:
At this point, zabbix agent has been installed.
Fifth, zabbix web Chinese display and optimization
This chapter is divided into two parts, the first part is to configure zabbix web Chinese display, the second part is to optimize the display of Chinese.
5.1 zabbix web Chinese display
By default, zabbix web displays English. In fact, zabbix supports Chinese. We can open Chinese by modifying the source file on the web side.
Modify the / usr/share/zabbix/include/locales.inc.php file to change the false on the line of zh_CN to true, as follows:
Vim / usr/share/zabbix/include/locales.inc.php + 55
Finally, click on the avatar in the upper right corner of the zabbix web monitoring page, and select the Chinese language in the pop-up tab. As follows:
Note: if the configuration file on ubuntu OS is modified, it will still be displayed in the zabbix web background. If Chinese is not supported, ubuntu OS does not have a Chinese language pack installed. As follows:
We only need to follow the following three steps to solve the above problems.
The first step is to install the Chinese package, as follows:
Sudo apt-get-y install language-pack-zh-hant language-pack-zh-hans
The second step is to configure relevant environment variables:
Vim / etc/environment
Add language and encoding settings to the environment variable file:
LANG= "zh_CN.UTF-8"
LANGUAGE= "zh_CN:zh:en_US:en"
Step 3, reset the local configuration:
Dpkg-reconfigure locales
You can restart apache and zabbix-server services now, as follows:
Sudo systemctl restart apache2.service
Sudo systemctl restart zabbix-server.service
After changing the language, if you find that the graphics are garbled, we can make the following changes.
Modify lines 45 and 93 of the / usr/share/zabbix/include/defines.inc.php file as follows:
Vim / usr/share/zabbix/include/defines.inc.php
Define ('ZBX_GRAPH_FONT_NAME','mysh')
Define ('ZBX_FONT_NAME',' mysh')
Then download your favorite font, rename it msyh and put it in the / usr/share/zabbix/fonts directory.
5.2 Chinese display optimization
After doing the above, you will find that although zabbix web supports Chinese, there are some places where the translation is very inadequate. As follows:
According to the grapevine, the official Chinese translation of zabbix was carried out by a Chinese engineer who used traditional Chinese.
So a great god retranslated it on github, and the github connection address is as follows: https://github.com/duanzhanling/zabbix-zh_CN
The installation method is as follows:
Wget https://github.com/echohn/zabbix-zh_CN/archive/master.zip
Unzip master.zip
Rm / usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo
Cp zabbix-zh_CN-master/frontend.mo / usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo
You can restart apache and zabbix_server services now, as follows:
Sudo systemctl restart apache2.service
Sudo systemctl restart zabbix-server.service
As you can see from the picture above, the latest translation is much better than before.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.