Prometheus (version 2.0.0) series details, prometheus2.0.0

Source: Internet
Author: User

Prometheus (version 2.0.0) series details, prometheus2.0.0
Monitor MySQL servers

The platform is redhat 7.2 x86_64bit.

In order to visualize monitoring, Grafana is used to basically install [omitted]. For the object to be monitored, MySQL also needs to install mysqld_exporter [omitted]. This article assumes that the installation is ready.

The basic architecture of monitoring configuration is as follows:

Configure mysqld_exporter

Add a MySQL user for monitoring

mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'mysqld_exporter'@'localhost' identified by 'redhat';mysql> GRANT SELECT ON performance_schema.* TO 'mysqld_exporter'@'localhost';mysql> flush privileges;

If you specify mysqld_exporter to connect to the MySQL configuration file, you must first write the configuration file. The location is random, as shown in my:

[root@prometheus ~]# cat /etc/prometheus/.my.cnf [client]user=mysqld_exporterpassword=redhat

Specify

[Root @ prometheus ~] # Systemctl status mysqld_exporter ● mysqld_exporter.service-Prometheus exporter for MySQL server metrics. loaded: loaded (/usr/lib/systemd/system/mysqld_exporter.service; disabled; vendor preset: disabled) Active: active (running) since Mon 22:00:20 CST; 1 h 47 min ago Docs: https://github.com/prometheus/mysqld_exporter Main PID: 2680 (mysqld_exporter) CGroup:/system. slice/mysqld_exporter.service restart-2680/usr/bin/mysqld_exporter-config. my-cnf =/etc/prometheus /. my. cnf ### note that you need to modify the Systemd service to add this item

After completing the preceding configuration, restart or start mysqld_exporter.

Configure prometheus and add it to the mysql Monitoring Target
[root@prometheus ~]# tail -n 12 /etc/prometheus/prometheus.yml | head -n 6  - job_name: 'mysql'    static_configs:      - targets: ['localhost:9104']        labels:          instance: 'mysql1'

Restart the configuration or reload the prometheus Service

curl -XPOST http://ip:9090/-/reload
Download and configure a monitoring template
git clone https://github.com/percona/grafana-dashboards.gitcp -r grafana-dashboards/dashboards /var/lib/grafana/

Edit the Grafana configuration file as follows:

[root@prometheus ~]# sed -n '370,373p' /etc/grafana/grafana.ini [dashboards.json]enabled = truepath = /var/lib/grafana/dashboards

Restart or start grafana-server, and enter http: // ip: 3000 in the browser for access (default admin password)

The imported template is displayed.

Configure the data source as prometheus
Click the leftmost mark, select "Data Sources-" add data datasource ", and enter

Note:

If PrometheusURL is the endpoint urlAccess of prometheus, select proxy.

Click MySQL Overview and adjust the query conditions (click the title of each image-> edit-> metrics). The following page is displayed:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.