Plugins 〉Hetzner Cloud


Developer
Julian Tölle <julian.toelle97@gmail.com>


Sign up to receive occasional product news and updates:



Data Source
community

Hetzner Cloud

  • Overview
  • Installation
  • Change log
  • Related content

Hetzner Cloud data source for Grafana

Example Query

Version in Marketplace Downloads in Marketplace Grafana Dependency

Introduction

With this plugin you can display metrics data for your Hetzner Cloud Servers & Load Balancers in your Grafana dashboards. It works directly with the Hetzner Cloud API, and does not require Prometheus or any other additional software.

Requirements

  • Grafana 10+

Getting Started

After you have installed the data source plugin, you need to add a new data source in Grafana. Create a new read API Token for the project and set it in the data source settings.

To quickly get started, you can import the included dashboard, which displays all available metrics for servers & load balancers. This is available in a tab on the data source settings page. Alternatively you can also get the JSON from the repo.

Documentation

Query Editor

Query Editor

The Query Editor can be hard to grasp at first, so here is an overview of the available options.

Selecting Resources

In the query editor, you can choose which resources type, server or load balancer, you want to get metrics for.

To define which servers/load balancers you want to see in the graph, you can choose between the following options:

  • IDs: A drop-down list of all available servers/load balancers in the project. You can select multiple IDs.
  • Labels: You can set label selectors to filter the resources. This is useful if you have a dynamic list of resources.
  • Variable: This option exists to support using Dashboard-wide variables to select the resources. Should include the $ prefix of the variable, e.g. $servers. See Using Variables for more details.

Legend Format

You can rename the returned series names by using the Legend Format field in the query editor. This works similar to the Prometheus data source.

In the specified format, you can include the names of labels in {{ }} brackets, and they will be replaced with the actual label values.

Right now, the following labels are available:

  • name: The name of the resource (server or load balancer)
  • id: The ID of the resource
  • series_name: Name of the series from the API (e.g. disk.0.iops.read)
  • series_display_name: A human-readable name for the series (e.g. Read)

If not specified, the default format is: {{ series_display_name }} {{ name }}.

Query Type

By default, queries return metrics. It is also possible to select the Query Type List Resources. This will return a table of the matching resources with some interesting fields, like the server type and the labels.

The returned field var is necessary for Using Variables.

Using Variables

If you would like to have a dropdown list of servers or load balancers in your dashboard, you can use the List Resources query type to get a list of resources.

The returned values from this will look like $resource_name : $resource_id. Add the regex (?<text>.*) : (?<value>.*) to get the resource name as options. This regex is also required so you can use the variable in later queries, as it will make the ID the value when the option is selected.

Assuming you created the variable $servers with the mentioned regex, you can now create a new panel with the Metrics query type, click Select By Variable and set the variable name field to $servers.

The panel should then automatically update when you select different servers in the dropdown.

You can also take a look at the included dashboard to see in practice how this should be set up.

Multiple Projects

If you want to access metrics from multiple Hetzner Cloud projects, you need to create a new data source for each project, with separate API Tokens. The default dashboard has a variable to select the current project.

Contributing

If you have any questions, feedback or ideas, feel free to open an issue or pull request.

Support Disclaimer

This is not an official Hetzner Cloud product in any way and Hetzner Cloud does not provide support for this.

Installing Hetzner Cloud on Grafana Cloud:

For more information, visit the docs on plugin installation.

Changelog

0.3.0 (2024-04-28)

New Features

  • Colors in time series visualisation are now consistent across refreshes

0.2.0 (2024-01-12)

New Features

  • Sign Plugin for distribution
  • improve error message when API Token is invalid or missing

Bug Fixes

  • resource calls using wrong paths and not handling unknown route

0.1.1 (2024-01-10)

Bug Fixes

  • remove double slash in resource calls from frontend
  • remove type assertation for *prometheus.Registry by @apricote in #1

0.1.0 (2024-01-06)

  • Initial release.