[LINUX] The story of building Zabbix 4.4

Introduction

I wanted to touch Zabbix, so I built it with GCP and at the time of building (February 2020) with the latest version of Zabbix 4.4.

Constitution

First, create an instance for Zabbix server. I created it as follows. Regarding machine specifications, the required specifications will change depending on the number of monitoring targets and the number of monitoring items to be registered. This time it's a test, so it's appropriate.

item Contents
Instance name zabbix-server
region us-central1
zone us-central1-f
Machine type n1-standard-2 (vCPU x 2, memory 7.5 GB)
Boot disk CentOS 7
IP address Create a static IP address

The environment used is as follows.

item Contents
OS CentOS 7.7
Middleware Apache
MariaDB
PHP
Zabbix server 4.4
Zabbix agent 4.4

procedure

** List of sites that I referred to **

-Zabbix Official Documentation --Qiita's Zabbix related articles

1. Installation of required packages

Add Zabbix repository. If a new version is released, please check from the official repository below.

Zabbix Official Repository

Install the repository configuration package.

$ rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

Next, install the necessary packages as a prerequisite. For php, use group install to install related packages as well.

#Installation of required packages
$ yum install httpd

$ yum install mariadb mariadb-server

$ yum groupinstall php

Then install the required packages on Zabbix server. You will be asked yes / no several times, but please proceed with y. If it is troublesome, add -y to the issue command and execute it, all will be executed with y.


$ yum install zabbix-web-mysql zabbix-web-japanese zabbix-server-mysql

2. Set various things

First, set up Zabbix server.


#Edit configuration file-Uncomment the line and set the DB password
$ vi /etc/zabbix/zabbix_server.conf
The following changes
-------------------------------------------------
# DBPassword=
↓
DBPassword=xxxxxxxxxx <---Enter any password here
-------------------------------------------------

Next, set the DB.

#Enable auto-start setting
$ systemctl enable mariadb
#Service startup
$ systemctl start mariadb

#Perform initial DB settings
# yes/You will be asked no several times, but all[y]Please proceed with. Password is zabbix_server.I made it the same as the one set in conf.
$ mysql_secure_installation

#Login to DB
$ mysql -u root -p <password>

#Database zabbix character set utf8 collat e utf8_Create a bin.
MariaDB [(none)]> CREATE DATABASE zabbix character set utf8 collate utf8_bin;

MariaDB [(none)]> CREATE USER [email protected] IDENTIFIED BY '<password>';

MariaDB [(none)]> GRANT ALL ON zabbix.* TO [email protected];

MariaDB [(none)]> quit
Bye

Load the schema file for Zabbix into the database.

$ zcat /usr/share/doc/zabbix-server-mysql-4.4.*/create.sql.gz | mysql -u zabbix -p zabbix
Enter password:← Enter the password of DB user zabbix

Disable SELinux settings and restart the OS.

$ vi /etc/sysconfig/selinux
#changes
SELINUX=enforcing
↓
SELINUX=disabled

#Reboot
$ reboot

Firewall settings (zabbix server side)


$ firewall-cmd --add-port=10051/tcp --zone=public --permanent
success
$ firewall-cmd --add-service=http --zone=public --permanent
success
$ firewall-cmd --reload
success

Set Apache's automatic start and start the service.

$ systemctl enable httpd
$ systemctl start httpd

Roughly at least the settings on the Zabbix server side are over.

3. Monitoring target settings

From here, the settings will be made on the monitored side.

Installation of zabbix-agent


#Add Zabbix repository
$ rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm

$ yum install zabbix-agent

Edit configuration file

$ vi /etc/zabbix/zabbix_agentd.conf
#Enable remote command monitoring,Uncomment and change the value to 1
#The following changes
# EnableRemoteCommands=0
↓
EnableRemoteCommands=1

#Server IP address that allows monitoring
#Change to Zabbix server IP address
Server=127.0.0.1
↓
Server=xxx.xxx.xxx.xxx

