grafana getting started title Get started with Grafana and InfluxDB Learn how to build your first InfluxDB dashboard in Grafana getting started influxdb aliases products weight 400 labels oss enterprise

Answer:
---
aliases:
  - getting-started-influxdb/
description: Learn how to build your first InfluxDB dashboard in Grafana.
labels:
  products:
    - enterprise
    - oss
title: Get started with Grafana and InfluxDB
weight: 400
---

# Get started with Grafana and InfluxDB

#### Get InfluxDB

You can [download InfluxDB](https://portal.influxdata.com/downloads/) and install it locally or you can sign up for [InfluxDB Cloud](https://www.influxdata.com/products/influxdb-cloud/). Windows installers are not available for some versions of InfluxDB.

#### Install other InfluxDB software

[Install Telegraf](https://docs.influxdata.com/telegraf/v1.18/introduction/installation/). This tool is an agent that helps you get metrics into InfluxDB. For more information, refer to [Telegraf documentation](https://docs.influxdata.com/telegraf/v1.18/).

If you chose to use InfluxDB Cloud, then you should [download and install the InfluxDB Cloud CLI](https://portal.influxdata.com/downloads/). This tool allows you to send command line instructions to your cloud account. For more information, refer to [Influx CLI documentation](https://docs.influxdata.com/influxdb/cloud/write-data/developer-tools/influx-cli/).

#### Get data into InfluxDB

If you downloaded and installed InfluxDB on your local machine, then use the [Quick Start](https://docs.influxdata.com/influxdb/v2.0/write-data/#quick-start-for-influxdb-oss) feature to visualize InfluxDB metrics.

If you are using the cloud account, then the wizards will guide you through the initial process. For more information, refer to [Configure Telegraf](https://docs.influxdata.com/influxdb/cloud/write-data/no-code/use-telegraf/#configure-telegraf).

##### Note for Windows users:

Windows users might need to make additional adjustments. Look for special instructions in the InfluxData documentation and [Using Telegraf on Windows](https://www.influxdata.com/blog/using-telegraf-on-windows/) blog post. The regular system monitoring template in InfluxDB Cloud is not compatible with Windows. Windows users who use InfluxDB Cloud to monitor their system will need to use the [Windows System Monitoring Template](https://github.com/influxdata/community-templates/tree/master/windows_system).

#### Add your InfluxDB data source to Grafana

You can have more than one InfluxDB data source defined in Grafana.

1. Follow the general instructions to [add a data source]().
1. Decide if you will use InfluxQL or Flux as your query language.
   - [Configure the data source]() for your chosen query language.
     Each query language has its own unique data source settings.
   - For querying features specific to each language, see the data source's [query editor documentation]().

##### InfluxDB guides

InfluxDB publishes guidance for connecting different versions of their product to Grafana.

- **InfluxDB OSS or Enterprise 1.8+.** To turn on Flux, refer to [Configure InfluxDB](https://docs.influxdata.com/influxdb/v1.8/administration/config/#flux-enabled-false.). Select your InfluxDB version in the upper right corner.
- **InfluxDB OSS or Enterprise 2.x.** Refer to [Use Grafana with InfluxDB](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/). Select your InfluxDB version in the upper right corner.
- **InfluxDB Cloud.** Refer to [Use Grafana with InfluxDB Cloud](https://docs.influxdata.com/influxdb/cloud/tools/grafana/).

##### Important tips

- Make sure your Grafana token has read access. If it doesn't, then you'll get an authentication error and be unable to connect Grafana to InfluxDB.
- Avoid apostrophes and other non-standard characters in bucket and token names.
- If the text name of the organization or bucket doesn't work, then try the ID number.
- If you change your bucket name in InfluxDB, then you must also change it in Grafana and your Telegraf .conf file as well.

#### Add a query

This step varies depending on the query language that you selected when you set up your data source in Grafana.

##### InfluxQL query language

In the query editor, click **select measurement**.

![InfluxQL query](/static/img/docs/influxdb/influxql-query-7-5.png)

Grafana displays a list of possible series. Click one to select it, and Grafana graphs any available data. If there is no data to display, then try another selection or check your data source.

##### Flux query language

Create a simple Flux query.

1. [Add a panel]().
1. In the query editor, select your InfluxDB-Flux data source. For more information, refer to [Queries]().
1. Select the **Table** visualization.
1. In the query editor text field, enter `buckets()` and then click outside of the query editor.

This generic query returns a list of buckets.

![Flux query](/static/img/docs/influxdb/flux-query-7-5.png)

You can also create Flux queries in the InfluxDB Explore view.

1. In your browser, log in to the InfluxDB native UI (OSS is typically something like http://localhost:8086 or for InfluxDB Cloud use: https://cloud2.influxdata.com).
1. Click **Explore** to open the Data Explorer.
1. The InfluxDB Data Explorer provides two mechanisms for creating Flux queries: a graphical query editor and a script editor. Using the graphical query editor, [create a query](https://docs.influxdata.com/influxdb/cloud/query-data/execute-queries/data-explorer/). It will look something like this:

   ![InfluxDB Explore query](/static/img/docs/influxdb/influx-explore-query-7-5.png)

1. Click **Script Editor** to view the text of the query, and then copy all the lines of your Flux code, which will look something like this:

   ![InfluxDB Explore Script Editor](/static/img/docs/influxdb/explore-query-text-7-5.png)

1. In Grafana, [add a panel]() and then paste your Flux code into the query editor.
1. Click **Apply**. Your new panel should be visible with data from your Flux query.

#### Check InfluxDB metrics in Grafana Explore

In your Grafana instance, go to the [Explore]() view and build queries to experiment with the metrics you want to monitor. Here you can also debug issues related to collecting metrics.

#### Start building dashboards

There you go! Use Explore and Data Explorer to experiment with your data, and add the queries that you like to your dashboard as panels. Have fun!

Here are some resources to learn more:

- Grafana documentation: [InfluxDB data source]()
- InfluxDB documentation: [Comparison of Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/)

aliases      getting started influxdb  description  Learn how to build your first InfluxDB dashboard in Grafana  labels    products        enterprise       oss title  Get started with Grafana and InfluxDB weight  400        Get started with Grafana and InfluxDB         Get InfluxDB  You can  download InfluxDB  https   portal influxdata com downloads   and install it locally or you can sign up for  InfluxDB Cloud  https   www influxdata com products influxdb cloud    Windows installers are not available for some versions of InfluxDB        Install other InfluxDB software   Install Telegraf  https   docs influxdata com telegraf v1 18 introduction installation    This tool is an agent that helps you get metrics into InfluxDB  For more information  refer to  Telegraf documentation  https   docs influxdata com telegraf v1 18     If you chose to use InfluxDB Cloud  then you should  download and install the InfluxDB Cloud CLI  https   portal influxdata com downloads    This tool allows you to send command line instructions to your cloud account  For more information  refer to  Influx CLI documentation  https   docs influxdata com influxdb cloud write data developer tools influx cli          Get data into InfluxDB  If you downloaded and installed InfluxDB on your local machine  then use the  Quick Start  https   docs influxdata com influxdb v2 0 write data  quick start for influxdb oss  feature to visualize InfluxDB metrics   If you are using the cloud account  then the wizards will guide you through the initial process  For more information  refer to  Configure Telegraf  https   docs influxdata com influxdb cloud write data no code use telegraf  configure telegraf          Note for Windows users   Windows users might need to make additional adjustments  Look for special instructions in the InfluxData documentation and  Using Telegraf on Windows  https   www influxdata com blog using telegraf on windows   blog post  The regular system monitoring template in InfluxDB Cloud is not compatible with Windows  Windows users who use InfluxDB Cloud to monitor their system will need to use the  Windows System Monitoring Template  https   github com influxdata community templates tree master windows system         Add your InfluxDB data source to Grafana  You can have more than one InfluxDB data source defined in Grafana   1  Follow the general instructions to  add a data source     1  Decide if you will use InfluxQL or Flux as your query language        Configure the data source    for your chosen query language       Each query language has its own unique data source settings       For querying features specific to each language  see the data source s  query editor documentation            InfluxDB guides  InfluxDB publishes guidance for connecting different versions of their product to Grafana       InfluxDB OSS or Enterprise 1 8     To turn on Flux  refer to  Configure InfluxDB  https   docs influxdata com influxdb v1 8 administration config  flux enabled false    Select your InfluxDB version in the upper right corner      InfluxDB OSS or Enterprise 2 x    Refer to  Use Grafana with InfluxDB  https   docs influxdata com influxdb v2 0 tools grafana    Select your InfluxDB version in the upper right corner      InfluxDB Cloud    Refer to  Use Grafana with InfluxDB Cloud  https   docs influxdata com influxdb cloud tools grafana           Important tips    Make sure your Grafana token has read access  If it doesn t  then you ll get an authentication error and be unable to connect Grafana to InfluxDB    Avoid apostrophes and other non standard characters in bucket and token names    If the text name of the organization or bucket doesn t work  then try the ID number    If you change your bucket name in InfluxDB  then you must also change it in Grafana and your Telegraf  conf file as well        Add a query  This step varies depending on the query language that you selected when you set up your data source in Grafana         InfluxQL query language  In the query editor  click   select measurement       InfluxQL query   static img docs influxdb influxql query 7 5 png   Grafana displays a list of possible series  Click one to select it  and Grafana graphs any available data  If there is no data to display  then try another selection or check your data source         Flux query language  Create a simple Flux query   1   Add a panel     1  In the query editor  select your InfluxDB Flux data source  For more information  refer to  Queries     1  Select the   Table   visualization  1  In the query editor text field  enter  buckets    and then click outside of the query editor   This generic query returns a list of buckets     Flux query   static img docs influxdb flux query 7 5 png   You can also create Flux queries in the InfluxDB Explore view   1  In your browser  log in to the InfluxDB native UI  OSS is typically something like http   localhost 8086 or for InfluxDB Cloud use  https   cloud2 influxdata com   1  Click   Explore   to open the Data Explorer  1  The InfluxDB Data Explorer provides two mechanisms for creating Flux queries  a graphical query editor and a script editor  Using the graphical query editor   create a query  https   docs influxdata com influxdb cloud query data execute queries data explorer    It will look something like this        InfluxDB Explore query   static img docs influxdb influx explore query 7 5 png   1  Click   Script Editor   to view the text of the query  and then copy all the lines of your Flux code  which will look something like this        InfluxDB Explore Script Editor   static img docs influxdb explore query text 7 5 png   1  In Grafana   add a panel    and then paste your Flux code into the query editor  1  Click   Apply    Your new panel should be visible with data from your Flux query        Check InfluxDB metrics in Grafana Explore  In your Grafana instance  go to the  Explore    view and build queries to experiment with the metrics you want to monitor  Here you can also debug issues related to collecting metrics        Start building dashboards  There you go  Use Explore and Data Explorer to experiment with your data  and add the queries that you like to your dashboard as panels  Have fun   Here are some resources to learn more     Grafana documentation   InfluxDB data source      InfluxDB documentation   Comparison of Flux vs InfluxQL  https   docs influxdata com influxdb v1 8 flux flux vs influxql


grafana getting started Learn how to build your first Prometheus dashboard in Grafana guides gettingstarted aliases products getting started prometheus labels oss enterprise

Answer:
---
aliases:
  - ../guides/getting_started/
  - ../guides/gettingstarted/
  - getting-started-prometheus/
description: Learn how to build your first Prometheus dashboard in Grafana.
labels:
  products:
    - enterprise
    - oss
title: Get started with Grafana and Prometheus
weight: 300
---

# Get started with Grafana and Prometheus

Prometheus is an open source monitoring system for which Grafana provides out-of-the-box support. This topic walks you through the steps to create a series of dashboards in Grafana to display system metrics for a server monitored by Prometheus.

_Grafana and Prometheus_:

1. Download Prometheus and node_exporter
1. Install Prometheus node_exporter
1. Install and configure Prometheus
1. Configure Prometheus for Grafana
1. Check Prometheus metrics in Grafana Explore view
1. Start building dashboards

#### Download Prometheus and node_exporter

Download the following components:

- [Prometheus](https://prometheus.io/download/#prometheus)
- [node_exporter](https://prometheus.io/download/#node_exporter)

Like Grafana, you can install Prometheus on many different operating systems. Refer to the [Prometheus download page](https://prometheus.io/download/) to see a list of stable versions of Prometheus components.

#### Install Prometheus node_exporter

Install node_exporter on all hosts you want to monitor. This guide shows you how to install it locally.

Prometheus node_exporter is a widely used tool that exposes system metrics. For instructions on installing node_exporter, refer to the [Installing and running the node_exporter](https://prometheus.io/docs/guides/node-exporter/#installing-and-running-the-node-exporter) section in the Prometheus documentation.

When you run node_exporter locally, navigate to `http://localhost:9100/metrics` to check that it is exporting metrics.

The instructions in the referenced topic are intended for Linux users. You may have to alter the instructions slightly depending on your operating system. For example, if you are on Windows, use the [windows_exporter](https://github.com/prometheus-community/windows_exporter) instead.

#### Install and configure Prometheus

1. After [downloading Prometheus](https://prometheus.io/download/#prometheus), extract it and navigate to the directory.

   ```
   tar xvfz prometheus-*.tar.gz
   cd prometheus-*
   ```

1. Locate the `prometheus.yml` file in the directory.

1. Modify Prometheus's configuration file to monitor the hosts where you installed node_exporter.

By default, Prometheus looks for the file `prometheus.yml` in the current working directory. This behavior can be changed via the `--config.file` command line flag. For example, some Prometheus installers use it to set the configuration file to `/etc/prometheus/prometheus.yml`.

The following example shows you the code you should add. Notice that static configs targets are set to `['localhost:9100']` to target node-explorer when running it locally.

```
 # A scrape configuration containing exactly one endpoint to scrape from node_exporter running on a host:
 scrape_configs:
     # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
     - job_name: 'node'

     # metrics_path defaults to '/metrics'
     # scheme defaults to 'http'.

       static_configs:
       - targets: ['localhost:9100']
```

1. Start the Prometheus service:

   ```
    ./prometheus --config.file=./prometheus.yml
   ```

1. Confirm that Prometheus is running by navigating to `http://localhost:9090`.

You can see that the node_exporter metrics have been delivered to Prometheus. Next, the metrics will be sent to Grafana.

#### Configure Prometheus for Grafana

When running Prometheus locally, there are two ways to configure Prometheus for Grafana. You can use a hosted Grafana instance at [Grafana Cloud](/) or run Grafana locally.

This guide describes configuring Prometheus in a hosted Grafana instance on Grafana Cloud.

1. Sign up for [https://grafana.com/](/auth/sign-up/create-user). Grafana gives you a Prometheus instance out of the box.

![Prometheus details in Grafana.com](/static/img/docs/getting-started/screenshot-grafana-prometheus-details.png)

1. Because you are running your own Prometheus instance locally, you must `remote_write` your metrics to the Grafana.com Prometheus instance. Grafana provides code to add to your `prometheus.yml` config file. This includes a remote write endpoint, your user name and password.

Add the following code to your prometheus.yml file to begin sending metrics to your hosted Grafana instance.

```
remote_write:
- url: <https://your-remote-write-endpoint>
  basic_auth:
    username: <your user name>
    password: <Your Grafana.com API Key>
```

To configure your Prometheus instance to work with Grafana locally instead of Grafana Cloud, install Grafana [here](/grafana/download) and follow the configuration steps listed [here](/docs/grafana/latest/datasources/prometheus/#configure-the-data-source).

#### Check Prometheus metrics in Grafana Explore view

In your Grafana instance, go to the [Explore]() view and build queries to experiment with the metrics you want to monitor. Here you can also debug issues related to collecting metrics from Prometheus.

#### Start building dashboards

Now that you have a curated list of queries, create [dashboards]() to render system metrics monitored by Prometheus. When you install Prometheus and node_exporter or windows_exporter, you will find recommended dashboards for use.

The following image shows a dashboard with three panels showing some system metrics.

![Prometheus dashboards](/static/img/docs/getting-started/simple_grafana_prom_dashboard.png)

To learn more:

- Grafana documentation: [Prometheus data source]()
- Prometheus documentation: [What is Prometheus?](https://prometheus.io/docs/introduction/overview/)

aliases         guides getting started         guides gettingstarted      getting started prometheus  description  Learn how to build your first Prometheus dashboard in Grafana  labels    products        enterprise       oss title  Get started with Grafana and Prometheus weight  300        Get started with Grafana and Prometheus  Prometheus is an open source monitoring system for which Grafana provides out of the box support  This topic walks you through the steps to create a series of dashboards in Grafana to display system metrics for a server monitored by Prometheus    Grafana and Prometheus    1  Download Prometheus and node exporter 1  Install Prometheus node exporter 1  Install and configure Prometheus 1  Configure Prometheus for Grafana 1  Check Prometheus metrics in Grafana Explore view 1  Start building dashboards       Download Prometheus and node exporter  Download the following components      Prometheus  https   prometheus io download  prometheus     node exporter  https   prometheus io download  node exporter   Like Grafana  you can install Prometheus on many different operating systems  Refer to the  Prometheus download page  https   prometheus io download   to see a list of stable versions of Prometheus components        Install Prometheus node exporter  Install node exporter on all hosts you want to monitor  This guide shows you how to install it locally   Prometheus node exporter is a widely used tool that exposes system metrics  For instructions on installing node exporter  refer to the  Installing and running the node exporter  https   prometheus io docs guides node exporter  installing and running the node exporter  section in the Prometheus documentation   When you run node exporter locally  navigate to  http   localhost 9100 metrics  to check that it is exporting metrics    The instructions in the referenced topic are intended for Linux users  You may have to alter the instructions slightly depending on your operating system  For example  if you are on Windows  use the  windows exporter  https   github com prometheus community windows exporter  instead         Install and configure Prometheus  1  After  downloading Prometheus  https   prometheus io download  prometheus   extract it and navigate to the directory             tar xvfz prometheus   tar gz    cd prometheus           1  Locate the  prometheus yml  file in the directory   1  Modify Prometheus s configuration file to monitor the hosts where you installed node exporter   By default  Prometheus looks for the file  prometheus yml  in the current working directory  This behavior can be changed via the    config file  command line flag  For example  some Prometheus installers use it to set the configuration file to   etc prometheus prometheus yml    The following example shows you the code you should add  Notice that static configs targets are set to    localhost 9100    to target node explorer when running it locally          A scrape configuration containing exactly one endpoint to scrape from node exporter running on a host   scrape configs         The job name is added as a label  job  job name   to any timeseries scraped from this config         job name   node          metrics path defaults to   metrics         scheme defaults to  http           static configs           targets    localhost 9100        1  Start the Prometheus service                prometheus   config file   prometheus yml         1  Confirm that Prometheus is running by navigating to  http   localhost 9090    You can see that the node exporter metrics have been delivered to Prometheus  Next  the metrics will be sent to Grafana        Configure Prometheus for Grafana  When running Prometheus locally  there are two ways to configure Prometheus for Grafana  You can use a hosted Grafana instance at  Grafana Cloud     or run Grafana locally   This guide describes configuring Prometheus in a hosted Grafana instance on Grafana Cloud   1  Sign up for  https   grafana com    auth sign up create user   Grafana gives you a Prometheus instance out of the box     Prometheus details in Grafana com   static img docs getting started screenshot grafana prometheus details png   1  Because you are running your own Prometheus instance locally  you must  remote write  your metrics to the Grafana com Prometheus instance  Grafana provides code to add to your  prometheus yml  config file  This includes a remote write endpoint  your user name and password   Add the following code to your prometheus yml file to begin sending metrics to your hosted Grafana instance       remote write    url   https   your remote write endpoint    basic auth      username   your user name      password   Your Grafana com API Key        To configure your Prometheus instance to work with Grafana locally instead of Grafana Cloud  install Grafana  here   grafana download  and follow the configuration steps listed  here   docs grafana latest datasources prometheus  configure the data source          Check Prometheus metrics in Grafana Explore view  In your Grafana instance  go to the  Explore    view and build queries to experiment with the metrics you want to monitor  Here you can also debug issues related to collecting metrics from Prometheus        Start building dashboards  Now that you have a curated list of queries  create  dashboards    to render system metrics monitored by Prometheus  When you install Prometheus and node exporter or windows exporter  you will find recommended dashboards for use   The following image shows a dashboard with three panels showing some system metrics     Prometheus dashboards   static img docs getting started simple grafana prom dashboard png   To learn more     Grafana documentation   Prometheus data source      Prometheus documentation   What is Prometheus   https   prometheus io docs introduction overview


grafana getting started getting started sql guides gettingstarted aliases products Learn how to build your first MS SQL Server dashboard in Grafana labels oss enterprise

Answer:
---
aliases:
  - ../guides/getting_started/
  - ../guides/gettingstarted/
  - getting-started-sql/
description: Learn how to build your first MS SQL Server dashboard in Grafana.
labels:
  products:
    - enterprise
    - oss
title: Get started with Grafana and MS SQL Server
weight: 500
---

# Get started with Grafana and MS SQL Server

Microsoft SQL Server is a popular relational database management system that is widely used in development and production environments. This topic walks you through the steps to create a series of dashboards in Grafana to display metrics from a MS SQL Server database.

#### Download MS SQL Server

MS SQL Server can be installed on Windows or Linux operating systems and also on Docker containers. Refer to the [MS SQL Server downloads page](https://www.microsoft.com/en-us/sql-server/sql-server-downloads), for a complete list of all available options.

#### Install MS SQL Server

You can install MS SQL Server on the host running Grafana or on a remote server. To install the software from the [downloads page](https://www.microsoft.com/en-us/sql-server/sql-server-downloads), follow their setup prompts.

If you are on a Windows host but want to use Grafana and MS SQL data source on a Linux environment, refer to the [WSL to set up your Grafana development environment](/blog/2021/03/03/.how-to-set-up-a-grafana-development-environment-on-a-windows-pc-using-wsl). This will allow you to leverage the resources available in [grafana/grafana](https://github.com/grafana/grafana) GitHub repository. Here you will find a collection of supported data sources, including MS SQL Server, along with test data and pre-configured dashboards for use.

#### Add the MS SQL data source

There are several ways to authenticate in MSSQL. Start by:

1. Click **Connections** in the left-side menu and filter by `mssql`.
1. Select the **Microsoft SQL Server** option.
1. Click **Create a Microsoft SQL Server data source** in the top right corner to open the configuration page.
1. Select the desired authentication method and fill in the right information as detailed below.
1. Click **Save & test**.

##### General configuration

| Name       | Description                                                                                |
| ---------- | --------------------------------------------------------------------------------------------------------------------- |
| `Name`     | The data source name. This is how you refer to the data source in panels and queries.                                 |
| `Host`     | The IP address/hostname and optional port of your MS SQL instance. If port is omitted, the default 1433 will be used. |
| `Database` | Name of your MS SQL database.                                                                                |

##### SQL Server Authentication

| Name       | Description                     |
| ---------- | ------------------------------- |
| `User`     | Database user's login/username. |
| `Password` | Database user's password.       |

##### Windows Active Directory (Kerberos)

Below are the four possible ways to authenticate via Windows Active Directory/Kerberos.

Windows Active Directory (Kerberos) authentication is not supported in Grafana Cloud at the moment.

| Method                    | Description                                                                                |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Username + password**   | Enter the domain user and password                                                                                |
| **Keytab file**           | Specify the path to a valid keytab file to use that for authentication.                                                                                |
| **Credential cache**      | Log in on the host via `kinit` and pass the path to the credential cache. The cache path can be found by running `klist` on the host in question.            |
| **Credential cache file** | This option allows multiple valid configurations to be present and matching is performed on host, database, and user. See the example JSON below this table. |

```json
[
  {
    "user": "grot@GF.LAB",
    "database": "dbone",
    "address": "mysql1.mydomain.com:3306",
    "credentialCache": "/tmp/krb5cc_1000"
  },
  {
    "user": "grot@GF.LAB",
    "database": "dbtwo",
    "address": "mysql2.gf.lab",
    "credentialCache": "/tmp/krb5cc_1000"
  }
]
```

For installations from the [grafana/grafana](https://github.com/grafana/grafana/tree/main) repository, `gdev-mssql` data source is available. Once you add this data source, you can use the `Datasource tests - MSSQL` dashboard with three panels showing metrics generated from a test database.

![MS SQL Server dashboard](/static/img/docs/getting-started/gdev-sql-dashboard.png)

Optionally, play around this dashboard and customize it to:

- Create different panels.
- Change titles for panels.
- Change frequency of data polling.
- Change the period for which the data is displayed.
- Rearrange and resize panels.

#### Start building dashboards

Now that you have gained some idea of using the pre-packaged MS SQL data source and some test data, the next step is to setup your own instance of MS SQL Server database and data your development or sandbox area.

To fetch data from your own instance of MS SQL Server, add the data source using instructions in Step 4 of this topic. In Grafana [Explore]() build queries to experiment with the metrics you want to monitor.

Once you have a curated list of queries, create [dashboards]() to render metrics from the SQL Server database. For troubleshooting, user permissions, known issues, and query examples, refer to [Using Microsoft SQL Server in Grafana]().

aliases         guides getting started         guides gettingstarted      getting started sql  description  Learn how to build your first MS SQL Server dashboard in Grafana  labels    products        enterprise       oss title  Get started with Grafana and MS SQL Server weight  500        Get started with Grafana and MS SQL Server  Microsoft SQL Server is a popular relational database management system that is widely used in development and production environments  This topic walks you through the steps to create a series of dashboards in Grafana to display metrics from a MS SQL Server database        Download MS SQL Server  MS SQL Server can be installed on Windows or Linux operating systems and also on Docker containers  Refer to the  MS SQL Server downloads page  https   www microsoft com en us sql server sql server downloads   for a complete list of all available options        Install MS SQL Server  You can install MS SQL Server on the host running Grafana or on a remote server  To install the software from the  downloads page  https   www microsoft com en us sql server sql server downloads   follow their setup prompts   If you are on a Windows host but want to use Grafana and MS SQL data source on a Linux environment  refer to the  WSL to set up your Grafana development environment   blog 2021 03 03  how to set up a grafana development environment on a windows pc using wsl   This will allow you to leverage the resources available in  grafana grafana  https   github com grafana grafana  GitHub repository  Here you will find a collection of supported data sources  including MS SQL Server  along with test data and pre configured dashboards for use        Add the MS SQL data source  There are several ways to authenticate in MSSQL  Start by   1  Click   Connections   in the left side menu and filter by  mssql   1  Select the   Microsoft SQL Server   option  1  Click   Create a Microsoft SQL Server data source   in the top right corner to open the configuration page  1  Select the desired authentication method and fill in the right information as detailed below  1  Click   Save   test           General configuration    Name         Description                                                                                Name        The data source name  This is how you refer to the data source in panels and queries                                       Host        The IP address hostname and optional port of your MS SQL instance  If port is omitted  the default 1433 will be used       Database    Name of your MS SQL database                                                                                SQL Server Authentication    Name         Description                                                                           User        Database user s login username       Password    Database user s password                 Windows Active Directory  Kerberos   Below are the four possible ways to authenticate via Windows Active Directory Kerberos    Windows Active Directory  Kerberos  authentication is not supported in Grafana Cloud at the moment      Method                      Description                                                                                Username   password       Enter the domain user and password                                                                                Keytab file               Specify the path to a valid keytab file to use that for authentication                                                                                Credential cache          Log in on the host via  kinit  and pass the path to the credential cache  The cache path can be found by running  klist  on the host in question                   Credential cache file     This option allows multiple valid configurations to be present and matching is performed on host  database  and user  See the example JSON below this table        json            user    grot GF LAB        database    dbone        address    mysql1 mydomain com 3306        credentialCache     tmp krb5cc 1000                user    grot GF LAB        database    dbtwo        address    mysql2 gf lab        credentialCache     tmp krb5cc 1000             For installations from the  grafana grafana  https   github com grafana grafana tree main  repository   gdev mssql  data source is available  Once you add this data source  you can use the  Datasource tests   MSSQL  dashboard with three panels showing metrics generated from a test database     MS SQL Server dashboard   static img docs getting started gdev sql dashboard png   Optionally  play around this dashboard and customize it to     Create different panels    Change titles for panels    Change frequency of data polling    Change the period for which the data is displayed    Rearrange and resize panels        Start building dashboards  Now that you have gained some idea of using the pre packaged MS SQL data source and some test data  the next step is to setup your own instance of MS SQL Server database and data your development or sandbox area   To fetch data from your own instance of MS SQL Server  add the data source using instructions in Step 4 of this topic  In Grafana  Explore    build queries to experiment with the metrics you want to monitor   Once you have a curated list of queries  create  dashboards    to render metrics from the SQL Server database  For troubleshooting  user permissions  known issues  and query examples  refer to  Using Microsoft SQL Server in Grafana


grafana setup certificates labels https products Learn how to set up Grafana HTTPS for secure web traffic keywords ssl grafana enterprise

Answer:
---
description: Learn how to set up Grafana HTTPS for secure web traffic.
keywords:
  - grafana
  - https
  - ssl
  - certificates
labels:
  products:
    - enterprise
    - oss
menuTitle: Set up HTTPS
title: Set up Grafana HTTPS for secure web traffic
weight: 900
---

# Set up Grafana HTTPS for secure web traffic

When accessing the Grafana UI through the web, it is important to set up HTTPS to ensure the communication between Grafana and the end user is encrypted, including login credentials and retrieved metric data.

In order to ensure secure traffic over the internet, Grafana must have a key for encryption and a [Secure Socket Layer (SSL) Certificate](https://www.kaspersky.com/resource-center/definitions/what-is-a-ssl-certificate) to verify the identity of the site.

The following image shows a browser lock icon which confirms the connection is safe.

This topic shows you how to:

1. Obtain a certificate and key
2. Configure Grafana HTTPS
3. Restart the Grafana server

## Before you begin

To follow these instructions, you need:

- You must have shell access to the system and `sudo` access to perform actions as root or administrator.
- For the CA-signed option, you need a domain name that you possess and that is associated with the machine you are using.

## Obtain a certificate and key

You can use one of two methods to obtain a certificate and a key. The faster and easier _self-signed_ option might show browser warnings to the user that they will have to accept each time they visit the site. Alternatively, the Certificate Authority (CA) signed option requires more steps to complete, but it enables full trust with the browser. To learn more about the difference between these options, refer to [Difference between self-signed CA and self-signed certificate](https://www.baeldung.com/cs/self-signed-ca-vs-certificate).

### Generate a self-signed certificate

This section shows you how to use `openssl` tooling to generate all necessary files from the command line.

1. Run the following command to generate a 2048-bit RSA private key, which is used to decrypt traffic:

   ```bash
   $ sudo openssl genrsa -out /etc/grafana/grafana.key 2048
   ```

1. Run the following command to generate a certificate, using the private key from the previous step.

   ```bash
   $ sudo openssl req -new -key /etc/grafana/grafana.key -out /etc/grafana/grafana.csr
   ```

   When prompted, answer the questions, which might include your fully-qualified domain name, email address, country code, and others. The following example is similar to the prompts you will see.

   ```
   You are about to be asked to enter information that will be incorporated
   into your certificate request.
   What you are about to enter is what is called a Distinguished Name or a DN.
   There are quite a few fields but you can leave some blank
   For some fields there will be a default value,
   If you enter '.', the field will be left blank.
   -----
   Country Name (2 letter code) [AU]:US
   State or Province Name (full name) [Some-State]:Virginia
   Locality Name (eg, city) []:Richmond
   Organization Name (eg, company) [Internet Pty Ltd]:
   Organizational Unit Name (eg, section) []:
   Common Name (e.g. server FQDN or YOUR name) []:subdomain.mysite.com
   Email Address []:me@mysite.com

   Please enter the following 'extra' attributes
   to be sent with your certificate request
   A challenge password []:
   An optional company name []:
   ```

1. Run the following command to self-sign the certificate with the private key, for a period of validity of 365 days:

   ```bash
   sudo openssl x509 -req -days 365 -in /etc/grafana/grafana.csr -signkey /etc/grafana/grafana.key -out /etc/grafana/grafana.crt
   ```

1. Run the following commands to set the appropriate permissions for the files:

   ```bash
   sudo chown grafana:grafana /etc/grafana/grafana.crt
   sudo chown grafana:grafana /etc/grafana/grafana.key
   sudo chmod 400 /etc/grafana/grafana.key /etc/grafana/grafana.crt
   ```

   **Note**: When using these files, browsers might provide warnings for the resulting website because a third-party source does not trust the certificate. Browsers will show trust warnings; however, the connection will remain encrypted.

   The following image shows an insecure HTTP connection.

### Obtain a signed certificate from LetsEncrypt

[LetsEncrypt](https://letsencrypt.org/) is a nonprofit certificate authority that provides certificates without any charge. For signed certificates, there are multiple companies and certificate authorities (CAs) available. The principles for generating the certificates might vary slightly in accordance with the provider but will generally remain the same.

The examples in this section use LetsEncrypt because it is free.

The instructions provided in this section are for a Debian-based Linux system. For other distributions and operating systems, please refer to the [certbot instructions](https://certbot.eff.org/instructions). Also, these instructions require you to have a domain name that you are in control of. Dynamic domain names like those from Amazon EC2 or DynDNS providers will not function.

#### Install `snapd` and `certbot`

`certbot` is an open-source program used to manage LetsEncrypt certificates, and `snapd` is a tool that assists in running `certbot` and installing the certificates.

1. To install `snapd`, run the following commands:

   ```bash
   sudo apt-get install snapd
   sudo snap install core; sudo snap refresh core
   ```

1. Run the following commands to install:

   ```bash
   sudo apt-get remove certbot
   sudo snap install --classic certbot
   sudo ln -s /snap/bin/certbot /usr/bin/certbot
   ```

   These commands:

   - Uninstall `certbot` from your system if it has been installed using a package manager
   - Install `certbot` using `snapd`

#### Generate certificates using `certbot`

The `sudo certbot certonly --standalone` command prompts you to answer questions before it generates a certificate. This process temporarily opens a service on port `80` that LetsEncrypt uses to verify communication with your host.

To generate certificates using `certbot`, complete the following steps:

1. Ensure that port `80` traffic is permitted by applicable firewall rules.

1. Run the following command to generate certificates:

   ```bash
   $ sudo certbot certonly --standalone

   Saving debug log to /var/log/letsencrypt/letsencrypt.log
   Enter email address (used for urgent renewal and security notices)
   (Enter 'c' to cancel): me@mysite.com

   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   Please read the Terms of Service at
   https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must
   agree in order to register with the ACME server. Do you agree?
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   (Y)es/(N)o: y

   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   Would you be willing, once your first certificate is successfully issued, to
   share your email address with the Electronic Frontier Foundation, a founding
   partner of the Let’s Encrypt project and the non-profit organization that
   develops Certbot? We’d like to send you email about our work encrypting the web,
   EFF news, campaigns, and ways to support digital freedom.
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   (Y)es/(N)o: n
   Account registered.
   Please enter the domain name(s) you would like on your certificate (comma and/or
   space separated) (Enter 'c' to cancel): subdomain.mysite.com
   Requesting a certificate for subdomain.mysite.com

   Successfully received certificate.
   Certificate is saved at: /etc/letsencrypt/live/subdomain.mysite.com/fullchain.pem
   Key is saved at:         /etc/letsencrypt/live/subdomain.mysite.com/privkey.pem
   This certificate expires on 2023-06-20.
   These files will be updated when the certificate renews.
   Certbot has set up a scheduled task to automatically renew this certificate in the background.

   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   If you like Certbot, please consider supporting our work by:
   * Donating to ISRG / Let’s Encrypt:   https://letsencrypt.org/donate
   * Donating to EFF:                    https://eff.org/donate-le
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   ```

#### Set up symlinks to Grafana

Symbolic links, also known as symlinks, enable you to create pointers to existing LetsEncrypt files in the `/etc/grafana` directory. By using symlinks rather than copying files, you can use `certbot` to refresh or request updated certificates from LetsEncrypt without the need to reconfigure the Grafana settings.

To set up symlinks to Grafana, run the following commands:

```bash
$ sudo ln -s /etc/letsencrypt/live/subdomain.mysite.com/privkey.pem /etc/grafana/grafana.key
$ sudo ln -s /etc/letsencrypt/live/subdomain.mysite.com/fullchain.pem /etc/grafana/grafana.crt
```

#### Adjust permissions

Grafana usually runs under the `grafana` Linux group, and you must ensure that the Grafana server process has permission to read the relevant files. Without read access, the HTTPS server fails to start properly.

To adjust permissions, perform the following steps:

1. Run the following commands to set the appropriate permissions and groups for the files:

   ```bash
   $ sudo chgrp -R grafana /etc/letsencrypt/*
   $ sudo chmod -R g+rx /etc/letsencrypt/*
   $ sudo chgrp -R grafana /etc/grafana/grafana.crt /etc/grafana/grafana.key
   $ sudo chmod 400 /etc/grafana/grafana.crt /etc/grafana/grafana.key
   ```

1. Run the following command to verify that the `grafana` group can read the symlinks:

   ```bash
   $ $ ls -l /etc/grafana/grafana.*

   lrwxrwxrwx 1 root grafana    67 Mar 22 14:15 /etc/grafana/grafana.crt -> /etc/letsencrypt/live/subdomain.mysite.com/fullchain.pem
   -rw-r----- 1 root grafana 54554 Mar 22 14:13 /etc/grafana/grafana.ini
   lrwxrwxrwx 1 root grafana    65 Mar 22 14:15 /etc/grafana/grafana.key -> /etc/letsencrypt/live/subdomain.mysite.com/privkey.pem
   ```

## Configure Grafana HTTPS and restart Grafana

In this section you edit the `grafana.ini` file so that it includes the certificate you created. If you need help identifying where to find this file, or what each key means, refer to [Configuration file location]().

To configure Grafana HTTPS and restart Grafana, complete the following steps.

1. Open the `grafana.ini` file and edit the following configuration parameters:

   ```
   [server]
   http_addr =
   http_port = 3000
   domain = mysite.com
   root_url = https://subdomain.mysite.com:3000
   cert_key = /etc/grafana/grafana.key
   cert_file = /etc/grafana/grafana.crt
   enforce_domain = False
   protocol = https
   ```

   > **Note**: The standard port for SSL traffic is 443, which you can use instead of Grafana's default port 3000. This change might require additional operating system privileges or configuration to bind to lower-numbered privileged ports.

1. [Restart the Grafana server]() using `systemd`, `init.d`, or the binary as appropriate for your environment.

## Troubleshooting

Refer to the following troubleshooting tips as required.

### Failure to obtain a certificate

The following reasons explain why the `certbot` process might fail:

- To make sure you can get a certificate from LetsEncrypt, you need to ensure that port 80 is open so that LetsEncrypt can communicate with your machine. If port 80 is blocked or firewall is enabled, the exchange will fail and you won't be able to receive a certificate.
- LetsEncrypt requires proof that you control the domain, so attempts to obtain certificates for domains you do not
  control might be rejected.

### Grafana starts, but HTTPS is unavailable

When you configure HTTPS, the following errors might appear in Grafana's logs.

#### Permission denied

```
level=error msg="Stopped background service" service=*api.HTTPServer reason="open /etc/grafana/grafana.crt: permission denied"
```

##### Resolution

To ensure secure HTTPS setup, it is essential that the cryptographic keys and certificates are as restricted as possible. However, if the file permissions are too restricted, the Grafana process may not have access to the necessary files, thus impeding a successful HTTPS setup. Please re-examine the listed instructions to double check the file permissions and try again.

#### Cannot assign requested address

```
listen tcp 34.148.30.243:3000: bind: cannot assign requested address
```

##### Resolution

Check the config to ensure the `http_addr` is left blank, allowing Grafana to bind to all interfaces. If you have set `http_addr` to a specific subdomain, such as `subdomain.mysite.com`, this might prevent the Grafana process from binding to an external address, due to network address translation layers being present.

description  Learn how to set up Grafana HTTPS for secure web traffic  keywords      grafana     https     ssl     certificates labels    products        enterprise       oss menuTitle  Set up HTTPS title  Set up Grafana HTTPS for secure web traffic weight  900        Set up Grafana HTTPS for secure web traffic  When accessing the Grafana UI through the web  it is important to set up HTTPS to ensure the communication between Grafana and the end user is encrypted  including login credentials and retrieved metric data   In order to ensure secure traffic over the internet  Grafana must have a key for encryption and a  Secure Socket Layer  SSL  Certificate  https   www kaspersky com resource center definitions what is a ssl certificate  to verify the identity of the site   The following image shows a browser lock icon which confirms the connection is safe     This topic shows you how to   1  Obtain a certificate and key 2  Configure Grafana HTTPS 3  Restart the Grafana server     Before you begin  To follow these instructions  you need     You must have shell access to the system and  sudo  access to perform actions as root or administrator    For the CA signed option  you need a domain name that you possess and that is associated with the machine you are using      Obtain a certificate and key  You can use one of two methods to obtain a certificate and a key  The faster and easier  self signed  option might show browser warnings to the user that they will have to accept each time they visit the site  Alternatively  the Certificate Authority  CA  signed option requires more steps to complete  but it enables full trust with the browser  To learn more about the difference between these options  refer to  Difference between self signed CA and self signed certificate  https   www baeldung com cs self signed ca vs certificate        Generate a self signed certificate  This section shows you how to use  openssl  tooling to generate all necessary files from the command line   1  Run the following command to generate a 2048 bit RSA private key  which is used to decrypt traffic         bash      sudo openssl genrsa  out  etc grafana grafana key 2048         1  Run the following command to generate a certificate  using the private key from the previous step         bash      sudo openssl req  new  key  etc grafana grafana key  out  etc grafana grafana csr            When prompted  answer the questions  which might include your fully qualified domain name  email address  country code  and others  The following example is similar to the prompts you will see             You are about to be asked to enter information that will be incorporated    into your certificate request     What you are about to enter is what is called a Distinguished Name or a DN     There are quite a few fields but you can leave some blank    For some fields there will be a default value     If you enter      the field will be left blank              Country Name  2 letter code   AU  US    State or Province Name  full name   Some State  Virginia    Locality Name  eg  city     Richmond    Organization Name  eg  company   Internet Pty Ltd      Organizational Unit Name  eg  section         Common Name  e g  server FQDN or YOUR name     subdomain mysite com    Email Address    me mysite com     Please enter the following  extra  attributes    to be sent with your certificate request    A challenge password        An optional company name             1  Run the following command to self sign the certificate with the private key  for a period of validity of 365 days         bash    sudo openssl x509  req  days 365  in  etc grafana grafana csr  signkey  etc grafana grafana key  out  etc grafana grafana crt         1  Run the following commands to set the appropriate permissions for the files         bash    sudo chown grafana grafana  etc grafana grafana crt    sudo chown grafana grafana  etc grafana grafana key    sudo chmod 400  etc grafana grafana key  etc grafana grafana crt              Note    When using these files  browsers might provide warnings for the resulting website because a third party source does not trust the certificate  Browsers will show trust warnings  however  the connection will remain encrypted      The following image shows an insecure HTTP connection            Obtain a signed certificate from LetsEncrypt   LetsEncrypt  https   letsencrypt org   is a nonprofit certificate authority that provides certificates without any charge  For signed certificates  there are multiple companies and certificate authorities  CAs  available  The principles for generating the certificates might vary slightly in accordance with the provider but will generally remain the same   The examples in this section use LetsEncrypt because it is free    The instructions provided in this section are for a Debian based Linux system  For other distributions and operating systems  please refer to the  certbot instructions  https   certbot eff org instructions   Also  these instructions require you to have a domain name that you are in control of  Dynamic domain names like those from Amazon EC2 or DynDNS providers will not function         Install  snapd  and  certbot    certbot  is an open source program used to manage LetsEncrypt certificates  and  snapd  is a tool that assists in running  certbot  and installing the certificates   1  To install  snapd   run the following commands         bash    sudo apt get install snapd    sudo snap install core  sudo snap refresh core         1  Run the following commands to install         bash    sudo apt get remove certbot    sudo snap install   classic certbot    sudo ln  s  snap bin certbot  usr bin certbot            These commands        Uninstall  certbot  from your system if it has been installed using a package manager      Install  certbot  using  snapd        Generate certificates using  certbot   The  sudo certbot certonly   standalone  command prompts you to answer questions before it generates a certificate  This process temporarily opens a service on port  80  that LetsEncrypt uses to verify communication with your host   To generate certificates using  certbot   complete the following steps   1  Ensure that port  80  traffic is permitted by applicable firewall rules   1  Run the following command to generate certificates         bash      sudo certbot certonly   standalone     Saving debug log to  var log letsencrypt letsencrypt log    Enter email address  used for urgent renewal and security notices      Enter  c  to cancel   me mysite com                                                                                Please read the Terms of Service at    https   letsencrypt org documents LE SA v1 3 September 21 2022 pdf  You must    agree in order to register with the ACME server  Do you agree                                                                                Y es  N o  y                                                                                Would you be willing  once your first certificate is successfully issued  to    share your email address with the Electronic Frontier Foundation  a founding    partner of the Let s Encrypt project and the non profit organization that    develops Certbot  We d like to send you email about our work encrypting the web     EFF news  campaigns  and ways to support digital freedom                                                                                Y es  N o  n    Account registered     Please enter the domain name s  you would like on your certificate  comma and or    space separated   Enter  c  to cancel   subdomain mysite com    Requesting a certificate for subdomain mysite com     Successfully received certificate     Certificate is saved at   etc letsencrypt live subdomain mysite com fullchain pem    Key is saved at           etc letsencrypt live subdomain mysite com privkey pem    This certificate expires on 2023 06 20     These files will be updated when the certificate renews     Certbot has set up a scheduled task to automatically renew this certificate in the background                                                                                If you like Certbot  please consider supporting our work by       Donating to ISRG   Let s Encrypt    https   letsencrypt org donate      Donating to EFF                     https   eff org donate le                                                                                Set up symlinks to Grafana  Symbolic links  also known as symlinks  enable you to create pointers to existing LetsEncrypt files in the   etc grafana  directory  By using symlinks rather than copying files  you can use  certbot  to refresh or request updated certificates from LetsEncrypt without the need to reconfigure the Grafana settings   To set up symlinks to Grafana  run the following commands      bash   sudo ln  s  etc letsencrypt live subdomain mysite com privkey pem  etc grafana grafana key   sudo ln  s  etc letsencrypt live subdomain mysite com fullchain pem  etc grafana grafana crt           Adjust permissions  Grafana usually runs under the  grafana  Linux group  and you must ensure that the Grafana server process has permission to read the relevant files  Without read access  the HTTPS server fails to start properly   To adjust permissions  perform the following steps   1  Run the following commands to set the appropriate permissions and groups for the files         bash      sudo chgrp  R grafana  etc letsencrypt        sudo chmod  R g rx  etc letsencrypt        sudo chgrp  R grafana  etc grafana grafana crt  etc grafana grafana key      sudo chmod 400  etc grafana grafana crt  etc grafana grafana key         1  Run the following command to verify that the  grafana  group can read the symlinks         bash        ls  l  etc grafana grafana       lrwxrwxrwx 1 root grafana    67 Mar 22 14 15  etc grafana grafana crt     etc letsencrypt live subdomain mysite com fullchain pem     rw r      1 root grafana 54554 Mar 22 14 13  etc grafana grafana ini    lrwxrwxrwx 1 root grafana    65 Mar 22 14 15  etc grafana grafana key     etc letsencrypt live subdomain mysite com privkey pem            Configure Grafana HTTPS and restart Grafana  In this section you edit the  grafana ini  file so that it includes the certificate you created  If you need help identifying where to find this file  or what each key means  refer to  Configuration file location      To configure Grafana HTTPS and restart Grafana  complete the following steps   1  Open the  grafana ini  file and edit the following configuration parameters              server     http addr      http port   3000    domain   mysite com    root url   https   subdomain mysite com 3000    cert key    etc grafana grafana key    cert file    etc grafana grafana crt    enforce domain   False    protocol   https                Note    The standard port for SSL traffic is 443  which you can use instead of Grafana s default port 3000  This change might require additional operating system privileges or configuration to bind to lower numbered privileged ports   1   Restart the Grafana server    using  systemd    init d   or the binary as appropriate for your environment      Troubleshooting  Refer to the following troubleshooting tips as required       Failure to obtain a certificate  The following reasons explain why the  certbot  process might fail     To make sure you can get a certificate from LetsEncrypt  you need to ensure that port 80 is open so that LetsEncrypt can communicate with your machine  If port 80 is blocked or firewall is enabled  the exchange will fail and you won t be able to receive a certificate    LetsEncrypt requires proof that you control the domain  so attempts to obtain certificates for domains you do not   control might be rejected       Grafana starts  but HTTPS is unavailable  When you configure HTTPS  the following errors might appear in Grafana s logs        Permission denied      level error msg  Stopped background service  service  api HTTPServer reason  open  etc grafana grafana crt  permission denied             Resolution  To ensure secure HTTPS setup  it is essential that the cryptographic keys and certificates are as restricted as possible  However  if the file permissions are too restricted  the Grafana process may not have access to the necessary files  thus impeding a successful HTTPS setup  Please re examine the listed instructions to double check the file permissions and try again        Cannot assign requested address      listen tcp 34 148 30 243 3000  bind  cannot assign requested address            Resolution  Check the config to ensure the  http addr  is left blank  allowing Grafana to bind to all interfaces  If you have set  http addr  to a specific subdomain  such as  subdomain mysite com   this might prevent the Grafana process from binding to an external address  due to network address translation layers being present


grafana setup restart grafana menuTitle Start Grafana aliases products installation restart grafana How to start the Grafana server labels oss enterprise

Answer:
---
aliases:
  - ../installation/restart-grafana/
  - ./restart-grafana/
description: How to start the Grafana server
labels:
  products:
    - enterprise
    - oss
menuTitle: Start Grafana
title: Start the Grafana server
weight: 300
---

# Start the Grafana server

This topic includes instructions for starting the Grafana server. For certain configuration changes, you might have to restart the Grafana server for them to take effect.

The following instructions start the `grafana-server` process as the `grafana` user, which was created during the package installation.

If you installed with the APT repository or `.deb` package, then you can start the server using `systemd` or `init.d`. If you installed a binary `.tar.gz` file, then you execute the binary.

## Linux

The following subsections describe three methods of starting and restarting the Grafana server: with systemd, initd, or by directly running the binary. You should follow only one set of instructions, depending on how your machine is configured.

### Start the Grafana server with systemd

Complete the following steps to start the Grafana server using systemd and verify that it is running.

1. To start the service, run the following commands:

   ```bash
   sudo systemctl daemon-reload
   sudo systemctl start grafana-server
   ```

1. To verify that the service is running, run the following command:

   ```bash
   sudo systemctl status grafana-server
   ```

### Configure the Grafana server to start at boot using systemd

To configure the Grafana server to start at boot, run the following command:

```bash
sudo systemctl enable grafana-server.service
```

#### Serve Grafana on a port < 1024

### Restart the Grafana server using systemd

To restart the Grafana server, run the following command:

```bash
sudo systemctl restart grafana-server
```

SUSE or openSUSE users might need to start the server with the systemd method, then use the init.d method to configure Grafana to start at boot.

### Start the Grafana server using init.d

Complete the following steps to start the Grafana server using init.d and verify that it is running:

1. To start the Grafana server, run the following command:

   ```bash
   sudo service grafana-server start
   ```

1. To verify that the service is running, run the following command:

   ```bash
   sudo service grafana-server status
   ```

### Configure the Grafana server to start at boot using init.d

To configure the Grafana server to start at boot, run the following command:

```bash
sudo update-rc.d grafana-server defaults
```

#### Restart the Grafana server using init.d

To restart the Grafana server, run the following command:

```bash
sudo service grafana-server restart
```

### Start the server using the binary

The `grafana` binary .tar.gz needs the working directory to be the root install directory where the binary and the `public` folder are located.

To start the Grafana server, run the following command:

```bash
./bin/grafana server
```

## Docker

To restart the Grafana service, use the `docker restart` command.

`docker restart grafana`

Alternatively, you can use the `docker compose restart` command to restart Grafana. For more information, refer to [docker compose documentation](https://docs.docker.com/compose/).

### Docker compose example

Configure your `docker-compose.yml` file. For example:

```yml
version: '3.8'
services:
  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped
    environment:
      - TERM=linux
      - GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-polystat-panel
    ports:
      - '3000:3000'
    volumes:
      - 'grafana_storage:/var/lib/grafana'
volumes:
  grafana_storage: {}
```

Start the Grafana server:

`docker compose up -d`

This starts the Grafana server container in detached mode along with the two plugins specified in the YAML file.

To restart the running container, use this command:

`docker compose restart grafana`

## Windows

Complete the following steps to start the Grafana server on Windows:

1. Execute `grafana.exe server`; the `grafana` binary is located in the `bin` directory.

   We recommend that you run `grafana.exe server` from the command line.

   If you want to run Grafana as a Windows service, you can download [NSSM](https://nssm.cc/).

1. To run Grafana, open your browser and go to the Grafana port (http://localhost:3000/ is default).

   > **Note:** The default Grafana port is `3000`. This port might require extra permissions on Windows. If it does not appear in the default port, you can try changing to a different port.

1. To change the port, complete the following steps:

   a. In the `conf` directory, copy `sample.ini` to `custom.ini`.

   > **Note:** You should edit `custom.ini`, never `defaults.ini`.

   b. Edit `custom.ini` and uncomment the `http_port` configuration option (`;` is the comment character in ini files) and change it to something similar to `8080`, which should not require extra Windows privileges.

To restart the Grafana server, complete the following steps:

1. Open the **Services** app.
1. Right-click on the **Grafana** service.
1. In the context menu, click **Restart**.

## macOS

Restart methods differ depending on whether you installed Grafana using Homebrew or as standalone macOS binaries.

### Start Grafana using Homebrew

To start Grafana using [Homebrew](http://brew.sh/), run the following start command:

```bash
brew services start grafana
```

### Restart Grafana using Homebrew

Use the [Homebrew](http://brew.sh/) restart command:

```bash
brew services restart grafana
```

### Restart standalone macOS binaries

To restart Grafana:

1. Open a terminal and go to the directory where you copied the install setup files.
1. Run the command:

```bash
./bin/grafana server
```

## Next steps

After the Grafana server is up and running, consider taking the next steps:

- Refer to [Get Started]() to learn how to build your first dashboard.
- Refer to [Configuration]() to learn about how you can customize your environment.

aliases         installation restart grafana        restart grafana  description  How to start the Grafana server labels    products        enterprise       oss menuTitle  Start Grafana title  Start the Grafana server weight  300        Start the Grafana server  This topic includes instructions for starting the Grafana server  For certain configuration changes  you might have to restart the Grafana server for them to take effect   The following instructions start the  grafana server  process as the  grafana  user  which was created during the package installation   If you installed with the APT repository or   deb  package  then you can start the server using  systemd  or  init d   If you installed a binary   tar gz  file  then you execute the binary      Linux  The following subsections describe three methods of starting and restarting the Grafana server  with systemd  initd  or by directly running the binary  You should follow only one set of instructions  depending on how your machine is configured       Start the Grafana server with systemd  Complete the following steps to start the Grafana server using systemd and verify that it is running   1  To start the service  run the following commands         bash    sudo systemctl daemon reload    sudo systemctl start grafana server         1  To verify that the service is running  run the following command         bash    sudo systemctl status grafana server             Configure the Grafana server to start at boot using systemd  To configure the Grafana server to start at boot  run the following command      bash sudo systemctl enable grafana server service           Serve Grafana on a port   1024        Restart the Grafana server using systemd  To restart the Grafana server  run the following command      bash sudo systemctl restart grafana server       SUSE or openSUSE users might need to start the server with the systemd method  then use the init d method to configure Grafana to start at boot        Start the Grafana server using init d  Complete the following steps to start the Grafana server using init d and verify that it is running   1  To start the Grafana server  run the following command         bash    sudo service grafana server start         1  To verify that the service is running  run the following command         bash    sudo service grafana server status             Configure the Grafana server to start at boot using init d  To configure the Grafana server to start at boot  run the following command      bash sudo update rc d grafana server defaults           Restart the Grafana server using init d  To restart the Grafana server  run the following command      bash sudo service grafana server restart          Start the server using the binary  The  grafana  binary  tar gz needs the working directory to be the root install directory where the binary and the  public  folder are located   To start the Grafana server  run the following command      bash   bin grafana server         Docker  To restart the Grafana service  use the  docker restart  command    docker restart grafana   Alternatively  you can use the  docker compose restart  command to restart Grafana  For more information  refer to  docker compose documentation  https   docs docker com compose         Docker compose example  Configure your  docker compose yml  file  For example      yml version   3 8  services    grafana      image  grafana grafana latest     container name  grafana     restart  unless stopped     environment          TERM linux         GF INSTALL PLUGINS grafana clock panel grafana polystat panel     ports           3000 3000      volumes           grafana storage  var lib grafana  volumes    grafana storage          Start the Grafana server    docker compose up  d   This starts the Grafana server container in detached mode along with the two plugins specified in the YAML file   To restart the running container  use this command    docker compose restart grafana      Windows  Complete the following steps to start the Grafana server on Windows   1  Execute  grafana exe server   the  grafana  binary is located in the  bin  directory      We recommend that you run  grafana exe server  from the command line      If you want to run Grafana as a Windows service  you can download  NSSM  https   nssm cc     1  To run Grafana  open your browser and go to the Grafana port  http   localhost 3000  is default           Note    The default Grafana port is  3000   This port might require extra permissions on Windows  If it does not appear in the default port  you can try changing to a different port   1  To change the port  complete the following steps      a  In the  conf  directory  copy  sample ini  to  custom ini           Note    You should edit  custom ini   never  defaults ini       b  Edit  custom ini  and uncomment the  http port  configuration option      is the comment character in ini files  and change it to something similar to  8080   which should not require extra Windows privileges   To restart the Grafana server  complete the following steps   1  Open the   Services   app  1  Right click on the   Grafana   service  1  In the context menu  click   Restart        macOS  Restart methods differ depending on whether you installed Grafana using Homebrew or as standalone macOS binaries       Start Grafana using Homebrew  To start Grafana using  Homebrew  http   brew sh    run the following start command      bash brew services start grafana          Restart Grafana using Homebrew  Use the  Homebrew  http   brew sh   restart command      bash brew services restart grafana          Restart standalone macOS binaries  To restart Grafana   1  Open a terminal and go to the directory where you copied the install setup files  1  Run the command      bash   bin grafana server         Next steps  After the Grafana server is up and running  consider taking the next steps     Refer to  Get Started    to learn how to build your first dashboard    Refer to  Configuration    to learn about how you can customize your environment