【发布时间】:2013-11-28 02:52:46
【问题描述】:
我需要能够为任意 Graphite/Carbon 服务中的一个或一组指标动态发现配置的保留级别。现有的 Graphite API 似乎没有公开这些信息。
除了破解 Graphite 源或以其他方式暴露 carbon.conf 文件之外,是否有一种通过 HTTP API 检索此信息的认可方式?
【问题讨论】:
我需要能够为任意 Graphite/Carbon 服务中的一个或一组指标动态发现配置的保留级别。现有的 Graphite API 似乎没有公开这些信息。
除了破解 Graphite 源或以其他方式暴露 carbon.conf 文件之外,是否有一种通过 HTTP API 检索此信息的认可方式?
【问题讨论】:
是的,你可以。您将破解源代码以实现此目的。基本的 Python 知识是必不可少的。
/opt/graphite/storage/whisper。/opt/graphite/storage/whisper/alpha/beta/charlie.wsp。bin/whisper-info.py。/whisper-info.py /opt/graphite/storage/whisper/alpha/beta/charlie.wsp。 你会得到这个-
maxRetention: 31536000
xFilesFactor: 0.0
aggregationMethod: sum
fileSize: 1261468
Archive 0
retention: 31536000
secondsPerPoint: 300
points: 105120
size: 1261440
offset: 28
您会希望通过 webapp 动态显示其中的一部分。
为此,请在
graphite-web/webapp/graphite/render/functions.py 中声明一个自定义方法。要使其“出现”在 webapp GUI 中,您必须在
graphite-web/webapp/content/js/composer_widgets.js 中输入一个条目。
就函数而言,你可以调用whisper库的whisper.info(path)方法,也可以在文件上'运行'bin/whisper-info.py,解析输出并显示为图形。
【讨论】: