Regular Expressions 101

Community Patterns

Grafana - Templating with Variables : Display Text to Value

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<value>^Interface ethernet1\/4.(?<text>25[0-6]|(2[0-4]|1\d|[1-9])\d|[1-9]).*):.*
/
gm

Description

Grafana Templating : Friendly Variable Values as Display Names

Check below Grafana Documentation for the Use Case : https://grafana.com/docs/grafana/latest/dashboards/variables/add-template-variables/#filter-and-modify-using-named-text-and-value-capture-groups

This example demonstrates how to extract VLAN ID from Zabbix item names which are automaticaly generated by Zabbix Discovery Rules. Grafana - Zabbix Integration uses these items to poll for data. Therefore while templating with variables whose values are dynamically populated by Zabbix integration queries, related query should match whole string of the item, however should only accept a part of it as value and also has a friendly-name.

Submitted by ulgena - a year ago (Last modified a year ago)