Odd Regex Capture Result

  • What Grafana version and what operating system are you using?
    RedHat 8.6

  • What are you trying to achieve?
    I’m trying to make a dashboard variable using a regex capture illustrated here: regex101: build, test, and debug regex
    The string examples are copied from the results in the Zabbix API, and you can see that the regex appears to be valid.

  • How are you trying to achieve it?

  • What happened?
    You can see the result in the screen shot, that last match is literally a blank string. This should actually be the “X0” match illustrated in the regex101 example, but for some reason Grafana is returning this as a blank string instead. This causes a blank entry in the returned values for the variable, and a bunch of other weird side effects on panels, etc. because of that blank string.

  • What did you expect to happen?
    I would it expect to return a proper Regex capture as illustrated on the regex101 example. You can see on that test, both lines match and return a valid string.

  • Can you copy/paste the configuration(s) that you are having problems with?
    See previous comments.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors, it just returns the blank string as if it’s a valid value.

  • Did you follow any online instructions? If so, what is the URL?

I should note, it’s possible this is a Grafana core problem and not the Zabbix plugin. However, I figured I would start here since we are using the Zabbix API plugin.