当前位置:网站首页>Zabix5.0-0 - agent2 monitoring MariaDB database (Linux based)

Zabix5.0-0 - agent2 monitoring MariaDB database (Linux based)

2022-06-24 17:15:00 TX-QGS

At least two virtual machines are required for testing

A server ( Monitoring terminal )jk 

A client ( By monitoring the ) Necessary conditions and installation agent2

Deploy zabbix-agent2 And verification , Collect data , Detect other virtual machines ( The server ), Install... On other virtual machines azbbix-agent2(go Language )

Turn off firewall

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl disable --now firewalld
yum install ntpdate -y

Synchronization time , And time zone

ntpdate -u ntp.huaweicloud.com  
 or ( A choice , Don't change , Unknown errors may occur when changing ~)
ntpdate -u ntp.aliyun.com

Check the time

date

Time zone unification

mv /etc/localtime{,.bak}

ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Deploy azbbix-agent2(go Language )

Operate again , install zabbix rpm Source ( Use Huawei cloud zabbix Source or alicloud zabbix Source )

# With Huawei cloud zabbix Source 
rpm -Uvh https://mirrors.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.huaweicloud.com/zabbix#' /etc/yum.repos.d/zabbix.repo
( Choose one of the two sources , Don't change , Unknown errors may occur when changing ~)
 or # Alibaba cloud is used zabbix  Source  
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm 
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo

install azbbix-agent2

yum-y install zabbix-agent2

When prompted, enter y You can enter.

ls -l /etc/zabbix/zabbix_agent2.conf

Boot up   zabbix-agent2

systemctl enable --now zabbix-agent2
yum -y install net-tools

Check the port

netstat -tnlp|grep zabbix

View validation zabbix-agent2.service file

ls /lib/systemd/system/zabbix-agent2.service

If you need details, you can also cat see

Configure and modify the file

grep -Ev '^#|^$' /etc/zabbix/zabbix_agent2.conf
cat /var/run/zabbix/zabbix_agent2.pid  ( Different sources , There may be some changes )
ps -ef|grep zabbix
vi /etc/zabbix/zabbix_agent2.conf

:wq  Exit save

Check and see what has been modified

grep -Ev '^#|^$' /etc/zabbix/zabbix_agent2.conf

You must change everything ~ restart zabbix_agent2

systemctl restart zabbix-agent2

A server ( Monitoring terminal )jk operation

  The return value is 1, explain ping through Mysql database

zabbix_get -s IP -p 10050 -k mysql.ping["tcp://IP:3306"," user name "," password "]

The database is configured according to the above link

Mariadb Database installation steps link :https://bbs.huaweicloud.com/blogs/244673  ( The database is already installed. This step can be omitted ~!! Remember the user name and password . It's very important ~)

go back to web End http://EIP/zabbix/zabbix.php?action=dashboard.view ( take EIP Change it to your own IP Address )

To configure -》 Templates -》agent2

For database security ~~

mysql -u root -p
# Change Password 
set password for [email protected] = password(' Customize ');
# Open remote connection 
use mysql;
update user set user.Host='%' where user.User='root';
create user 'qgs'@'%' identified by 'qgs111';   #create user ' user name '@'%' identified by ' password ';
grant select,process,super on *.* to 'qgs'@'%' identified by 'qgs111';   #grant select,process,super on *.* to ' user name '@'%' identified by ' password ';  Allow all ip Connect ( Use wildcards % Express ), Only specified IP The address link will % Remove it 
flush privileges;

quit

Just the user name , password ,IP Just have the right address

The operation of monitoring multiple databases is as follows

Select Update wait

原网站

版权声明
本文为[TX-QGS]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/03/20210329190326016O.html

随机推荐