Rename by regex - extract other data than the result

Hello,

I’m currently stuck with the Rename by regex function for a gauge panel…

So I have this gauge panel with multiple queries which are retrieving the same sort of data but from different hosts. For example: I have 10 gauges in one panel which all show Active connections. But these active connections are from different hosts. So I want to show the hostname of each query instead of Active connections.

I’m using the inofficial CheckMK plugin. The query of it looks like this:

> {
>   "request": {
>     "method": "POST",
>     "url": "api/datasources/proxy/13/cmk/check_mk/webapi.py?action=get_graph",
>     "data": "request={\"specification\":[\"combined\",{\"context\":{\"host\":{\"host\":\"host-01"}},\"datasource\":\"services\",\"single_infos\":[\"host\"],\"graph_template\":\"METRIC_active\",\"presentation\":\"lines\"}],\"data_range\":{\"time_range\":[1660266335,1660309535]}}",
>     "hideFromInspector": false
>   },
>   "response": {
>     "result_code": 0,
>     "result": {
>       "start_time": 1660266240,
>       "end_time": 1660309440,
>       "step": 120,
>       "curves": [
>         {
>           "line_type": "line",
>           "color": "#a500ff",
>           "title": "Active connections",
>           "rrddata": [
>             null,
>             0,
>             0,
>             0,
>             3,
>             3,
>             3,
>             3,
>             3,
>             3,
>             3
>           ]
>         }
>       ]
>     }
>   }
> }

So I would like to have active connections replaced with hostname (in this case host-01)

Is this possible?

Is there any way I can extract the hostname from the request itself?

Hi @schischi,

Welcome to the :grafana: community forum !!

Yes, it is possible by using variables in Grafana.

Also, found on the Check_MK page a good link to documentation as how to use the variables (e.g. hostname, service etc.) within Grafana.

Hope this helps.