收集了write_graphite

时间:2016-03-07 23:49:35

标签: graphite collectd

collectd是否正确支持write_graphite插件的多个实例? Collectd manpage似乎在一个示例中提出了这个建议:https://collectd.org/documentation/manpages/collectd.conf.5.shtml#built_in_targets

我正在尝试专门配置chainsPostCacheChain并通过collectd中的write_graphite插件的多个实例发送指标。原因是,不同的指标需要不同的前缀。

我无法将两个实例都发送到石墨,只有一个或另一个工作。

使用,netstat我可以看到从我的collectd主机到石墨主机建立的两个套接字。运行tcpdump显示两个连接的SYN-ACK,但只有一个实例发送数据。应该通过第二个实例发送的度量标准不会显示在tcpdump或graphite上。

write_graphite的配置如下所示:

LoadPlugin "write_graphite"
<Plugin "write_graphite">
  <Node "def_prefix">
    Host "metrics.example.com"
    Port "2003"
    Prefix "collectd."
    LogSendErrors true
    Protocol "TCP"
    StoreRates true
    AlwaysAppendDS true
    SeparateInstances true
  </Node>
  <Node "statsd_prefix">
    Host "metrics.example.com"
    Port "2003"
    Prefix "statsd."
    LogSendErrors true
    Protocol "TCP"
    StoreRates true
    AlwaysAppendDS true
    SeparateInstances true
  </Node>
</Plugin>

对于PostCacheChain

LoadPlugin match_regex
PostCacheChain "PostCache"
<Chain "PostCache">
  <Rule "statsd_prefix"> # metrics from statsd plugin use diff prefix
    <Match "regex">
      Plugin "^statsd$"
    </Match>
    <Target "write">
      Plugin "write_graphite/statsd_prefix"
    </Target>
    <Target "return">
    </Target>
  </Rule>
  <Target "write">
    Plugin "write_graphite/def_prefix"
  </Target>
</Chain>

感谢您的帮助。

2 个答案:

答案 0 :(得分:1)

我的问题是设置问题。为了快捷方式测试,我在监听模式下运行nc而不是实际的石墨服务器。这导致只有一个石墨插件实例完全连接并传输数据。

在我的情况下,测试场景非常糟糕。

答案 1 :(得分:0)

  <Node "server1">
    Host "graphite1.example.com"
    Prefix "collectd."
    StoreRates true
  </Node>
  <Node "server2">
    Host "graphite2.example.com"
    Prefix "collectd."
    StoreRates true
  </Node>

https://collectd.org/wiki/index.php/Match:Hashed/Config