Zabbix 5.0.0beta1 experience 1- MySQL monitoring

It has been several months since the last article was published. Recently, there are many things to resume work, which has been delayed for some time. Look back at zabbix5 The 0beta 1 version has been released! The functions of the new version are described below. 5.0 has not been officially released at present. Do not use it in production environment!!!

I Introduction to new functions

1. Detailed interface display

Since version 5.0, it has been adjusted to the left menu. The configuration and viewing parts have been separated from the function, which is more intuitiveHosts under the Monitoring menu, you can visually see the status of the hostIn the configuration menu, you can configure resources such as hostsGraphic view

2.Agent2 integration plug-in

Agent2 is written in go language, which has built-in monitoring of many components. The official has also released a plug-in development tutorial. The secondary development is more flexible. There are too many other functions to explain one by one. I'll explain them in detail later.After reading the new functions above, let's introduce the new version of the practical function MySQL monitoring

II Mysql monitoring

MySQL is the most widely used database. Using Zabbix to monitor MySQL has always been a long-term topic, and there are many tutorials. I also wrote a small component to monitor MySQL before Zabbix monitoring MySQL  Zabbix5.0 has built-in MySQL monitoring, which is very convenient to use.

1. Install Zabbix Agent2

Zabbix Server installation is no different from that before. You can directly compile and install it. At the current stage, use the source code to compile and install Agent2. The compilation requires the gcc and go language environment. Configure the go locale to CentOS 7 6 operating system as an example, download the go installation package

tar zxvf go1.14.2.linux-amd64.tar.gz -C /usr/local/

Configure environment variables, modify / etc/profile and add

export GOROOT=/usr/local/go
export GOPATH=/home/mygo
export PATH=$PATH:/usr/local/go/bin:/usr/local/zabbix/bin:/usr/local/zabbix/sbin

Make environment variables effective

source /etc/profile

Configure GoProxy

go env -w GO111MODULE=on
go env -w GOPROXY=,direct

Download the source code of Zabbix 5.0.0beta1 and compile and install it. You need to download the dependent package online during the installation process

tar zxvf zabbix-5.0.0beta1.tar.gz
cd  zabbix-5.0.0beta1
./configure --prefix=/usr/local/zabbix --enable-agent2
make install

Configure and install Zabbix Agent2

The configuration is not much different from that of the previous Agent. The configuration file ZABBIX is basically modified_ Agent2. conf

Hostname=jenkins43 Zabbix ServerIP Hostname can be configured as the server host name. Start Agent2 with the following command

 nohup /usr/local/zabbix/sbin/zabbix_agent2 -c /usr/local/etc/zabbix_agent2.conf  > myout.file 2>&1 &

Agent2 can be installed on the monitored MySQL host or on other machines. It can be monitored by remote connection to MySQL. This time, it is realized by remote connection. The environment is as follows

host Install components Zabbix Agent2 MySQL

Use the following command to create an independent monitoring user in the monitored MySQL and authorize remote access to avoid using business users

create user mon@'' identified by 'monpwd123';

Agent2 has no dependent package and can directly copy the binary file zabbix_agent2 and configuration file zabbix_agent2.conf to the target machine to complete the installation

Zabbix Server configuration

Add a host on Zabbix Server,And associate the MySQL template. Pay attention to the By Agent2 templateAnd add the following three macro variables

{$MYSQL.DSN}    	mysql Connection string, can be used TCP and Unix
tcp://myhost or UNIX: / var / run / MySQL sock
{$MYSQL.USER}   	mysql user
{$MYSQL.PASSWORD}   Corresponding user password

Here, configure the MySQL user information just created


Last DataFigure 1Figure 2


Zabbix 5.0 also has many functions, making configuration and monitoring simpler and more flexible. Write with Agent2 and go, which reduces the threshold of secondary development. Plug-in development articles will be released later, and the official version is expected to be released.

Tags: MySQL Zabbix

Posted by waldo on Tue, 10 May 2022 02:30:16 +0300