hectcastro / chef-collectd

A Chef cookbook to install collectd.
Apache License 2.0
23 stars 64 forks source link

[Plugin LWRP] Please support write plugins syntax like "influxdb" one #47

Open BarthV opened 9 years ago

BarthV commented 9 years ago

Ohai Chefs,

I need to put a collectd plugin like this one :

LoadPlugin "write_sensu"
<Plugin write_sensu>
  <Node "localagent">
    Host "127.0.0.1"
    Port "3030"
    Separator "."
    StoreRates true
    AlwaysAppendDS false
    Metrics true
    MetricHandler "influx"
    Notifications false
  </Node>
</Plugin>

Currently collectd_plugin lwrp is not able to create the <Node "localagent"> sub-item. The configuration can only be "flat".

Is is possible to handle this case ?

BarthV commented 9 years ago

I had to dig on lwrp provider to find out that we can specify a template to it :)

So currently it's working with a local custom template with the appropriate <Node "localagent">:

   "write_sensu" => {
    "template" => "write_sensu.conf.erb",
    "cookbook" => "my-sensu",
    "config" => {
      "Host" => "127.0.0.1",
      "Port" => "3030",
      "Separator" => ".",
      "StoreRates" => true,
      "AlwaysAppendDS" => false,
      "Metrics" => true,
      "MetricHandler" => "influx",
      "Notifications" => false
    }
  }

It would still be nice to have a way to specify custom sub-items in "config" hash.