Search code examples
graphitecollectd

Collectd multiple instances of write_graphite


Does collectd properly support multiple instances of write_graphite plugin? Collectd manpage seems to suggest this in an example: https://collectd.org/documentation/manpages/collectd.conf.5.shtml#built_in_targets

I am trying to configure chains specifically, PostCacheChain and send metrics via multiple instances of write_graphite plugin in collectd. The reason is, different metrics need different prefix.

I am unable to get both instances to send data to graphite, only one or the other works.

Using, netstat I can see two sockets established from my collectd host to graphite host. Running tcpdump shows SYN-ACK for both connections, but only one instance sends the data. Metrics that are supposed to be sent via 2nd instance doesn't show up on tcpdump or graphite.

The configuration for write_graphite look like this:

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>

And for 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>

Thanks for any help.


Solution

  • The problem in my case was a setup issue. To shortcut testing, I had nc running in listen mode instead of actual graphite server. This caused, only one graphite plugin instance to fully connect and transmit data.

    So bad test scenario in my case.