Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Monitoring MySQL using Zabbix built-in MySQL template

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Monitoring MySQL with Zabbix's own MySQL template

1. Install zabbix agent

[root@szlinux02 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-agent-3.2.0-1.el7.x86_64.rpm[root@szlinux02 ~]# yum install zabbix-agent

2. modify the configuration

[root@szlinux02 ~]# vim /etc/zabbix/zabbix_agentd.confServer=192.168.137.5ServerActive=192.168.137.5Hostname=szlinux02

3. start the agent

[root@szlinux02 ~]# systemctl enable zabbix-agent[root@szlinux02 ~]# systemctl start zabbix-agent[root@szlinux02 ~]# netstat -tunpl | grep 10050

4. Testing data acquisition on the server side

[root@szzabbix ~]# zabbix_get -s 192.168.137.4 -p 10050 -k system.uptime

5. Add Linux hosting on zabbix page

Configuration-> Host-> Create Host

6. Connect templates for hosts

Click Select, check Template App MySQL and Template OS Linux, click Add.

7. Configuring Template App MySQL on Client

First, add permissions to mysql on the client side, that is, this machine uses zabbix account to connect to local mysql.

mysql> grant usage, process, replication client on *.* to 'zabbix'@'localhost' identified by 'ABCabc!@# 123';mysql> flush privileges;

Add. my.cnf

[root@szlinux02 ~]# vi .my.cnf

# Zabbix Agent

[mysql]

host=localhost

user=zabbix

password='ABCabc!@# 123'

socket=/usr/local/mysql/mysql.sock

[mysqladmin]

host=localhost

user=zabbix

password='ABCabc!@# 123'

socket=/usr/local/mysql/mysql.sock

8. Change the HOME of userparameter_mysql.conf to the directory where the new. my.cnf file is located

[root@szlinux02 ~]# sed -i 's@/var/lib/zabbix@/etc/zabbix@g' /etc/zabbix /zabbix_agentd.d/userparameter_mysql.conf

9. Restart zabbix-agent

[root@szlinux02 ~]# systemctl restart zabbix-agent

10. Get mysql monitoring indicator data in zabbix server test

[root@szzabbix ~]# zabbix_get -s 192.168.137.4 -p 10050 -k mysql.ping

Note:

If the test error: sh: mysql: command not found, sh: mysqladmin: command not found, modify the mysql, mysqladmin command path in userparameter_mysql.conf, use the absolute path, and then restart zabbix-agent, and then test.

Password must be quoted to read.

11. View the latest data and graphics on Web pages

Testing-> Latest data or graphics

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report