How to Monitor MySQL/MariaDB through Prometheus & Grafana ?
ฝัง
- เผยแพร่เมื่อ 26 ส.ค. 2024
- Please follow the below steps to install mysqld_exporter.
curl -s api.github.com... | grep browser_download_url | grep linux-amd64 | cut -d '"' -f 4 | wget -qi -
tar xvf mysqld_exporter*.tar.gz
sudo mv mysqld_exporter-*.linux-amd64/mysqld_exporter /usr/local/bin/
sudo chmod +x /usr/local/bin/mysqld_exporter
CREATE USER mysqld_exporter IDENTIFIED BY 'PASSWD';
GRANT PROCESS, REPLICATION CLIENT, SELECT ON . TO 'mysqld_exporter';
FLUSH PRIVILEGES;
EXIT
Configure DB Credential
sudo vi /etc/.mysqld_exporter.cnf
[client]
user=mysqld_exporter
password=PASSWD
host=192.168.56.109
Change ownership
sudo chown root:prometheus /etc/.mysqld_exporter.cnf
Create Systemd File
sudo vi /etc/systemd/system/mysql_exporter.service
[Unit]
Description=Prometheus MySQL Exporter
After=network.target
User=prometheus
Group=prometheus
[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/mysqld_exporter \
--config.my-cnf /etc/.mysqld_exporter.cnf \
--collect.global_status \
--collect.info_schema.innodb_metrics \
--collect.auto_increment.columns \
--collect.info_schema.processlist \
--collect.binlog_size \
--collect.info_schema.tablestats \
--collect.global_variables \
--collect.info_schema.query_response_time \
--collect.info_schema.userstats \
--collect.info_schema.tables \
--collect.perf_schema.tablelocks \
--collect.perf_schema.file_events \
--collect.perf_schema.eventswaits \
--collect.perf_schema.indexiowaits \
--collect.perf_schema.tableiowaits \
--collect.slave_status \
--web.listen-address=0.0.0.0:9104
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable mysql_exporter
sudo systemctl start mysql_exporter
Import Mysql Grafana Dashboard
grafana.com/gr...
prome~te~theus
😀
Your explanation is so awesome and great sir! Thank you for the tutorial, it helped me a lot!
Thank you so much Brother for your kind words. Please share my channel within your network.
sir you are greatly explained everything ............................. thank you
Thank you so much brother 🙏
it's a good video, very precise and explicative
Thank you so much Ariel for your encouraging comments. Please help me to share my channel within your friends. As despite of good contents, I have very few subscribers.
hello I wanna ask, maybe there's people can help me. So I have 2 vm for monitoring and target. I install apache in monitor-vm, and install prometheus in target-vm. So, I install mysql_exporter in monitor and configured it on prometheus. But when I starting to enter localhost:9104, I can't access it. What should I use for the host, is IP Adress from Monitor-vm or Target-vm?
may I know what kind of app you use to command?