Filtering query from another query


I have a graphite data tree that I can’t change and am forced to deal with.
Trying to keep Grafana/Graphite syntax, basically, it goes this way:
root.monitor.[[hostname]].{CPU, RAM, [[appname]]_[[appmetric]], …}

I succeeded extracting [[appname]] and create a variable $appname using:
query: root.monitor..*
regex: /^([A-Z]+)

Now, I would like to get every [[hostname]] where [[appname]] matches the one selected using $appname. If I were in sh, I would filter using awk this way:
# (echo “root.monitor.host1.app1_thing”;
> echo “root.monitor.host4.app2_other”;
> echo “root.monitor.host8.app1_thing”) |
> awk -F ‘.’ ‘/app1/ { print $3 }’

Is this doable using Grafana/Graphite to end with an [[hostname]] variable that depends on the [[appname]] variable?

Thanks for help.

As far as I know I don’t think it’s possible. Newer versions of Graphite has support for tags which makes your use case a lot easier to support.

1 Like