【发布时间】:2018-07-30 15:11:44
【问题描述】:
我在 Graphite 中有很多指标,我必须搜索它们。
我尝试使用whisper-fetch.py,但它返回指标值(数字),我想要指标名称,类似这样:
前缀1.prefix2.metricName1 前缀1.prefix2.metricName2 ...
谢谢。
【问题讨论】:
我在 Graphite 中有很多指标,我必须搜索它们。
我尝试使用whisper-fetch.py,但它返回指标值(数字),我想要指标名称,类似这样:
前缀1.prefix2.metricName1 前缀1.prefix2.metricName2 ...
谢谢。
【问题讨论】:
您可以只使用 unix find 命令,例如find /data/graphite -name 'some_pattern' 或使用 web api,例如curl http://my-graphite/metrics/find?query=somequery,见graphite metrics api
【讨论】:
/data/graphite 的目录,我可以在其中找到我的指标
.wsp 文件中吗?当我使用 Whisper-fetch.py 读取这些 .wsp 文件时,我只得到值(数字)而不是实际的指标名称
Graphite 有一个专用端点用于检索所有指标,作为其HTTP API 的一部分:/metrics/index.json
例如,对我的本地 Graphite 运行此命令
curl localhost:8080/metrics/index.json | jq "."
产生以下输出:
[
"carbon.agents.graphite-0-a.activeConnections",
"carbon.agents.graphite-0-a.avgUpdateTime",
"carbon.agents.graphite-0-a.blacklistMatches",
"carbon.agents.graphite-0-a.cache.bulk_queries",
"carbon.agents.graphite-0-a.cache.overflow",
...
"stats_counts.response.200",
"stats_counts.response.400",
"stats_counts.response.404",
"stats_counts.statsd.bad_lines_seen",
"stats_counts.statsd.metrics_received",
"stats_counts.statsd.packets_received",
"statsd.numStats"
]
【讨论】: