> ## Documentation Index
> Fetch the complete documentation index at: https://gcore-doc-1046.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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/_____________.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=fed38fce5fee08f59cd64dec93e650b2" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/data_source.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=ac8175c3d97a2fbf88f23021f555b1f8" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/_________Data_Source.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=88ad93b1474dce2ea96d0f5bed109c96" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/cdn-stats.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=09fc4dc9c55ccf9b8527894d550eb35e" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/mceclip0.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=a1e7ad7eaacc92d80284c603863bef31" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/api_token_1.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=9c3e561d81541fa5ef1285c3fde627c7" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/save_test.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=407fccb238f7fe1ec8f275e4758380fe" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/dashboard.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=d119d335bb342cd119e94bcfba6f0cd8" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/add_panel.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=d27112d546fdf6870b0d7ea4bb6200c3" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/query.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=aa68b3ccb181e32a101438cb846ed458" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/query_props_1.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=cac71d46c94fce16142b1e9bdb77d6d0" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/grafa.jpg?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=8a764a6a54d5cc741a486aaef09c14ce" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/15717167195025.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=11983e17609b5684386db7567d865008" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/panel_settings.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=61669dc432ce05ab889e432fcd426174" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/add_variable.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=a22b6646b4b7c5c50bcaf8d860046c2e" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/variables_edit.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=8cc7c7a524b20a941cf9e21036c7f9ee" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/go_back.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=e277922318738c3adc76b1c440db1db3" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/filters.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=9158ee60e078e0543c900bc59eab0275" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/pane_____.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=b9b0285387ceb02dde890a0d09fa8617" 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-1046/VOq4jXcdwrEXEzq8/images/docs/cdn/grafana-terraform/view-cdn-statistics-in-grafana/save.png?fit=max&auto=format&n=VOq4jXcdwrEXEzq8&q=85&s=e4154651917c8d98d627e3a1a7ed7514" 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>
