How to use path wildcards in Graphite Module

by | Mar 30, 2022

The Graphite module of Icingaweb2 is a great tool for rendering graphs from performance data. The latest version 1.2.0 introduces some bug fixes and new features like dark and light mode support, a lot of new templates, support for path wildcard, etc.

The support for wildcard * was already available in the previous version. We have extended this support and added all the wildcards that graphite offers.

How to use wildcards?

Now suppose we have the following metric filters in a template file:

$service_name_template$.perfdata._data.value
$service_name_template$.perfdata._custom_data_etc.value
$service_name_template$.perfdata._etc_hostname.value
$service_name_template$.perfdata._etc_hosts.value

Instead of creating a new metric filter for each value, we can simplify this by using a path wildcard.

To define a wildcard, the following syntax was introduced in the most recent version of the Graphite module:

$name_here:wildcard syntax here$

Asterisk

We can use the already known * wildcard by adding the $any_name$ instead, and reduces the filters to one line like the following:

$service_name_template$.perfdata.$data$.value

This will cover all the occurrences. In our case, all four given graphs are displayed.

If we only want to create metrics for _etc_hostname  and _etc_hosts, but still with only one line of filter, we can write it as follows:

$service_name_template$.perfdata.$disk:_e*$.value

Character list

Characters in square brackets [...] specify a single character position in the path string, and match if the character in that position matches one of the characters in the list or range. For example, if you want to create metrics for _data, _etc_hostname and _etc_hosts, just write the following:

$service_name_template$.perfdata.$disk:_[de]*$.value

Value list

Comma-separated values within curly braces {foo,bar,...} are treated as value lists, and match if any of the values matches the current point in the path.

$service_name_template$.perfdata.$disk:{_data,_foo,_bar,_etc_hosts}$.value

The upper wildcard list will create filters for all existing metrics, in our case for _data and _etc_hosts.

 

You May Also Like…

Releasing Icinga Director v1.11.2

Releasing Icinga Director v1.11.2

We are pleased to announce the release of Icinga Director version 1.11.2, which addresses several important bug fixes...

Releasing Icinga Web v2.12.2

Releasing Icinga Web v2.12.2

Today we’re announcing the general availability of Icinga Web v2.12.2. You can find all issues related to this release...

Subscribe to our Newsletter

A monthly digest of the latest Icinga news, releases, articles and community topics.