2

I am trying to setup a collectd configuration that sends metrics to two separate http server endpoints.

My setup has Client (C) with collectd plugin running on it. Of all the metrics it collects, all of the metrics need to be sent to Server (A); and a part of the metrics also need to be sent to Server (B).

Setup:

I am using the following configuration for the write_http plugin:

<Plugin write_http>
    <Node "serverA">
            URL "http://servera/collectd-post"
            Format "JSON"
            StoreRates false
    </Node>
    <Node "serverB">
            URL "http://serverb/collectd-post"
            Format "JSON"
            StoreRates false
    </Node>
</Plugin>

Further, to selectively send the metrics, I tried using the following flow control configuration:

  PostCacheChain "bchain"
  <Chain "bchain">
    <Rule "brule">
      <Match "regex">
        Plugin "(load|interface|disk|cpu|memory|df|swap|processes)"
      </Match>
      <Target "write">
        Plugin "write_http/serverB"
      </Target>
      <Target "return">
      </Target>
    </Rule>
     <Target "return">
     </Target>
   </Chain>

Per my understanding of the flow control rules, the above configuration should send metrics from plugins (load, interface, disk, cpu, memory, df, swap, and processes) to serverb node of write_http plugin (as part of the "brule" Rule). These matched metrics should also become available for sending to the other node in the http plugin (because of the Target "return" inside the "brule" Rule).

All other metrics should be processed and sent by the other node in the http plugin (because of the Target "return" outside the "brule" Rule).

The problem I am facing is that I cannot get the functionality working the way I want it to work.

Whats working:

  • ALL metrics duplicated to BOTH server A and server B, if I remove the PostCacheChain configuration.
  • Selected metrics sent ONLY to server B, if the PostCacheChain configuration is kept.
  • If using another write plugin, ALL metrics sent to that plugin and only SELECTED metrics sent to server B, when using PostCacheChain configuration

Whats not working:

  • When using the PostCacheChain as listed, NO metrics are sent to server A

Any solutions or suggestions to get the split destination working would be greatly appreciated.

ps: The documentations for write_http plugin and the collectd flow-control both seem to indicate I am correct in my approach. However, to me, it looks like a write_http plugin is processed only once (even when it has multiple nodes) and that once a write plugin is referred in a rule, it will not be processed outside of the rule.

sujitv
  • 135
  • 1
  • 12

0 Answers0