Detailed steps and solutions for installing prometheus and grafana on the testing server.
- Grafana & Prometheus Installation
- Prometheus Configuration
- Enable Service for Prometheus and Grafana
- Import Grafana Dashboard - Leeman
- Screenshots - Leeman
- References
Since the testing server does not have docker environment, so we built and used the released binary for installation.
Install Prometheus from link
tar -zxvf prometheus-2.36.0.linux-amd64.tar.gz
sudo mv prometheus-*.linux-amd64 /opt/
Install Grafana link - Install from binary .tar.gz file
tar -zxvf grafana-enterprise-8.5.4.linux-amd64.tar.gz
Configure a Linux service to restart automatically after a reboot or crash using systemctl.
The configuration file depends on where you would like to put. For me, I put it inside the installation directory.
touch /opt/prometheus/prometheus.yml.
vi /opt/prometheus/prometheus.yml
Note that ExecStart --config.file need to change where the configuration file is.
[Unit]
Description=Prometheus Server
Documentation=https://prometheus.iodocs/introduction/overview
After=network-online.target
[Service]
User=root
Restart=on-failure
ExecStart=/opt/prometheus \
--config.file /opt/prometheus/prometheus.yml
[Install]
WantedBy=default.target
sudo systemctl reload-daemon
sudo systemctl start prometheus
cd /opt/grafana-?.?.?
sudo systemctl start grafana-server
sudo systemctl enable grafana-server
sudo systemctl enable prometheus
Prometheus::9090/
Grafana::3000
- Download JSON file from github release page
- Go to domain:3000/dashboard/import
- Upload JSON file
- MySQL Uptime: Show server uptime
- Current QPS: Queries per second (update every 5 mins)
- Buffer pool size
- Network
- Perfomance
- MySQL connection
- MySQL Queries
MySQL uptime: mysql_global_status_uptime
QPS: rate(mysql_global_status_queries[$__interval]) or irate(mysql_global_status_queries[5m])
Inbound: Received Outbound: Sent Display as Graph (5mins)
rate(mysql_global_status_bytes_received[$__interval]) or
irate(mysql_global_status_bytes_received[5m])
increase(mysql_global_status_bytes_received[60m])
increase(mysql_global_status_bytes_sent[60m])
max_over_time(mysql_global_status_threads_connected{instance="YOUR ADDRESS"}[$__interval]) or
max_over_time(mysql_global_status_threads_connected{instance="{YOUR ADDRESS"}[TIME])
max_over_time(mysql_global_status_threads_running{instance="YOUR ADDRESS}[TIME]) or
max_over_time(mysql_global_status_threads_running{instance="YOUR ADDRESS"}[$__interval])
Hits / Hits + Missed
(rate(mysql_global_status_table_open_cache_hits[TIME]) or
rate(mysql_global_status_table_open_cache_hits[$__interval])) /
((rate(mysql_global_status_table_open_cache_hits[TIME]) or
rate(mysql_global_status_table_open_cache_hits[$__interval])) +
(rate(mysql_global_status_table_open_cache_misses[TIME]) or
rate(mysql_global_status_table_open_cache_misses[$__interval])))
rate(mysql_global_status_table_open_cache_hits[$__interval]) or
irate(mysql_global_status_table_open_cache_hits[5m])
The number of joins that did a full scan of the first table.
rate(mysql_global_status_select_scan[$__interval]) or
irate(mysql_global_status_select_scan[TIME])
The number of joins that perform table scans because they do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.
rate(mysql_global_status_select_full_join[$__interval]) or
irate(mysql_global_status_select_full_join[TIME])
The number of joins that used a range search on a reference table.
rate(mysql_global_status_select_full_range_join[$__interval]) or
irate(mysql_global_status_select_full_range_join[TIME])
The number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the Queries variable. This variable does not count COM_PING
, COM_STATISTICS
, COM_STMT_PREPARE
, COM_STMT_CLOSE
, or COM_STMT_RESET
commands.
rate(mysql_global_status_questions[TIME]) OR
rate(mysql_global_status_questions[$__interval])
sum(rate(mysql_global_status_commands_total{command=~"select|insert"}[TIME])) without (command)
sum(rate(mysql_global_status_commands_total{command=~"delete|update"}[TIME])) without (command)