Skip to main content

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.

  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, create your Grafana Cloud Account and then go to your account.

  2. Log in to your Grafana instance.

    NOTE

    To install Grafana as a self-hosted instance, follow this installation guide.

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.

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

    Install plugin
NOTE

If you installed Grafana as a self-hosted instance, install the Cognite Data Source for Grafana via the grafana-cli 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.

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

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

    Configure datasource

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 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 to control who can access your dashboards.

TIP

Grafana has a way to share dashboards 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 and community.grafana.com.