【问题标题】:Collectd multiple instances of write_graphite收集了多个 write_graphite 实例
【发布时间】:2016-03-07 23:49:35
【问题描述】:

collectd 是否正确支持write_graphite 插件的多个实例?收集的手册页似乎在一个例子中暗示了这一点:https://collectd.org/documentation/manpages/collectd.conf.5.shtml#built_in_targets

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

我无法让两个实例都将数据发送到石墨,只有一个可以工作。

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

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>

感谢您的帮助。

【问题讨论】:

  • 您是否尝试过不使用自定义 postcachechain 规则?
  • @RyanCox 没有自定义 PostCache 规则,它只会使用 write_graphite 插件的默认实例(或第一个实例)。
  • 好的,我的问题是,服务器并不是真正的石墨,它是nc 处于监听模式。否则,多个石墨实例可以正常工作。

标签: graphite collectd


【解决方案1】:

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

就我而言,测试场景太糟糕了。

【讨论】:

    【解决方案2】:
      <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

    【讨论】:

      猜你喜欢
      • 2011-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-18
      • 2013-03-09
      • 2019-07-23
      • 1970-01-01
      相关资源
      最近更新 更多