API
The Gcore Customer Portal is being updated. Screenshots may not show the current version.
CDN
CDN
BillingCDN resources overviewOrigin groupPurgePrefetchReports
API
Chosen image
Home/CDN/Grafana, Terraform/Grafana reports

Veiw 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 + from 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/traffic from the CDN to users);
  • Edges Traffic, which is traffic from CDN, consisting of traffic from Shielding to CDN + from CDN to users;
  • Shield Traffic, which is traffic from 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;
  • 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 + from 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: how much more traffic is sent from the Shielding than from the origin, calculated using the formula: (traffic from the Shielding to the CDN - traffic from the origin to the Shielding) / traffic from the 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 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.

Download and install the plugin

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

Restart and log in to Grafana.

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

Configuration

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

data source

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

cdn-stats plugin

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. 

Add a permanent API token

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

For example: APIKey 7711$eyJ0eXAiOiJKV

Insert the received API token

Click Save & Test.

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

Save

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.

Configure the Dashboard

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

 Add an empty pane

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

query.png

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

 Select the necessary metric,

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

Legend

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}}.

Traffic

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

dashboard settings

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

Variables

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.
Update

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

Go back t

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.

Resources

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

chart

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

Save the Dashboard

Configure the Dashboard step video instructions

Was this article helpful?

Not a Gcore user yet?

Learn more about our next-gen CDN

Go to the product page