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
.