Setup Grafana Metrics Prometheus Dashboard
Video Lecture
Description
Depending on your Grafana and Prometheus versions, the pre-built Grafana Metrics dashboard may partly work or not at all.
In this video, I will show the steps that I used to get it to work.
Install the Grafana Metrics dashboard from the Prometheus Data Source ⇾ Dashboards tab.
The Prometheus service, since it is local will, retrieve Grafana stats from the URL http://127.0.0.1:3000/metrics
We need to add a scrape target into the Prometheus configuration for a job called grafana
# |
|
Scroll down and add a new job name grafana
to the scrape_configs
section.
# // existing config
- job_name: grafana
static_configs:
- targets: ['localhost:3000']
Save and restart the Prometheus service
service prometheus restart
service prometheus status
Go back into the Grafana UI, Open the Explore tab, select the Prometheus data source and filter by job
and there should be a new job named grafana
Now going back into the imported Grafana Metrics dashboard, you will begin to see some data after a few minutes.
Grafana Metrics Endpoint
Grafana will return metrics data by default.
You can verify or change the settings in the grafana.ini
file.
# |
|
Scroll down and find the metrics settings and ensure they are set as
# Metrics available at HTTP API Url /metrics
[metrics]
# Disable / Enable internal metrics
enabled = true
# Disable total stats (stat_totals_*) metrics to be generated
disable_total_stats = false
Optionally, you can also set the authentication settings of the metrics
endpoint.
basic_auth_username =
basic_auth_password =
If you changed the grafana.ini
, then you will need to restart the Grafana service.
# # |
|
The Grafana metrics will be visible at URL http://localhost:3000/metrics
.