> ## Documentation Index
> Fetch the complete documentation index at: https://gcore-doc-1256a.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# View CDN statistics in Grafana

With the Gcore cdn-stats plugin in Grafana, you can display the CDN statistics by:

* **Total Traffic,** which is total traffic volume, consisting of traffic from origin to CDN or [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) + from [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) to CDN + from CDN to users;
* **Byte cache Hit Ratio,** which is the share of cached traffic, calculated using the formula: 1-(traffic from the origin to the CDN or [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding)/traffic from the CDN to users);
* **Edges Traffic,** which is traffic from CDN, consisting of traffic from [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) to CDN + from CDN to users;
* **Shield Traffic,** which is traffic from [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) to CDN;
* **Origin Traffic,** which is traffic from the origin, consisting of traffic from the origin to the CDN or from the origin to the [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding);
* **Total Requests,** which is the number of requests to the CDN;
* **2xx, 3xx, 4xx, 5xx Responses,** which is the number of 2xx, 3xx, 4xx, and 5xx responses;
* **Bandwidth,** which is bandwidth, calculated based on traffic from the origin to the CDN or [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) + from [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) to CDN + from CDN to users;
* **Cache Hit Ratio,** which is the share of sending cached content, consisting of responses with cached content / requests to CDN;
* **Shield traffic ratio** is the efficiency of the [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding): how much more traffic is sent from the [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) than from the origin, calculated using the formula: (traffic from the [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) to the CDN - traffic from the origin to the [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding)) / traffic from the [Shielding](/cdn/cdn-resource-options/general/enable-and-configure-origin-shielding) to the CDN;

You can group metrics by the following parameters:

* **Clients** is for clients;
* **Resource** is for CDN resources;
* **Region** is for regions;
* **Country** is for countries;
* **Data** is for data centers;
* **Vhost** is for a personal domain.

**Note** : The plugin is designed for Grafana version 7.0 and higher.

To configure CDN statistics in Grafana, you need to:

* Use Grafana version 7.0 and higher.

Video instructions of the steps:

## Download and install the plugin

