配置 statsd 以使用 Graphite

Configure statsd to work with Graphite

因此,我想安装 statsd 并使用客户端 python-statsd 为已成功安装在我的系统上的 Graphite 收集一些数据。我关注了 this tutorial,但我的 Graphite 文件夹中仍然没有 statsd 子目录

那么可能出了什么问题,我该如何检查 statsd 是否正常工作? (我的 python-statsd 客户端没有显示任何错误消息)

statsd 必须知道 carbon-cache(或 carbon-relay)的位置,它是您遵循的教程的一部分。这应该进入 statsd 的配置。

{
graphitePort: 2003,
graphiteHost: "127.0.0.1",
port: 8125
}

要测试 carbon-cache 是否有效,您可以使用 echo

发送消息
echo "foo.bar 1 `date +%s`" | nc -q0 <graphite host> 2003

这应该会为您提供一个目录 foo,其中包含度量 bar 和值 1

如果可行,那么您的 carbon 已正确配置并且可以访问。接下来测试它与 statsd

对话
echo "foo.bar:2|c" | nc -q0 -u <statsd host> 8125

应该会在 foo.bar 中为您提供 2 的新值。如果可行,那么一切都应该可行。