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

How Grafana+Prometheus monitors MySql services

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how Grafana+Prometheus monitors MySql services". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how Grafana+Prometheus monitors MySql services".

Architecture

Prometheus installation

Download address: https://prometheus.io/download

Execute the following command:

# # download wget https://github.com/prometheus/prometheus/releases/download/v2.0.0-rc.3/prometheus-2.0.0-rc.3.linux-amd64.tar.gz## Custom decompression Directory tar-xvf prometheus-2.0.0-rc.3.linux-amd64.tar.gz

Configure prometheus,vi prometheus.yml

IP corresponds to the server of our private network, and the port is the listening port of the corresponding exporter.

Run Prometheus

After the startup is successful, we can access it through the built-in web interface of Prometheus, http://ip:9090. If the following interface appears, the configuration is successful (ignore Linux1/2, which is the monitoring of the service)

MySql installation

The status and importance of MySql is self-evident, as an open source product is loved by the majority of small and medium-sized enterprises and Internet enterprises, so it is necessary for us to monitor it accordingly.

Due to the recent replacement of CentOS7, MySql is reinstalled here, and by the way, there seems to be no mysql in CentOS7's yum source by default. To solve this problem, we need to download the repo source for mysql.

List all version information:

Lsb_release-a

Download the repo source for mysql:

Wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Install the mysql-community-release-el7-5.noarch.rpm package:

Rpm-ivh mysql-community-release-el7-5.noarch.rpm

Install mysql:

Yum install mysql-server-y

Modify permissions, otherwise an error will be reported:

Chown-R root:root / var/lib/mysql

Restart the mysql service:

Service mysqld restart

Log in and reset the password:

Novice quickly build "artifact" of MySql service

Mysqld_exporter installation

Download and extract:

Mysqld_exporter needs to connect to Mysql, first create a user for it and give it the required permissions:

Create the .my.cnf file vi .my.cnf:

[client] user=exporterpassword=123456

Run mysqld_exporter:

. / mysqld_exporter-config.my-cnf= ".my.cnf" & Prometheus configuration

Modify prometheus.yml to join the MySql node:

Restart Prometheus after saving, and check targets:

Finally, log in to grafana to view MySql monitoring information:

The above is all the contents of the article "how Grafana+Prometheus monitors MySql Services". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Wechat

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

12
Report