Ubuntu 20.04 prometheus prometheus-mysqld-exporter

2023-12-18 21:56:41

Ubuntu 20.04 prometheus prometheus-mysqld-exporter

sudo apt list |grep exporter

https://www.cnblogs.com/yangzp/p/16281547.html

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libexporter-autoclean-perl/focal 0.01-1 all
libexporter-cluster-perl/focal 0.31-0ubuntu3 all
libexporter-declare-perl/focal 0.114-1 all
libexporter-easy-perl/focal 0.18-1 all
libexporter-lite-perl/focal 0.08-1 all
libexporter-renaming-perl/focal 1.19-2 all
libexporter-tidy-perl/focal 0.08-1 all
libexporter-tiny-perl/focal 1.002001-1 all
librdf-kml-exporter-perl/focal 0.003-1 all
libsub-exporter-formethods-perl/focal 0.100052-1 all
libsub-exporter-globexporter-perl/focal 0.005-1 all
libsub-exporter-perl/focal 0.987-1 all
libsub-exporter-progressive-perl/focal 0.001013-1 all
php-symfony-var-exporter/focal 4.3.8+dfsg-1ubuntu1 all
phpunit-exporter/focal 3.1.2-1 all
pim-data-exporter/focal 4:19.12.3-0ubuntu1 amd64
prometheus-apache-exporter/focal 0.7.0+ds-1 amd64
prometheus-bind-exporter/focal-updates,focal-security 0.3.0+ds-1ubuntu0.1 amd64
prometheus-bird-exporter/focal 1.2.2-1 amd64
prometheus-blackbox-exporter/focal 0.13.0+ds-2 amd64
prometheus-hacluster-exporter/focal-updates,focal-security 0.4.0-2ubuntu0.2 amd64
prometheus-haproxy-exporter/focal 0.9.0+git20180917+ds-1 amd64
prometheus-ipmi-exporter/focal-updates,focal-security 1.1.0+ds-1ubuntu0.1 amd64
prometheus-mailexporter/focal 1.0-2 amd64
prometheus-mongodb-exporter/focal 1.0.0+git20180522.e755a44-1 amd64
prometheus-mysqld-exporter/focal 0.11.0+ds-1 amd64
prometheus-nginx-exporter/focal-updates,focal-security 0.5.0+ds-2ubuntu0.1 amd64
prometheus-nginx-vts-exporter/focal 0.10.3+git20180501.43b4556+ds-2 amd64
prometheus-node-exporter-collectors/focal,now 0+git20200110.fc91c86-1 all [installed,automatic]
prometheus-node-exporter/focal-updates,focal-security,now 0.18.1+ds-2ubuntu0.1 amd64 [installed]
prometheus-pgbouncer-exporter/focal 1.7-1 all
prometheus-postfix-exporter/focal-updates,focal-security 0.2.0-2ubuntu0.1 amd64
prometheus-postgres-exporter/focal-updates,focal-security 0.8.0+ds-1ubuntu0.1 amd64
prometheus-process-exporter/focal 0.4.0+ds-1 amd64
prometheus-snmp-exporter/focal-updates,focal-security 0.16.1+ds-1ubuntu0.1 amd64
prometheus-sql-exporter/focal 0.2.0.ds-6 amd64
prometheus-squid-exporter/focal-updates,focal-security 1.8.2+ds-1ubuntu0.1 amd64
prometheus-trafficserver-exporter/focal 0.3.2-1 all
prometheus-varnish-exporter/focal-updates,focal-security 1.5.2-1ubuntu0.1 amd64
python3-mplexporter/focal 0.0.1+20140921-4 all

sudo apt install prometheus-node-exporter
prometheus-mysqld-exporter_0.11.0+ds-1_amd64.deb

service prometheus-mysqld-exporter status

数据库修改 参考
https://blog.csdn.net/wowocpp/article/details/134831513

sudo mysql -u root -p
select user from mysql.user ;
select host,user from mysql.user;
use mysql;
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘123456’;
flush privileges;
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
sudo service mysql restart
mysql -u root -p
CREATE USER ‘mysqld_exporter’@‘localhost’ IDENTIFIED BY ‘Password’ WITH MAX_USER_CONNECTIONS 3;
CREATE USER ‘mysqld_exporter’@‘localhost’ IDENTIFIED BY ‘123456’ WITH MAX_USER_CONNECTIONS 3;
GRANT PROCESS, REPLICATION CLIENT, SELECT ON . TO ‘mysqld_exporter’@‘localhost’;
FLUSH PRIVILEGES;

https://www.cnblogs.com/tufeixiaopengyou/p/14119544.html
DATA_SOURCE_NAME=“mysqld_exporter:Password@(127.0.0.1:3306)/”

DATA_SOURCE_NAME=“mysqld_exporter:123456@(127.0.0.1:3306)/”

sudo service prometheus-mysqld-exporter start
sudo service prometheus-mysqld-exporter status

查看一下 有没有问题
http://192.168.99.55:9104

sudo sudo systemctl enable prometheus-mysqld-exporter

到 prometheus server 上面配置

https://blog.csdn.net/nvd11/article/details/128030197

sudo systemctl status prometheus

sudo vi /etc/prometheus/prometheus.yml

  - job_name: 'mysqld_exporter'
    scrape_interval: 5s
    static_configs:
              - targets: ['192.168.99.55:9104']

sudo systemctl daemon-reload
sudo systemctl start prometheus.service
sudo systemctl enable prometheus.service
sudo systemctl status prometheus.service

sudo systemctl restart prometheus.service

http://192.168.99.40:9090/targets

登录grafana查看效果
http://192.168.99.40:3000/

https://grafana.com/grafana/dashboards/7362
https://grafana.com/grafana/dashboards/

在这里插入图片描述

文章来源:https://blog.csdn.net/wowocpp/article/details/135062155
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。