4

I need to query graphite for data with a few different targets; currently I do a http query for each target. for instance:

http://graphite.example.com/render/?format=json&until=now&from=-1min&target=servers.srv231.solr.hits
http://graphite.example.com/render/?format=json&until=now&from=-1min&target=servers.srv325.solr.hits

Is there a way to get the two results in one query? I could do as follows:

http://graphite.example.com/render/?format=json&until=now&from=-1min&target=servers.srv*.solr.hits

but I would get a lot of other data that I am not interested in.

i've tried using regular expressions, like this, but it does not work:

http://graphite.example.com/render/?format=json&until=now&from=-1min&target=servers.srv(231|325).solr.hits

In the doc, they do not mention regular expressions nor wildcards, but they use wildcards in the examples. http://graphite.readthedocs.org/en/0.9.10/render_api.html

is there a way to achieve my goal?

1
  • I just saw that the target parameter can be repeated multiple times, so I could do graphite.example.com/render/…. that's ok for me. however, is it still possible to use regular expressions or a more concise way? Commented Aug 14, 2013 at 15:33

1 Answer 1

8

Graphite uses globs not regular expressions for matching. So your query would be:

http://graphite.example.com/render/?format=json&until=now&from=-1min&target=servers.srv{231,325}.solr.hits
3
  • it works, thanks! is there a reference about the glob pattern? this one en.wikipedia.org/wiki/Glob_(programming) does not include the brackets {}. this one has: linux.die.net/Linux-CLI/x11655.htm or maybe there is not a standard one? i didn't find a doc about glob in graphite. Commented Sep 3, 2013 at 9:50
  • 2
    As graphite is a python app, I'm guessing that it uses the python glob module, which would pretty much be the same as your link to linux.die.net, which all looks like what I've used with graphite before. Commented Sep 3, 2013 at 9:58
  • 1
    the link to the python glob module does not mention curly brackets {}. i see that there is a patch for supporting curly brackets in python glob bugs.python.org/issue9584 but it seems that it is not in the current implementation, and i don't find it documented in the python glob module. ?? Commented Sep 4, 2013 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.