#IP address of the server to which the active check monitoring data is sent
#Change to Zabbix server IP address
ServerActive=127.0.0.1
↓
ServerActive=xxx.xxx.xxx.xxx

#Note that it is not the host name on the OS, but the host name on Zabbix monitoring settings.
Hostname=Zabbix server
↓
Hostname=myhost01

Set automatic start of zabbix-agent and start service.

$ systemctl enable zabbix-agent

$ systemctl start zabbix-agent

Firewall settings (monitored server side)


$ firewall-cmd --add-port=10050/tcp --zone=public --permanent

$ firewall-cmd --add-source=<IP address of Zabbix server here> --zone=public --permanent

$ firewall-cmd --reload

Roughly at least the settings on Zabbix-agent side are completed.

Let's take a look at the management screen!

http://ZabbixサーバのIPアドレス/zabbix/

Follow the instructions on the screen to proceed with the initial settings スクリーンショット 2020-02-04 16.17.01.jpg

Confirm that the dashboard is displayed, and the initial setting is completed. スクリーンショット 2020-07-03 22.03.38(2).jpg

Up to this point, the settings until monitoring can be taken are complete. Thank you for your hard work.

As an aside, I personally recommend a dark theme that is easy on the eyes. It can be set from the following. スクリーンショット 2020-07-03 22.10.01(2).jpg

The dashboard looks like this スクリーンショット 2020-07-03 22.10.36(2).jpg

Summary

After that, I tried to monitor the previously built Minecraft server and discord-bot server, Zabbix is good, I really like it ^^

I wanted to try various things and study so that I could use Zabbix more. See you again!

Recommended Posts

The story of building Zabbix 4.4
The story of sys.path.append ()
[Apache] The story of prefork
The story of building the fastest Linux environment in the world
The story of participating in AtCoder
The story of the "hole" in the file
The story of remounting the application server
The story of writing a program
The story of trying to reconnect the client
The story of an error in PyOCR
The story of verifying the open data of COVID-19
The story of adding MeCab to ubuntu 16.04
The story of making Python an exe
The story of making an immutable mold
The story of manipulating python global variables
The story of trying deep3d and losing
The story of deciphering Keras' LSTM model.predict
The story of blackjack A processing (python)
The story of pep8 changing to pycodestyle
The story of doing deep learning with TPU
The story of low learning costs for Python
The story of making the Mel Icon Generator version2
Image processing? The story of starting Python for
The story of making a lie news generator
The story of finding the optimal n in N fist
The story of misreading the swap line of the top command
The story of reading HSPICE data in Python
The story of trying Sourcetrail × macOS × VS Code
The story of viewing media files in Django
The story of making a mel icon generator
I want to customize the appearance of zabbix
[Small story] Download the image of Ghibli immediately
The story of moving from Pipenv to Poetry
The meaning of self
the zen of Python
Revenge of the Types: Revenge of types
The story of launching a Minecraft server from Discord
A story that reduces the effort of operation / maintenance
The story of Python without increment and decrement operators.
The story of stopping the production service with the hostname command
The story of replacing Nvidia GTX 1650 with Linux Mint 20.1.
The story of Hash Sum mismatch caused by gcrypto20
The story of sharing the pyenv environment with multiple users
The story of making a music generation neural network
The story of FileNotFound in Python open () mode ='w'
A story about changing the master name of BlueZ
The story that the return value of tape.gradient () was None
Zip 4 Gbyte problem is a story of the past
A story that analyzed the delivery of Nico Nama.
AttributeError: The story of solving module'tensorflow' has no attribute'log'.
The story of automatic language conversion of TypeScript / JavaScript / Python
The story of wanting to buy Ring Fit Adventure
The story of using circleci to build manylinux wheels
Align the version of chromedriver_binary
The story of creating a VIP channel for in-house chatwork
Scraping the result of "Schedule-kun"
10. Counting the number of lines
Towards the retirement of Python2
The story of implementing the popular Facebook Messenger Bot with python
The story of how the Python bottle worked on Sakura Internet
The story of introducing jedi (python auto-completion package) to emacs