# Setup and administration with API keys

This article explains how you can use the Cognite Data Source for Grafana to use a Cognite Data Fusion (CDF) project as a data source in Grafana to query, explore and visualize data that is stored in CDF.

The Cognite Data Source uses an API key to connect to your CDF project. The API key is stored in a safe location on your computer, and you can safely share the Grafana report with other users. To view the data in the report, the other users need their own API key.

# Connect to Cognite Data Fusion (CDF)

Follow the steps below to connect to a CDF project and use it as a data source in Grafana.

# Before you start

To access data in CDF you need a service account and an API key:

  1. Follow these steps to create a service account. The account needs these capabilities:

    • timeSeriesAcl:READ: required to find and plot time series.
    • assetsAcl:READ: optional to use template variables and select time series from an asset.
    • eventsAcl:READ: optional to use annotations.

    Optionally, you may also need to give access to security categories. More about CDF access management is at docs.cognite.com/cdf/access (opens new window)

  2. Follow these steps to generate an API key for the service account

# Step 1: Sign up for Grafana

To sign up for Grafana:

  1. Navigate to grafana.com (opens new window), create your Grafana Cloud Account and then go to your account.

    Go to Grafana

  2. Log in to your Grafana instance.


Note: To install Grafana as a self-hosted instance, follow this installation guide (opens new window).

# Step 2: Install the Cognite Data Source for Grafana

To install the Cognite Data Source:

  1. Navigate to Configuration > Plugins and click Find more plugins on Grafana.com.


  2. Scroll down and select the Cognite Data Fusion data source. Then, click Install plugin and Install now.


Note: If you installed Grafana as a self-hosted instance, install the Cognite Data Source for Grafana via the grafana-cli (opens new window) command:

grafana-cli plugins install cognitedata-datasource

# Step 3: Configure the Cognite Data Source for Grafana

To add Cognite Data Source to your Grafana instance:

  1. Navigate to Configuration > Data Sources in the left sidebar of your dashboard and click Add data source.


  2. Search for the Cognite Data Fusion data source and click Select.


  3. Configure your data source by providing the project name and the API key. Then click Save and test.


You’re now ready to create your first dashboard.

# Connect the Cognite Data Source to multiple projects

If you need to separate environments (prod/dev) or to give more granular access, you can initialize (opens new window) the Cognite Data Source multiple times with different projects, clusters or/and service accounts.

# Restricting access to dashboards in Grafana

In Grafana, you can use the folder structure (opens new window) to control who can access your dashboards.


Grafana has a way to share dashboards (opens new window) called snapshot. Dashboard snapshots can be accessed by anyone who has the link and can reach the URL. We do not recommend creating snapshots for any dashboards that contain restricted information.

Learn more about managing Grafana at grafana.com (opens new window) and community.grafana.com (opens new window).

Last Updated: 10/14/2021, 7:45:55 AM