[Download](https://github.com/G-Core/cdn-stats-datasource-plugin/releases) the gcore-cdn-stats-datasource-1.0.8.zip file with the latest version of the plugin in GitHub.

**Note** : The numbers (1.0.8) in the file name indicate the plugin version and may differ depending on updates.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/_____________.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=ece3ae785353a1c7c732b2ef12b4c760" alt="Download and install the plugin" width="1886" height="680" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/_____________.png" />
</Frame>

Unzip the archive to the Grafana plugin folder. By default, this is the *Grafana\grafana\data\plugins* installation folder.

[Restart](https://grafana.com/docs/grafana/latest/installation/restart-grafana) and [log](https://grafana.com/docs/grafana/latest/fundamentals/getting-started/first-dashboards/) in to Grafana.

Click the gear icon in the menu to open the "Configuration" section, select "Data Sources".

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/data_source.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=bb545f1b7ae3985086977a3586d30904" alt="Configuration" width="308" height="689" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/data_source.png" />
</Frame>

Click **Add data source** to add a new resource for getting data.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/_________Data_Source.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=c2c3314112a57d7e008a04005d560724" alt="data source" width="1203" height="462" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/_________Data_Source.png" />
</Frame>

Find the cdn-stats plugin from Gcore and click "Select".

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/cdn-stats.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=7c106847f90a7a1fcb95dc7b6462802d" alt="cdn-stats plugin" width="1816" height="1308" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/cdn-stats.png" />
</Frame>

The plugin settings will be opened. Add a permanent API token to the "Auth" section.

You can get a token in your personal account. To do this, go to Profile > API tokens > Create.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/mceclip0.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=de98b0b3acc58ffd25fbc719ebeba01d" alt="Add a permanent API token" width="1352" height="834" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/mceclip0.png" />
</Frame>

Insert the received API token in the API token field in the format: **APIKey** `{the received API token}`.

For example: `APIKey 7711_eyJ0eXAiOiJKV`

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/api_token_1.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=cb12ddda9ddc6c7dd8aa3fe7d49996fd" alt="Insert the received API token" width="983" height="578" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/api_token_1.png" />
</Frame>

Click **Save & Test**.

If everything is correct, you will see the following messages: "Datasource updated" and "You successfully authenticated as {Name}".

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/save_test.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=57abb380b8ccb0f75176c6f560ff89bf" alt="Save " width="1723" height="653" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/save_test.png" />
</Frame>

## The Download and install the plugin step video instructions

## Configure the dashboard

Click on the **+** in the menu to open the "Create" section, select "Dashboard" to add a new dashboard.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/dashboard.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=0ae01fc506a2ca3642d436341c58e3a9" alt="Configure the Dashboard" width="593" height="509" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/dashboard.png" />
</Frame>

In the next window, click "Add an empty panel" to create a new panel.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/add_panel.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=51cee64d91e0459906b61bf6b8b21bf1" alt="Add an empty pane" width="1341" height="563" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/add_panel.png" />
</Frame>

Make sure that "cdn-stats" is set as the data source in the Query section.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/query.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=13fa7a3bf4df8f32ca62d189a38bcca7" alt="query.png" width="632" height="368" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/query.png" />
</Frame>

Select the necessary metric, granularity, and grouping (you can select several).

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/query_props_1.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=f1e6db5499c687b16e7c7ef8e8db23b8" alt="Select the necessary metric," width="625" height="239" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/query_props_1.png" />
</Frame>

The "Legend" field displays the values of the Group by field and the name of the metric by default:

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/grafa.jpg?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=fe0bea944142a8a7096093074bfa0168" alt="Legend" width="655" height="851" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/grafa.jpg" />
</Frame>

You can customize the output of legend data.

Set a name for the metric and in brackets `{{}}` set the parameters specified in the Group by field.

For example, for the settings above, you can set the following format: Traffic quantity — `{{resource}}`.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/15717167195025.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=d18911f348ddeba4ace6f59ae18410a0" alt="Traffic " width="1250" height="1680" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/15717167195025.png" />
</Frame>

Open the dashboard settings by clicking on the gear icon in the upper-right corner.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/panel_settings.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=861be8478795de47c152d0b60ad3754a" alt="dashboard settings" width="530" height="590" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/panel_settings.png" />
</Frame>

Go to the "Variables" section and click "Add variable". You can use it to filter the data on the chart.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/add_variable.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=ab2e89b8ef1b56962939c47166627c14" alt="Variables" width="1598" height="635" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/add_variable.png" />
</Frame>

For example, to be able to filter resources, you need to make the following settings and click "Update":

* In the ***Name*** you can specify the variable name (required).
* In the ***Values for*** you can select a value for the variable: resourceID (resources).
* In the ***Sort*** you can set the sorting order of the elements (optional)
* In the ***Selection Options*** you can set the way of how elements can be selected (optional)
  * In the ***Multi-value*** you can set the ability to select multiple elements.
  * In the ***Include All option*** you can set the ability to select all elements by marking the All value.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/variables_edit.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=a9e8432b0a2fcb446d00652015688e9a" alt="Update" width="1464" height="1133" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/variables_edit.png" />
</Frame>

Go back to the dashboard by clicking the arrow icon in the upper-left corner of the screen.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/go_back.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=625847e2a7741d7bc4d1935ef44a2c92" alt="Go back t" width="501" height="136" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/go_back.png" />
</Frame>

Connect the variable with the Dashboard. To do this, specify its name in the "Resources" field of the "Filters (comma separated)" section.

**Important!** Enter "\$" before the variable name.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/filters.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=9f843f8a7099643d9c066f718e98d197" alt="Resources" width="633" height="305" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/filters.png" />
</Frame>

Now you can choose resource data to be displayed on the chart.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/pane_____.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=a32468efece80b310e1fc2a481c7fa84" alt="chart" width="885" height="692" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/pane_____.png" />
</Frame>

Save the Dashboard. To do this, click "Save" in the upper-right corner of the panel.

<Frame>
  <img src="https://mintcdn.com/gcore-doc-1256a/EaY1YqcfSvD4McT0/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/save.png?fit=max&auto=format&n=EaY1YqcfSvD4McT0&q=85&s=fec90f83d74db84e25ca5270405a7784" alt="Save the Dashboard" width="515" height="403" data-path="images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/save.png" />
</Frame>

## Configure the dashboard step video instructions

<Frame>
  <iframe width="100%" src="https://www.youtube.com/embed/EZUdzlpyyDU" title="Dashboard setup: EN" frameborder="0" allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen />
</Frame>
