2020-06-23 00:09:42 +05:30
---
stage: Monitor
2021-01-03 14:25:43 +05:30
group: Health
2021-02-22 17:27:13 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-06-23 00:09:42 +05:30
---
2021-03-11 19:13:27 +05:30
# Grafana Configuration **(FREE SELF)**
2016-11-03 12:29:30 +05:30
2020-07-28 23:09:34 +05:30
[Grafana ](https://grafana.com/ ) is a tool that enables you to visualize time
series metrics through graphs and dashboards. GitLab writes performance data to Prometheus,
and Grafana allows you to query the data to display useful graphs.
2016-11-03 12:29:30 +05:30
## Installation
2020-07-28 23:09:34 +05:30
Omnibus GitLab can [help you install Grafana (recommended) ](https://docs.gitlab.com/omnibus/settings/grafana.html )
2019-09-04 21:01:54 +05:30
or Grafana supplies package repositories (Yum/Apt) for easy installation.
2020-04-22 19:07:51 +05:30
See [Grafana installation documentation ](https://grafana.com/docs/grafana/latest/installation/ )
2016-11-03 12:29:30 +05:30
for detailed steps.
2021-03-11 19:13:27 +05:30
Before starting Grafana for the first time, set the administration user
2020-07-28 23:09:34 +05:30
and password in `/etc/grafana/grafana.ini` . If you don't, the default password
is `admin` .
2016-11-03 12:29:30 +05:30
## Configuration
2021-03-11 19:13:27 +05:30
1. Log in to Grafana as the administration user.
1. Select **Data Sources** from the **Configuration** menu.
1. Select the **Add data source** button.
1. Select the required data source type. For example, [Prometheus ](../prometheus/index.md#prometheus-as-a-grafana-data-source ).
1. Complete the details for the data source and select the **Save & Test** button.
Grafana should indicate the data source is working.
2016-11-03 12:29:30 +05:30
## Import Dashboards
2020-07-28 23:09:34 +05:30
You can now import a set of default dashboards to start displaying useful information.
GitLab has published a set of default
2021-03-11 19:13:27 +05:30
[Grafana dashboards ](https://gitlab.com/gitlab-org/grafana-dashboards ) to get you started. To use
them:
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. Clone the repository, or download a ZIP file or tarball.
1. Follow these steps to import each JSON file individually:
2020-07-28 23:09:34 +05:30
2021-03-11 19:13:27 +05:30
1. Log in to Grafana as the administration user.
1. Select **Manage** from the **Dashboards** menu.
1. Select the **Import** button, then the **Upload JSON file** button.
1. Locate the JSON file to import and select **Choose for Upload** . Select the **Import** button.
1. After the dashboard is imported, select the **Save dashboard** icon in the top bar.
2016-11-03 12:29:30 +05:30
2021-03-11 19:13:27 +05:30
If you don't save the dashboard after importing it, the dashboard is removed
when you navigate away from the page. Repeat this process for each dashboard you wish to import.
2016-11-03 12:29:30 +05:30
2020-07-28 23:09:34 +05:30
Alternatively, you can import all the dashboards into your Grafana
instance. For more information about this process, see the
[README of the Grafana dashboards ](https://gitlab.com/gitlab-org/grafana-dashboards )
repository.
2016-11-03 12:29:30 +05:30
2019-09-30 21:07:59 +05:30
## Integration with GitLab UI
2020-06-23 00:09:42 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/61005) in GitLab 12.1.
2019-09-30 21:07:59 +05:30
2020-07-28 23:09:34 +05:30
After setting up Grafana, you can enable a link to access it easily from the
GitLab sidebar:
2019-09-30 21:07:59 +05:30
2021-04-17 20:07:23 +05:30
1. Go to the **Admin Area > Settings > Metrics and profiling** .
2020-03-13 15:44:24 +05:30
1. Expand **Metrics - Grafana** .
2020-07-28 23:09:34 +05:30
1. Check the **Enable access to Grafana** checkbox.
1. Configure the **Grafana URL** :
- *If Grafana is enabled through Omnibus GitLab and on the same server,*
leave **Grafana URL** unchanged. It should be `/-/grafana` .
- *Otherwise,* enter the full URL of the Grafana instance.
2019-09-30 21:07:59 +05:30
1. Click **Save changes** .
2020-07-28 23:09:34 +05:30
2020-10-24 23:57:45 +05:30
GitLab displays your link in the **Admin Area > Monitoring > Metrics Dashboard** .
2019-09-30 21:07:59 +05:30
2019-10-12 21:52:04 +05:30
## Security Update
2020-07-28 23:09:34 +05:30
Users running GitLab version 12.0 or later should immediately upgrade to one of the
following security releases due to a known vulnerability with the embedded Grafana dashboard:
2019-10-12 21:52:04 +05:30
- 12.0.6
- 12.1.6
2020-07-28 23:09:34 +05:30
After upgrading, the Grafana dashboard is disabled, and the location of your
existing Grafana data is changed from `/var/opt/gitlab/grafana/data/` to
`/var/opt/gitlab/grafana/data.bak.#{Date.today}/` .
2019-10-12 21:52:04 +05:30
To prevent the data from being relocated, you can run the following command prior to upgrading:
2020-03-13 15:44:24 +05:30
```shell
2019-10-12 21:52:04 +05:30
echo "0" > /var/opt/gitlab/grafana/CVE_reset_status
```
To reinstate your old data, move it back into its original location:
2020-03-13 15:44:24 +05:30
```shell
2019-10-12 21:52:04 +05:30
sudo mv /var/opt/gitlab/grafana/data.bak.xxxx/ /var/opt/gitlab/grafana/data/
```
However, you should **not** reinstate your old data _except_ under one of the following conditions:
2021-03-11 19:13:27 +05:30
1. If you're certain that you changed your default administration password when you enabled Grafana.
2020-07-28 23:09:34 +05:30
1. If you run GitLab in a private network, accessed only by trusted users, and your
Grafana login page has not been exposed to the internet.
2019-10-12 21:52:04 +05:30
2020-07-28 23:09:34 +05:30
If you require access to your old Grafana data but don't meet one of these criteria, you may consider:
2020-04-08 14:13:33 +05:30
1. Reinstating it temporarily.
2020-04-22 19:07:51 +05:30
1. [Exporting the dashboards ](https://grafana.com/docs/grafana/latest/reference/export_import/#exporting-a-dashboard ) you need.
1. Refreshing the data and [re-importing your dashboards ](https://grafana.com/docs/grafana/latest/reference/export_import/#importing-a-dashboard ).
2020-04-08 14:13:33 +05:30
2021-02-22 17:27:13 +05:30
WARNING:
2020-07-28 23:09:34 +05:30
These actions pose a temporary vulnerability while your old Grafana data is in use.
Deciding to take any of these actions should be weighed carefully with your need to access
existing data and dashboards.
2019-10-12 21:52:04 +05:30
2020-07-28 23:09:34 +05:30
For more information and further mitigation details, please refer to our
[blog post on the security release ](https://about.gitlab.com/releases/2019/08/12/critical-security-release-gitlab-12-dot-1-dot-6-released/ ).
2019-10-12 21:52:04 +05:30
2016-11-03 12:29:30 +05:30
Read more on:
2020-03-13 15:44:24 +05:30
- [Introduction to GitLab Performance Monitoring ](index.md )
2016-11-03 12:29:30 +05:30
- [GitLab Configuration ](gitlab_configuration.md )