当前位置:网站首页>[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX

[learn ZABBIX from scratch] I. Introduction and deployment of ZABBIX

2022-06-24 14:11:00 It's a bubble

 Insert picture description here

Preface

Hello everyone ,docker After the end of the article, I thought hard for a long time and didn't know what to do , After reading it, I don't think there are many articles on monitoring , So I came to write zabbix The article , Prometheus' words will go to the back ,zabbix It is also a very interesting thing , If you haven't learned it, you can learn it together , This thing is relatively simple , visualization , What you have learned can be used as a review , No more nonsense , Let's get down to business .

What is monitoring

Monitoring means monitoring , Control means , With monitoring, we can make reminders before some tragedies happen and solve them in time , Prevent tragedies from happening . For example, the computer room is overheated , Monitoring reminder , Turn on the air conditioner , Prevent tragedy from happening .

With the increase of users , The service may be blocked by the system at any time oom out of memory out of memory , How do you judge ,web The service is due to excessive user access , Reached the bottleneck ? Or program code bug As a result of , Too much memory ? To prevent this , We usually have two guarantees , One is to conduct a stress test before the website goes online , Second, monitoring , For example, this website can bear up to 3000 User access , We should set up a 70%-80% Monitoring of , When user access exceeds the capacity of the server 70% even to the extent that 80% When , We need to expand the capacity ! If not, then , Wait until it's almost full before expanding ? It's too late !

Zabbix Deploy

zabbix It's very interesting , Two versions , One LTS The version will support five years , A standard version only supports seven months , So the official website is usually updated every six months . Here we use zabbix4.0 Version of the .

1. Download source , To configure yum

zabbix Official website The visit was slow
because zabbix It's slow to download on the official website , And access is slow , The source of Tsinghua is used here .
wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
I found the address, too , You can see url Find the copy link by yourself wget It's fine too , You can use mine .
And then we decompress

rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm

 Configure after decompression yum Warehouse 

vim /etc/yum.repos.d/zabbix.repo

 We need to take baseurl= The front of this line is changed to Tsinghua ! After comparison, it can be found that Tsinghua has only changed in the front 
https://mirrors.tuna.tsinghua.edu.cn/zabbix
 So we just need to replace here 

%s#http://repo.zabbix.com#https://mirrors.tuna.tsinghua.edu.cn/zabbix#g

 Then take it. gpgcheck Such as 0, In the end the following 

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/debuginfo
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=0

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0

2. install zabbix The service side and zabbix-web front end

Here we need to change the image source to Ali , Otherwise, an error will be reported without dependency

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

yum makecache

# Installation services and web
yum install zabbix-server-mysql zabbix-web-mysql  -y

3. install mariadb, establish zabbix library , to grant authorization zabbix user

Here are instructions , We'll just keep going .

yum install mariadb-server -y

systemctl start mariadb

systemctl enable mariadb

mysql_secure_installation
 Enter this command and press enter , then n, Then all the way y That's it , This is used to delete anonymous users 

mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;

MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by '123456';

# Modify character set   Build table   Authorization, etc 

 sign out mariadb  Import zabbix Table structure and initial data 
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix

 Check zabbix Whether the library is imported successfully 
mysql -uroot  zabbix -e 'show tables'

 If the table appears, it is successful 

4. Configuration to start zabbix-server

Let's modify the configuration file here

vim /etc/zabbix/zabbix_server.conf 

DBHost=localhost 
DBName=zabbix
DBUser=zabbix
DBPassword=123456
 Just make these four the same as mine , Sure :/ lookup .

start-up zabbix-server

systemctl start zabbix-server 
systemctl enable zabbix-server

 Check the service 
netstat -lntup

If you can see zabbxi.server That's success , If there is no and no error is reported , That means your service is started but the listening port is not , Connect the firewall and selinux Try shutting down and restarting .

setenforce 0
getenforce
systemctl stop firewalld.service

If not , It's just zabbix Found in the installation directory of etc/zabbix_server.conf file , take ListenIP=0.0.0.0 Remove the previous comment

5. modify Zabbix Front-end PHP To configure , And start the httpd

vim /etc/httpd/conf.d/zabbix.conf

 find php_value date.timezone This business , Change the time zone to 
php_value date.timezone Asia/Shanghai

 Start up after saving and start up automatically 
systemctl start httpd
systemctl enable httpd

6. front end zabbix-web Installation

Then we visit http://ip/zabbix That's all right. ! Follow the prompts on the web page to register .

The login account and password are as follows
Admin
zabbix

Later revision zabbix Database password , Configuration files that need to be modified :
/etc/zabbix/web/zabbix.conf.php

You can see that the interface is like this !
 Please add a picture description

At the end

If my article helps you , I hope you can give me a concern , give the thumbs-up , Let's support it , This will be my motivation to update , At present, we are updating to learn from scratch zabbix, Prepare to update and learn from scratch kubernetes, Thank you for your support !
 Insert picture description here

原网站

版权声明
本文为[It's a bubble]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241152531043.html