> ## Documentation Index
> Fetch the complete documentation index at: https://gcore.com/docs/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/_____________.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=8cc781f3c9f974da845f713044161ec6" alt="Download and install the plugin" width="1886" height="680" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/data_source.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=16ead0b2305489894800e3f7521b16bd" alt="Configuration" width="308" height="689" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/_________Data_Source.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=b1fb927a4faee5c4e9286cf026f6314f" alt="data source" width="1203" height="462" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/cdn-stats.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=a191e85d3f44c1de3b29c01f5a38a718" alt="cdn-stats plugin" width="1816" height="1308" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/mceclip0.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=7ce8031caaeee0645e041ddb64985003" alt="Add a permanent API token" width="1352" height="834" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/api_token_1.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=48249ce98cbdfc0ca0f32ef7cd3d0d17" alt="Insert the received API token" width="983" height="578" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/save_test.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=f0b569d14d4c9bdfe894a924a36f0520" alt="Save " width="1723" height="653" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/dashboard.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=2eae893a74d6b596d9945864acf31f28" alt="Configure the Dashboard" width="593" height="509" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/add_panel.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=ea9910ab561c2ee3af5b69e014b2e9d0" alt="Add an empty pane" width="1341" height="563" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/query.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=f77701204adf41722071dea69482deaf" alt="query.png" width="632" height="368" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/query_props_1.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=1deb81b5551898e57dc857dfa5733ca0" alt="Select the necessary metric," width="625" height="239" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/grafa.jpg?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=8ed3f223cc74f6a1c1c2681dad273f3f" alt="Legend" width="655" height="851" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/15717167195025.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=7db8e0a28d0241351326802788cdd075" alt="Traffic " width="1250" height="1680" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/panel_settings.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=bbc530bdcf564ebb04f823462c3fa6d0" alt="dashboard settings" width="530" height="590" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/add_variable.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=ce7e954cdfa8ba1aafaf3cd4058b36c7" alt="Variables" width="1598" height="635" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/variables_edit.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=b1def90375590c87d2e809ee407b0c82" alt="Update" width="1464" height="1133" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/go_back.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=91b27c388cae25523f69f6783d18f7c3" alt="Go back t" width="501" height="136" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/filters.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=715747f5acda9f36d86a75f69bf46369" alt="Resources" width="633" height="305" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/pane_____.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=d36d1c3cf483db123e8f8829b4b32c4b" alt="chart" width="885" height="692" data-path="images/docs/cdn/grafana/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/HKVOyiuQvk3-JYfE/images/docs/cdn/grafana/view-cdn-statistics-in-grafana/save.png?fit=max&auto=format&n=HKVOyiuQvk3-JYfE&q=85&s=e034e4e0848433249045a2bf571b26ab" alt="Save the Dashboard" width="515" height="403" data-path="images/docs/cdn/grafana/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>
