Closed Dieterbe closed 12 years ago
You can hit /metrics/index.json to get the entire tree but this will cause the webapp to walk the entire metric directory tree on the filesystem each time it's called which could take longer than you want (or even longer than your webserver's request timeout).
You may instead want to walk the tree as the graphite webapp does: use the /metrics/find endpoint. Start with /metrics/find?query=* and build up from there as needed (/metrics/find?query=carbon.* etc).
thanks that works
Is there a way to find out active metrics and not all metrics. We have a lot of metrics which we don't use anymore but they do appear in the list with /metrics/find?query=*. I only want to see the metrics that are being actively used right now.
@supre - I have an alternate approach to this problem. On the Graphite server itself, I run some variation of this command: sudo find /opt/graphite/storage/whisper -type f -name *.wsp -mtime +7 -ls -delete && sudo find /opt/graphite/storage/whisper/ -type d -empty -delete
, which will remove all metrics that have not been written to in the past week.
@supre http://graphite-api.readthedocs.io/en/latest/api.html#the-metrics-api and https://github.com/graphite-project/graphite-web/blob/master/webapp/graphite/metrics/views.py#L87 suggests the from
parameter, fwiw.
Hi, I've been looking in webapp/graphite/metrics/views.py trying to find a way to get a listing of all metrics in 1 request. (for example in json) this doesn't seem to be possible yet. I'm a bit confused, it seems that there are multiple functions that do similar things, by different means.:
find_view
finds metrics by using a Store object from webapp/graphite/storage.py, whereasexpand_view
does something similar, as doestree_json
which uses another mechanism, and then there'ssearch
which I haven't figured quite out (it seems to use a textbased index. btw: interestingly on my testing machine the index file does not get created)please advise how I should proceed.